diff --git a/src/main/java/com/simibubi/create/foundation/utility/AllShapes.java b/src/main/java/com/simibubi/create/foundation/utility/AllShapes.java index b9f1cfa32..1227fbbd3 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/AllShapes.java +++ b/src/main/java/com/simibubi/create/foundation/utility/AllShapes.java @@ -12,7 +12,9 @@ import static net.minecraft.block.Block.makeCuboidShape; public class AllShapes { public static final VoxelShaper - SHORT_CASING = VoxelShaper.forDirectional(makeCuboidShape(0, 0, 0, 16, 12, 16), Direction.UP), + SHORT_CASING_14_VOXEL = VoxelShaper.forDirectional(makeCuboidShape(0, 0, 0, 16, 14, 16), Direction.UP), + SHORT_CASING_12_VOXEL = VoxelShaper.forDirectional(makeCuboidShape(0, 0, 0, 16, 12, 16), Direction.UP), + SHORT_CASING_11_VOXEL = VoxelShaper.forDirectional(makeCuboidShape(0, 0, 0, 16, 11, 16), Direction.UP), HARVESTER_BASE = VoxelShaper.forHorizontal(makeCuboidShape(0, 2, 0, 16, 14, 3), Direction.SOUTH), MOTOR_BLOCK = VoxelShaper.forHorizontal(makeCuboidShape(0, 3, 3, 16, 13, 13), Direction.EAST), FOUR_VOXEL_POLE = VoxelShaper.forDirectionalAxis(makeCuboidShape(6, 0, 6, 10, 16, 10), Direction.Axis.Y), @@ -37,7 +39,7 @@ public class AllShapes { makeCuboidShape(-2, 0, 1, 18, 13, 15)), MECHANICAL_PISTON_HEAD_SHAPE_UP = Blocks.PISTON_HEAD.getShape(Blocks.PISTON_HEAD.getStateContainer().getBaseState().with(DirectionalBlock.FACING, Direction.UP).with(PistonHeadBlock.SHORT, true), null, null, null), MECHANICAL_PISTON_EXTENDED_SHAPE_UP = VoxelShapes.or( - SHORT_CASING.get(Direction.UP), + SHORT_CASING_12_VOXEL.get(Direction.UP), FOUR_VOXEL_POLE.get(Direction.Axis.Y)), SMALL_GEAR_SHAPE = makeCuboidShape(2, 6, 2, 14, 10, 14), LARGE_GEAR_SHAPE = makeCuboidShape(0, 6, 0, 16, 10, 16), @@ -50,7 +52,11 @@ public class AllShapes { LOGISTICS_TABLE_SLOPE_SOUTH = VoxelShapes.or( makeCuboidShape(0, 10D, 15, 16, 14, 10.667), makeCuboidShape(0, 12, 10.667, 16, 16, 6.333), - makeCuboidShape(0, 14, 6.333, 16, 18, 2)) + makeCuboidShape(0, 14, 6.333, 16, 18, 2)), + SCHEMATICS_TABLE_SLOPE_SOUTH = VoxelShapes.or( + makeCuboidShape(0, 10, 16, 16, 14, 11), + makeCuboidShape(0, 12, 11, 16, 16, 6), + makeCuboidShape(0, 14, 6, 16, 18, 1)) ; @@ -59,14 +65,18 @@ public class AllShapes { makeCuboidShape(0, 0, 0, 16, 2, 16), makeCuboidShape(1, 1, 1, 15, 15, 15), makeCuboidShape(0, 14, 0, 16, 16, 16)), - BASIN_BLOCK_SHAPE = makeCuboidShape(0, 0, 0, 16, 13, 16),//todo maybe + BASIN_BLOCK_SHAPE = makeCuboidShape(0, 0, 0, 16, 13, 16),//todo can be improved when someone finds the time :D CRUSHING_WHEEL_COLLISION_SHAPE = makeCuboidShape(0, 0, 0, 16, 22, 16), - MECHANICAL_PRESS_SHAPE = VoxelShapes.fullCube(),//todo maybe + MECHANICAL_PROCESSOR_SHAPE = VoxelShapes.fullCube(),//is full block so levers can be placed on the sides TURNTABLE_SHAPE = VoxelShapes.or( makeCuboidShape(1, 6, 1, 15, 8, 15), makeCuboidShape(5, 0, 5, 11, 6, 11)), CRATE_BLOCK_SHAPE = makeCuboidShape(1, 0, 1, 15, 14, 15), - LOGISTICS_TABLE_BASE = TABLE_POLE_SHAPE + LOGISTICS_TABLE_BASE = TABLE_POLE_SHAPE, + BELT_COLLISION_MASK = makeCuboidShape(0, 0, 0, 16, 19, 16), + SCHEMATICANNON_SHAPE = VoxelShapes.or( + makeCuboidShape(1, 0, 1, 15, 8, 15), + makeCuboidShape(0.5, 8, 0.5, 15.5, 11, 15.5)) ; @@ -78,7 +88,7 @@ public class AllShapes { LOGISTICAL_CASING_CAP = VoxelShaper.forDirectional(LOGISTICAL_CASING_CAP_SHAPE, Direction.UP), CART_ASSEMBLER = VoxelShaper.forHorizontalAxis(CART_ASSEMBLER_SHAPE, Direction.SOUTH), MECHANICAL_PISTON_HEAD = VoxelShaper.forDirectional(MECHANICAL_PISTON_HEAD_SHAPE_UP, Direction.UP), - MECHANICAL_PISTON = SHORT_CASING, + MECHANICAL_PISTON = SHORT_CASING_12_VOXEL, MECHANICAL_PISTON_EXTENDED = VoxelShaper.forDirectional(MECHANICAL_PISTON_EXTENDED_SHAPE_UP, Direction.UP), SMALL_GEAR = VoxelShaper.forDirectionalAxis(VoxelShapes.or(SMALL_GEAR_SHAPE, SIX_VOXEL_POLE.get(Direction.Axis.Y)), Direction.Axis.Y), LARGE_GEAR = VoxelShaper.forDirectionalAxis(VoxelShapes.or(LARGE_GEAR_SHAPE, SIX_VOXEL_POLE.get(Direction.Axis.Y)), Direction.Axis.Y), @@ -86,7 +96,8 @@ public class AllShapes { REDSTONE_BRIDGE = VoxelShaper.forHorizontal(VERTICAL_TABLET_SHAPE_SOUTH, Direction.SOUTH).withVerticalShapes(LOGISTICAL_CONTROLLER.get(Direction.UP)), LOGISTICAL_INDEX = REDSTONE_BRIDGE, PACKAGE_FUNNEL = VoxelShaper.forDirectional(PACKAGE_FUNNEL_SHAPE_UP, Direction.UP), - LOGISTICS_TABLE = VoxelShaper.forHorizontal(VoxelShapes.or(TABLE_POLE_SHAPE, LOGISTICS_TABLE_SLOPE_SOUTH), Direction.SOUTH) + LOGISTICS_TABLE = VoxelShaper.forHorizontal(VoxelShapes.or(TABLE_POLE_SHAPE, LOGISTICS_TABLE_SLOPE_SOUTH), Direction.SOUTH), + SCHEMATICS_TABLE = VoxelShaper.forDirectional(VoxelShapes.or(TABLE_POLE_SHAPE, SCHEMATICS_TABLE_SLOPE_SOUTH), Direction.SOUTH) ; diff --git a/src/main/java/com/simibubi/create/foundation/utility/VoxelShaper.java b/src/main/java/com/simibubi/create/foundation/utility/VoxelShaper.java index 73ad591af..b043a6059 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/VoxelShaper.java +++ b/src/main/java/com/simibubi/create/foundation/utility/VoxelShaper.java @@ -35,7 +35,7 @@ public class VoxelShaper { return forDirectionsWithRotation(shape, facing, Arrays.asList(Direction.SOUTH, Direction.EAST), new HorizontalRotationValues()); } - public static VoxelShaper forRotatedPillar(VoxelShape zShape) {//dunno what this was intended for + public static VoxelShaper forRotatedPillar(VoxelShape zShape) {//todo dunno what this was intended for VoxelShaper voxelShaper = new VoxelShaper(); for (Axis axis : Axis.values()) { Direction facing = axisAsFace(axis); @@ -71,7 +71,6 @@ public class VoxelShaper { VoxelShaper voxelShaper = new VoxelShaper(); for (Direction dir : directions) { voxelShaper.shapes.put(dir, rotate(shape, facing, dir, rotationValues)); - //voxelShaper.shapes.put(dir, rotatedCopy(shape, rotationValues.apply(dir))); } return voxelShaper; } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/receivers/DrillBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/receivers/DrillBlock.java index d446f0d73..ac837c481 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/receivers/DrillBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/receivers/DrillBlock.java @@ -49,7 +49,7 @@ public class DrillBlock extends DirectionalKineticBlock @Override public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - return AllShapes.SHORT_CASING.get(state.get(FACING)); + return AllShapes.SHORT_CASING_12_VOXEL.get(state.get(FACING)); } @Override diff --git a/src/main/java/com/simibubi/create/modules/contraptions/receivers/MechanicalMixerBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/receivers/MechanicalMixerBlock.java index 89c729d0c..e8ccfde1a 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/receivers/MechanicalMixerBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/receivers/MechanicalMixerBlock.java @@ -9,6 +9,7 @@ import com.simibubi.create.modules.contraptions.base.KineticBlock; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.BlockItem; import net.minecraft.item.BlockItemUseContext; import net.minecraft.tileentity.TileEntity; @@ -45,7 +46,10 @@ public class MechanicalMixerBlock extends KineticBlock @Override public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - return AllShapes.MECHANICAL_PRESS_SHAPE; + if (context.getEntity() instanceof PlayerEntity) + return AllShapes.SHORT_CASING_14_VOXEL.get(Direction.DOWN); + + return AllShapes.MECHANICAL_PROCESSOR_SHAPE; } @Override diff --git a/src/main/java/com/simibubi/create/modules/contraptions/receivers/MechanicalPressBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/receivers/MechanicalPressBlock.java index b165983cd..59a100cd2 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/receivers/MechanicalPressBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/receivers/MechanicalPressBlock.java @@ -22,6 +22,7 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.HorizontalBlock; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.ItemStack; import net.minecraft.state.StateContainer.Builder; @@ -44,7 +45,10 @@ public class MechanicalPressBlock extends HorizontalKineticBlock @Override public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - return AllShapes.MECHANICAL_PRESS_SHAPE; + if (context.getEntity() instanceof PlayerEntity) + return AllShapes.SHORT_CASING_14_VOXEL.get(Direction.DOWN); + + return AllShapes.MECHANICAL_PROCESSOR_SHAPE; } @Override diff --git a/src/main/java/com/simibubi/create/modules/contraptions/receivers/SawBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/receivers/SawBlock.java index 623f9a614..a7534c611 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/receivers/SawBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/receivers/SawBlock.java @@ -82,7 +82,7 @@ public class SawBlock extends DirectionalAxisKineticBlock @Override public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - return AllShapes.SHORT_CASING.get(state.get(FACING)); + return AllShapes.SHORT_CASING_12_VOXEL.get(state.get(FACING)); } @Override diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltBlock.java index 330d3e976..50af383cf 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltBlock.java @@ -8,6 +8,7 @@ import com.simibubi.create.AllBlocks; import com.simibubi.create.AllItems; import com.simibubi.create.foundation.block.IWithTileEntity; import com.simibubi.create.foundation.block.IWithoutBlockItem; +import com.simibubi.create.foundation.utility.AllShapes; import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.modules.contraptions.base.HorizontalKineticBlock; import com.simibubi.create.modules.contraptions.relays.belt.BeltMovementHandler.TransportedEntityInfo; @@ -55,7 +56,6 @@ public class BeltBlock extends HorizontalKineticBlock implements IWithoutBlockIt public static final IProperty SLOPE = EnumProperty.create("slope", Slope.class); public static final IProperty PART = EnumProperty.create("part", Part.class); public static final BooleanProperty CASING = BooleanProperty.create("casing"); - private final VoxelShape collisionMask = makeCuboidShape(0, 0, 0, 16, 19, 16);//todo review public BeltBlock() { super(Properties.from(Blocks.BROWN_WOOL)); @@ -288,7 +288,7 @@ public class BeltBlock extends HorizontalKineticBlock implements IWithoutBlockIt if (controller == null) return shape; if (controller.passengers == null || !controller.passengers.containsKey(context.getEntity())) { - return VoxelShapes.combine(collisionMask, shape, IBooleanFunction.AND); + return VoxelShapes.combine(AllShapes.BELT_COLLISION_MASK, shape, IBooleanFunction.AND); } return shape; diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltShapes.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltShapes.java index 8949f892d..86236a09d 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltShapes.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/BeltShapes.java @@ -2,6 +2,7 @@ package com.simibubi.create.modules.contraptions.relays.belt; import static net.minecraft.block.Block.makeCuboidShape; +import com.simibubi.create.foundation.utility.AllShapes; import com.simibubi.create.foundation.utility.VoxelShaper; import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock.Part; import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock.Slope; @@ -94,6 +95,8 @@ public class BeltShapes { SLOPE_ASC_END = VoxelShaper.forHorizontal(compose(FLAT_END_PART, SLOPE_ASC_PART), Direction.SOUTH), SLOPE_ASC_START = VoxelShaper.forHorizontal(compose(SLOPE_ASC_PART, FLAT_END_PART), Direction.SOUTH); + private static final VoxelShaper + PARTIAL_CASING = VoxelShaper.forHorizontal(makeCuboidShape(0, 0, 5, 16, 11, 16), Direction.SOUTH); private static VoxelShape compose(VoxelShape southPart, VoxelShape northPart){ @@ -130,10 +133,6 @@ public class BeltShapes { return makeCuboidShape(1,3,0,15,13,16); } - private static final VoxelShape CASING_HORIZONTAL = makeCuboidShape(0, 0, 0, 16, 11, 16); - //todo still need to remove these two - private static final VoxelShaper CASING_TOP_END = VoxelShaper.forHorizontal(makeCuboidShape(0, 0, 0, 16, 11, 11), Direction.SOUTH); - public static VoxelShape getShape(BlockState state) { Direction facing = state.get(BeltBlock.HORIZONTAL_FACING); Axis axis = facing.getAxis(); @@ -170,7 +169,7 @@ public class BeltShapes { } - public static VoxelShape getCasingShape(BlockState state) {//todo + public static VoxelShape getCasingShape(BlockState state) { if (!state.get(BeltBlock.CASING)) return VoxelShapes.empty(); @@ -178,25 +177,23 @@ public class BeltShapes { Part part = state.get(BeltBlock.PART); Slope slope = state.get(BeltBlock.SLOPE); - if (slope == Slope.HORIZONTAL) - return CASING_HORIZONTAL; if (slope == Slope.VERTICAL) return VoxelShapes.empty(); - if (part != Part.MIDDLE) { - boolean upward = slope == Slope.UPWARD; - if (part == Part.START) - upward = !upward; - else - facing = facing.getOpposite(); - - return upward ? CASING_TOP_END.get(facing) : CASING_HORIZONTAL; + if (slope == Slope.HORIZONTAL) { + return AllShapes.SHORT_CASING_11_VOXEL.get(Direction.UP); } - if (slope == Slope.DOWNWARD) - facing = facing.getOpposite(); + if (part == Part.MIDDLE || part == Part.PULLEY) + return PARTIAL_CASING.get(slope == Slope.UPWARD ? facing : facing.getOpposite()); - return CASING_TOP_END.get(facing.getOpposite()); + if (part == Part.START) + return slope == Slope.UPWARD ? AllShapes.SHORT_CASING_11_VOXEL.get(Direction.UP) : PARTIAL_CASING.get(facing.getOpposite()); + if (part == Part.END) + return slope == Slope.DOWNWARD ? AllShapes.SHORT_CASING_11_VOXEL.get(Direction.UP) : PARTIAL_CASING.get(facing); + + //something went wrong + return VoxelShapes.fullCube(); } private static class VerticalBeltShaper extends VoxelShaper { diff --git a/src/main/java/com/simibubi/create/modules/economy/ShopShelfBlock.java b/src/main/java/com/simibubi/create/modules/economy/ShopShelfBlock.java deleted file mode 100644 index 14bc2c021..000000000 --- a/src/main/java/com/simibubi/create/modules/economy/ShopShelfBlock.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.simibubi.create.modules.economy; - -import com.simibubi.create.foundation.block.IWithoutBlockItem; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.HorizontalBlock; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.item.BlockItemUseContext; -import net.minecraft.item.ItemStack; -import net.minecraft.state.StateContainer.Builder; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.shapes.ISelectionContext; -import net.minecraft.util.math.shapes.VoxelShape; -import net.minecraft.util.math.shapes.VoxelShapes; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.World; -import net.minecraftforge.fml.network.NetworkHooks; - -public class ShopShelfBlock extends HorizontalBlock implements IWithoutBlockItem { - - public static final VoxelShape TOP_SHAPE = makeCuboidShape(0, 14, 0, 16, 16, 16);//todo review - - public static final VoxelShape BODY_SOUTH_SHAPE = makeCuboidShape(0, 0, 0, 16, 14, 14); - public static final VoxelShape BODY_NORTH_SHAPE = makeCuboidShape(0, 0, 2, 16, 14, 16); - public static final VoxelShape BODY_EAST_SHAPE = makeCuboidShape(0, 0, 0, 14, 14, 16); - public static final VoxelShape BODY_WEST_SHAPE = makeCuboidShape(2, 0, 0, 16, 14, 16); - - public ShopShelfBlock() { - super(Properties.from(Blocks.SPRUCE_PLANKS)); - } - - @Override - public boolean hasTileEntity(BlockState state) { - return true; - } - - @Override - public TileEntity createTileEntity(BlockState state, IBlockReader world) { - return new ShopShelfTileEntity(); - } - - @Override - public void onBlockPlacedBy(World worldIn, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) { - ShopShelfTileEntity te = (ShopShelfTileEntity) worldIn.getTileEntity(pos); - te.setOwner(placer.getUniqueID()); - worldIn.notifyBlockUpdate(pos, state, state, 2); - } - - @Override - public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, - BlockRayTraceResult hit) { - ShopShelfTileEntity te = (ShopShelfTileEntity) worldIn.getTileEntity(pos); - if (te == null) - return false; - if (!worldIn.isRemote) - NetworkHooks.openGui((ServerPlayerEntity) player, te, te::sendToContainer); - return true; - } - - @Override - protected void fillStateContainer(Builder builder) { - builder.add(HORIZONTAL_FACING); - super.fillStateContainer(builder); - } - - @Override - public BlockState getStateForPlacement(BlockItemUseContext context) { - return getDefaultState().with(HORIZONTAL_FACING, context.getPlacementHorizontalFacing().getOpposite()); - } - - @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - VoxelShape body = VoxelShapes.empty(); - switch (state.get(HORIZONTAL_FACING)) { - case EAST: - body = BODY_EAST_SHAPE; - break; - case NORTH: - body = BODY_NORTH_SHAPE; - break; - case SOUTH: - body = BODY_SOUTH_SHAPE; - break; - case WEST: - body = BODY_WEST_SHAPE; - break; - default: - break; - } - - return VoxelShapes.or(TOP_SHAPE, body); - } - -} diff --git a/src/main/java/com/simibubi/create/modules/economy/ShopShelfContainer.java b/src/main/java/com/simibubi/create/modules/economy/ShopShelfContainer.java deleted file mode 100644 index e85d49bf6..000000000 --- a/src/main/java/com/simibubi/create/modules/economy/ShopShelfContainer.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.simibubi.create.modules.economy; - -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.network.PacketBuffer; - -public class ShopShelfContainer extends Container { - - public ShopShelfContainer(int id, PlayerInventory inv, ShopShelfTileEntity te) { -// super(AllContainers.SHOP_SHELF.type, id); - super(null, id); - } - - public ShopShelfContainer(int id, PlayerInventory inv, PacketBuffer extraData) { -// super(AllContainers.SHOP_SHELF.type, id); - super(null, id); - } - - @Override - public boolean canInteractWith(PlayerEntity playerIn) { - return true; - } - -} diff --git a/src/main/java/com/simibubi/create/modules/economy/ShopShelfScreen.java b/src/main/java/com/simibubi/create/modules/economy/ShopShelfScreen.java deleted file mode 100644 index 93bbe3188..000000000 --- a/src/main/java/com/simibubi/create/modules/economy/ShopShelfScreen.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.simibubi.create.modules.economy; - -import com.simibubi.create.foundation.gui.AbstractSimiContainerScreen; - -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.util.text.ITextComponent; - -public class ShopShelfScreen extends AbstractSimiContainerScreen { - - public ShopShelfScreen(ShopShelfContainer container, PlayerInventory inv, ITextComponent title) { - super(container, inv, title); - } - - @Override - protected void renderWindow(int mouseX, int mouseY, float partialTicks) { - renderTooltip("Hi", mouseX, mouseY); - } - -} diff --git a/src/main/java/com/simibubi/create/modules/economy/ShopShelfTileEntity.java b/src/main/java/com/simibubi/create/modules/economy/ShopShelfTileEntity.java deleted file mode 100644 index e93e94a33..000000000 --- a/src/main/java/com/simibubi/create/modules/economy/ShopShelfTileEntity.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.simibubi.create.modules.economy; - -import java.util.UUID; - -import com.simibubi.create.foundation.block.SyncedTileEntity; - -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.container.Container; -import net.minecraft.inventory.container.INamedContainerProvider; -import net.minecraft.nbt.CompoundNBT; -import net.minecraft.nbt.NBTUtil; -import net.minecraft.network.PacketBuffer; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; - -public class ShopShelfTileEntity extends SyncedTileEntity implements INamedContainerProvider { - - private UUID owner; - - public ShopShelfTileEntity() { - super(null); -// super(AllTileEntities.SHOP_SHELF.type); - } - - @Override - public void read(CompoundNBT compound) { - if (compound.contains("Owner")) - setOwner(NBTUtil.readUniqueId(compound.getCompound("Owner"))); - super.read(compound); - } - - @Override - public CompoundNBT write(CompoundNBT compound) { - if (getOwner() != null) - compound.put("Owner", NBTUtil.writeUniqueId(getOwner())); - return super.write(compound); - } - - public UUID getOwner() { - return owner; - } - - public void setOwner(UUID owner) { - this.owner = owner; - } - - public void sendToContainer(PacketBuffer buffer) { - buffer.writeUniqueId(getOwner()); - } - - @Override - public Container createMenu(int id, PlayerInventory inventory, PlayerEntity player) { - return new ShopShelfContainer(id, inventory, this); - } - - @Override - public ITextComponent getDisplayName() { - return new StringTextComponent(getType().getRegistryName().toString()); - } - -} diff --git a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableBlock.java b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableBlock.java index 777676558..cf00f3da4 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableBlock.java +++ b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicTableBlock.java @@ -1,5 +1,6 @@ package com.simibubi.create.modules.schematics.block; +import com.simibubi.create.foundation.utility.AllShapes; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; @@ -13,6 +14,8 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; +import net.minecraft.util.math.shapes.ISelectionContext; +import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.world.IBlockReader; import net.minecraft.world.World; import net.minecraftforge.fml.network.NetworkHooks; @@ -39,6 +42,16 @@ public class SchematicTableBlock extends HorizontalBlock { return this.getDefaultState().with(HORIZONTAL_FACING, context.getPlacementHorizontalFacing().getOpposite()); } + @Override + public VoxelShape getCollisionShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { + return AllShapes.LOGISTICS_TABLE_BASE; + } + + @Override + public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { + return AllShapes.SCHEMATICS_TABLE.get(state.get(HORIZONTAL_FACING)); + } + @Override public boolean hasTileEntity(BlockState state) { return true; diff --git a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonBlock.java b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonBlock.java index 7ad4639e0..4eda575f7 100644 --- a/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonBlock.java +++ b/src/main/java/com/simibubi/create/modules/schematics/block/SchematicannonBlock.java @@ -2,6 +2,7 @@ package com.simibubi.create.modules.schematics.block; import com.simibubi.create.AllItems; +import com.simibubi.create.foundation.utility.AllShapes; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; @@ -14,6 +15,8 @@ import net.minecraft.util.Direction; import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; +import net.minecraft.util.math.shapes.ISelectionContext; +import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorld; import net.minecraft.world.IWorldReader; @@ -48,6 +51,11 @@ public class SchematicannonBlock extends Block { return false; } + @Override + public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { + return AllShapes.SCHEMATICANNON_SHAPE; + } + @Override public void onNeighborChange(BlockState state, IWorldReader world, BlockPos pos, BlockPos neighbor) { ((SchematicannonTileEntity) world.getTileEntity(pos)).findInventories();