mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-15 23:43:43 +01:00
commit
85110f3ce8
20 changed files with 72 additions and 33 deletions
|
@ -183,8 +183,7 @@ public class DeployerTileEntity extends KineticTileEntity {
|
|||
if (state == State.EXPANDING) {
|
||||
if (boop)
|
||||
triggerBoop();
|
||||
else
|
||||
activate();
|
||||
activate();
|
||||
|
||||
state = State.RETRACTING;
|
||||
timer = 1000;
|
||||
|
|
|
@ -82,7 +82,7 @@ public class AirCurrent {
|
|||
protected void tickAffectedEntities(World world, Direction facing) {
|
||||
for (Iterator<Entity> iterator = caughtEntities.iterator(); iterator.hasNext();) {
|
||||
Entity entity = iterator.next();
|
||||
if (!entity.getBoundingBox()
|
||||
if (!entity.isAlive() || !entity.getBoundingBox()
|
||||
.intersects(bounds)) {
|
||||
iterator.remove();
|
||||
continue;
|
||||
|
|
|
@ -153,6 +153,8 @@ public class MechanicalPressTileEntity extends BasinOperatingTileEntity {
|
|||
|
||||
for (ItemEntity itemEntity : world.getEntitiesWithinAABB(ItemEntity.class,
|
||||
new AxisAlignedBB(pos.down()).shrink(.125f))) {
|
||||
if (!itemEntity.isAlive() || !itemEntity.onGround)
|
||||
continue;
|
||||
ItemStack stack = itemEntity.getItem();
|
||||
Optional<PressingRecipe> recipe = getRecipe(stack);
|
||||
if (!recipe.isPresent())
|
||||
|
@ -233,7 +235,7 @@ public class MechanicalPressTileEntity extends BasinOperatingTileEntity {
|
|||
for (Entity entity : world.getEntitiesWithinAABBExcludingEntity(null, bb)) {
|
||||
if (!(entity instanceof ItemEntity))
|
||||
continue;
|
||||
if (!entity.isAlive())
|
||||
if (!entity.isAlive() || !entity.onGround)
|
||||
continue;
|
||||
ItemEntity itemEntity = (ItemEntity) entity;
|
||||
pressedItems.add(itemEntity.getItem());
|
||||
|
|
|
@ -227,6 +227,12 @@ public class BlockMovementTraits {
|
|||
if (state.getBlock() instanceof SailBlock)
|
||||
return facing.getAxis() == state.get(SailBlock.FACING)
|
||||
.getAxis();
|
||||
if (AllBlocks.PISTON_EXTENSION_POLE.has(state))
|
||||
return facing.getAxis() != state.get(BlockStateProperties.FACING)
|
||||
.getAxis();
|
||||
if (AllBlocks.MECHANICAL_PISTON_HEAD.has(state))
|
||||
return facing.getAxis() != state.get(BlockStateProperties.FACING)
|
||||
.getAxis();
|
||||
return isBrittle(state);
|
||||
}
|
||||
|
||||
|
|
|
@ -63,6 +63,7 @@ import net.minecraft.block.ChestBlock;
|
|||
import net.minecraft.block.DoorBlock;
|
||||
import net.minecraft.block.IWaterLoggable;
|
||||
import net.minecraft.block.PressurePlateBlock;
|
||||
import net.minecraft.block.material.PushReaction;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.fluid.IFluidState;
|
||||
|
@ -139,7 +140,7 @@ public abstract class Contraption {
|
|||
|
||||
public abstract boolean assemble(World world, BlockPos pos);
|
||||
|
||||
protected abstract boolean canAxisBeStabilized(Axis axis);
|
||||
public abstract boolean canBeStabilized(Direction facing, BlockPos localPos);
|
||||
|
||||
protected abstract ContraptionType getType();
|
||||
|
||||
|
@ -245,7 +246,7 @@ public abstract class Contraption {
|
|||
fluidStorage.forEach((pos, mfs) -> mfs.tick(entity, pos, world.isRemote));
|
||||
}
|
||||
|
||||
protected boolean moveBlock(World world, BlockPos pos, Direction forcedDirection, List<BlockPos> frontier,
|
||||
protected boolean moveBlock(World world, BlockPos pos, @Nullable Direction forcedDirection, List<BlockPos> frontier,
|
||||
Set<BlockPos> visited) {
|
||||
visited.add(pos);
|
||||
frontier.remove(pos);
|
||||
|
@ -311,14 +312,13 @@ public abstract class Contraption {
|
|||
Map<Direction, SuperGlueEntity> superglue = SuperGlueHandler.gatherGlue(world, pos);
|
||||
|
||||
// Slime blocks and super glue drag adjacent blocks if possible
|
||||
boolean isStickyBlock = state.isStickyBlock();
|
||||
for (Direction offset : Iterate.directions) {
|
||||
BlockPos offsetPos = pos.offset(offset);
|
||||
BlockState blockState = world.getBlockState(offsetPos);
|
||||
if (isAnchoringBlockAt(offsetPos))
|
||||
continue;
|
||||
if (!movementAllowed(world, offsetPos)) {
|
||||
if (offset == forcedDirection && isStickyBlock)
|
||||
if (offset == forcedDirection)
|
||||
return false;
|
||||
continue;
|
||||
}
|
||||
|
@ -328,8 +328,20 @@ public abstract class Contraption {
|
|||
boolean blockAttachedTowardsFace =
|
||||
BlockMovementTraits.isBlockAttachedTowards(world, offsetPos, blockState, offset.getOpposite());
|
||||
boolean brittle = BlockMovementTraits.isBrittle(blockState);
|
||||
boolean canStick = !brittle && state.canStickTo(blockState) && blockState.canStickTo(state);
|
||||
if (canStick) {
|
||||
if (state.getPushReaction() == PushReaction.PUSH_ONLY || blockState.getPushReaction() == PushReaction.PUSH_ONLY) {
|
||||
canStick = false;
|
||||
}
|
||||
if (BlockMovementTraits.notSupportive(state, offset)) {
|
||||
canStick = false;
|
||||
}
|
||||
if (BlockMovementTraits.notSupportive(blockState, offset.getOpposite())) {
|
||||
canStick = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!wasVisited && ((isStickyBlock && !brittle) || blockAttachedTowardsFace || faceHasGlue))
|
||||
if (!wasVisited && (canStick || blockAttachedTowardsFace || faceHasGlue || (offset == forcedDirection && !BlockMovementTraits.notSupportive(state, forcedDirection))))
|
||||
frontier.add(offsetPos);
|
||||
if (faceHasGlue)
|
||||
addGlue(superglue.get(offset));
|
||||
|
@ -418,7 +430,7 @@ public abstract class Contraption {
|
|||
|
||||
private void moveBearing(BlockPos pos, List<BlockPos> frontier, Set<BlockPos> visited, BlockState state) {
|
||||
Direction facing = state.get(MechanicalBearingBlock.FACING);
|
||||
if (!canAxisBeStabilized(facing.getAxis())) {
|
||||
if (!canBeStabilized(facing, pos.subtract(anchor))) {
|
||||
BlockPos offset = pos.offset(facing);
|
||||
if (!visited.contains(offset))
|
||||
frontier.add(offset);
|
||||
|
|
|
@ -5,7 +5,6 @@ import java.util.HashSet;
|
|||
import java.util.Set;
|
||||
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.template.Template.BlockInfo;
|
||||
|
@ -48,7 +47,7 @@ public abstract class TranslatingContraption extends Contraption {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean canAxisBeStabilized(Axis axis) {
|
||||
public boolean canBeStabilized(Direction facing, BlockPos localPos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Con
|
|||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.template.Template.BlockInfo;
|
||||
|
@ -84,8 +83,10 @@ public class BearingContraption extends Contraption {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean canAxisBeStabilized(Axis axis) {
|
||||
return axis == facing.getAxis();
|
||||
public boolean canBeStabilized(Direction facing, BlockPos localPos) {
|
||||
if (facing.getOpposite() == this.facing && BlockPos.ZERO.equals(localPos))
|
||||
return false;
|
||||
return facing.getAxis() == this.facing.getAxis();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ import com.simibubi.create.foundation.utility.NBTHelper;
|
|||
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
@ -110,15 +109,17 @@ public class ClockworkContraption extends Contraption {
|
|||
|
||||
@Override
|
||||
public void readNBT(World world, CompoundNBT tag, boolean spawnData) {
|
||||
facing = Direction.byIndex(tag.getInt("Facing"));
|
||||
facing = Direction.byIndex(tag.getInt("facing"));
|
||||
handType = NBTHelper.readEnum(tag, "HandType", HandType.class);
|
||||
offset = tag.getInt("offset");
|
||||
super.readNBT(world, tag, spawnData);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canAxisBeStabilized(Axis axis) {
|
||||
return axis == facing.getAxis();
|
||||
public boolean canBeStabilized(Direction facing, BlockPos localPos) {
|
||||
if (BlockPos.ZERO.equals(localPos) || BlockPos.ZERO.equals(localPos.offset(facing)))
|
||||
return false;
|
||||
return facing.getAxis() == this.facing.getAxis();
|
||||
}
|
||||
|
||||
public static enum HandType {
|
||||
|
|
|
@ -45,7 +45,7 @@ public class StabilizedBearingMovementBehaviour extends MovementBehaviour {
|
|||
AbstractContraptionEntity entity = context.contraption.entity;
|
||||
if (entity instanceof ControlledContraptionEntity) {
|
||||
ControlledContraptionEntity controlledCE = (ControlledContraptionEntity) entity;
|
||||
if (controlledCE.getRotationAxis() == axis)
|
||||
if (context.contraption.canBeStabilized(facing, context.localPos))
|
||||
offset = -controlledCE.getAngle(renderPartialTicks);
|
||||
|
||||
} else if (entity instanceof OrientedContraptionEntity) {
|
||||
|
|
|
@ -55,7 +55,7 @@ public class StabilizedContraption extends Contraption {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean canAxisBeStabilized(Axis axis) {
|
||||
public boolean canBeStabilized(Direction facing, BlockPos localPos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -149,7 +149,7 @@ public class MountedContraption extends Contraption {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean canAxisBeStabilized(Axis axis) {
|
||||
public boolean canBeStabilized(Direction facing, BlockPos localPos) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ import com.simibubi.create.foundation.config.AllConfigs;
|
|||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.CarpetBlock;
|
||||
import net.minecraft.block.material.PushReaction;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.state.properties.PistonType;
|
||||
|
@ -164,6 +165,8 @@ public class PistonContraption extends TranslatingContraption {
|
|||
return true;
|
||||
if (!BlockMovementTraits.movementAllowed(world, currentPos))
|
||||
return retracting;
|
||||
if (retracting && state.getPushReaction() == PushReaction.PUSH_ONLY)
|
||||
return true;
|
||||
frontier.add(currentPos);
|
||||
if (BlockMovementTraits.notSupportive(state, orientation))
|
||||
return true;
|
||||
|
|
|
@ -48,6 +48,17 @@ public class PulleyTileEntity extends LinearActuatorTileEntity {
|
|||
return;
|
||||
if (speed == 0)
|
||||
return;
|
||||
int maxLength = AllConfigs.SERVER.kinetics.maxRopeLength.get();
|
||||
int i = 1;
|
||||
while (i <= maxLength) {
|
||||
BlockPos ropePos = pos.down(i);
|
||||
BlockState ropeState = world.getBlockState(ropePos);
|
||||
if (!AllBlocks.ROPE.has(ropeState) && !AllBlocks.PULLEY_MAGNET.has(ropeState)) {
|
||||
break;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
offset = i - 1;
|
||||
if (offset >= getExtensionRange() && getSpeed() > 0)
|
||||
return;
|
||||
if (offset <= 0 && getSpeed() < 0)
|
||||
|
@ -70,7 +81,7 @@ public class PulleyTileEntity extends LinearActuatorTileEntity {
|
|||
if (!canAssembleStructure && getSpeed() > 0)
|
||||
return;
|
||||
|
||||
for (int i = ((int) offset); i > 0; i--) {
|
||||
for (i = ((int) offset); i > 0; i--) {
|
||||
BlockPos offset = pos.down(i);
|
||||
BlockState oldState = world.getBlockState(offset);
|
||||
if (oldState.getBlock() instanceof IWaterLoggable && oldState.has(BlockStateProperties.WATERLOGGED)
|
||||
|
|
|
@ -14,7 +14,6 @@ import com.simibubi.create.foundation.utility.worldWrappers.WrappedWorld;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.material.MaterialColor;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
import net.minecraft.particles.RedstoneParticleData;
|
||||
|
@ -114,6 +113,7 @@ public class GaugeBlock extends DirectionalAxisKineticBlock {
|
|||
return context.getFace();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean getAxisAlignmentForPlacement(BlockItemUseContext context) {
|
||||
return context.getPlacementHorizontalFacing().getAxis() != Axis.X;
|
||||
}
|
||||
|
@ -127,8 +127,7 @@ public class GaugeBlock extends DirectionalAxisKineticBlock {
|
|||
return false;
|
||||
if (getRotationAxis(state) == Axis.Y && face != state.get(FACING))
|
||||
return false;
|
||||
BlockState blockState = world.getBlockState(pos.offset(face));
|
||||
if (Block.hasSolidSide(blockState, world, pos, face.getOpposite()) && blockState.getMaterial() != Material.GLASS
|
||||
if (!Block.shouldSideBeRendered(state, world, pos, face)
|
||||
&& !(world instanceof WrappedWorld))
|
||||
return false;
|
||||
return true;
|
||||
|
|
|
@ -223,6 +223,8 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
|
|||
AxisAlignedBB searchArea =
|
||||
new AxisAlignedBB(center.add(0, -bottomPullDistance - 0.5, 0), center.add(0, -0.5, 0)).grow(.45f);
|
||||
for (ItemEntity itemEntity : world.getEntitiesWithinAABB(ItemEntity.class, searchArea)) {
|
||||
if (!itemEntity.isAlive())
|
||||
continue;
|
||||
ItemStack entityItem = itemEntity.getItem();
|
||||
if (!canAcceptItem(entityItem))
|
||||
continue;
|
||||
|
|
|
@ -48,6 +48,9 @@ public class ArmInteractionPointHandler {
|
|||
World world = event.getWorld();
|
||||
if (!world.isRemote)
|
||||
return;
|
||||
PlayerEntity player = event.getPlayer();
|
||||
if (player != null && player.isSpectator())
|
||||
return;
|
||||
|
||||
ArmInteractionPoint selected = getSelected(pos);
|
||||
|
||||
|
@ -60,7 +63,6 @@ public class ArmInteractionPointHandler {
|
|||
}
|
||||
|
||||
selected.cycleMode();
|
||||
PlayerEntity player = event.getPlayer();
|
||||
if (player != null) {
|
||||
String key = selected.mode == Mode.DEPOSIT ? "mechanical_arm.deposit_to" : "mechanical_arm.extract_from";
|
||||
TextFormatting colour = selected.mode == Mode.DEPOSIT ? TextFormatting.GOLD : TextFormatting.AQUA;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.simibubi.create.events;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.AllFluids;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.CreateClient;
|
||||
|
@ -124,6 +125,7 @@ public class ClientEvents {
|
|||
CreateClient.outliner.renderOutlines(ms, buffer);
|
||||
// CollisionDebugger.render(ms, buffer);
|
||||
buffer.draw();
|
||||
RenderSystem.enableCull();
|
||||
|
||||
ms.pop();
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public class EdgeInteractionHandler {
|
|||
Hand hand = event.getHand();
|
||||
ItemStack heldItem = player.getHeldItem(hand);
|
||||
|
||||
if (player.isSneaking())
|
||||
if (player.isSneaking() || player.isSpectator())
|
||||
return;
|
||||
EdgeInteractionBehaviour behaviour = TileEntityBehaviour.get(world, pos, EdgeInteractionBehaviour.TYPE);
|
||||
if (behaviour == null)
|
||||
|
|
|
@ -43,7 +43,7 @@ public class FilteringHandler {
|
|||
PlayerEntity player = event.getPlayer();
|
||||
Hand hand = event.getHand();
|
||||
|
||||
if (player.isSneaking())
|
||||
if (player.isSneaking() || player.isSpectator())
|
||||
return;
|
||||
|
||||
FilteringBehaviour behaviour = TileEntityBehaviour.get(world, pos, FilteringBehaviour.TYPE);
|
||||
|
@ -75,12 +75,12 @@ public class FilteringHandler {
|
|||
|
||||
if (event.getSide() != LogicalSide.CLIENT) {
|
||||
if (!player.isCreative()) {
|
||||
if (behaviour.getFilter()
|
||||
.getItem() instanceof FilterItem)
|
||||
player.inventory.placeItemBackInInventory(world, behaviour.getFilter());
|
||||
if (toApply.getItem() instanceof FilterItem)
|
||||
player.getHeldItem(hand)
|
||||
.shrink(1);
|
||||
if (behaviour.getFilter()
|
||||
.getItem() instanceof FilterItem)
|
||||
player.inventory.placeItemBackInInventory(world, behaviour.getFilter());
|
||||
}
|
||||
if (toApply.getItem() instanceof FilterItem)
|
||||
toApply.setCount(1);
|
||||
|
|
|
@ -28,7 +28,7 @@ public class LinkHandler {
|
|||
PlayerEntity player = event.getPlayer();
|
||||
Hand hand = event.getHand();
|
||||
|
||||
if (player.isSneaking())
|
||||
if (player.isSneaking() || player.isSpectator())
|
||||
return;
|
||||
|
||||
LinkBehaviour behaviour = TileEntityBehaviour.get(world, pos, LinkBehaviour.TYPE);
|
||||
|
|
Loading…
Reference in a new issue