From d7a41b781028249ee58db303c6e3263cbb229f7c Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Sat, 6 Feb 2021 22:03:48 +0100 Subject: [PATCH] Port new changes - Fix incompatible resource pack version --- .../create/blockstates/radial_chassis.json | 24 ++-- .../assets/create/lang/unfinished/es_mx.json | 4 + .../assets/create/lang/unfinished/zh_tw.json | 4 + .../java/com/simibubi/create/AllBlocks.java | 2 +- .../com/simibubi/create/AllSpriteShifts.java | 2 +- src/main/java/com/simibubi/create/Create.java | 5 + .../contraptions/base/KineticBlock.java | 3 - .../components/fan/EncasedFanBlock.java | 4 +- .../press/MechanicalPressTileEntity.java | 4 +- .../gantry/GantryContraptionEntity.java | 26 ++-- .../gantry/GantryPinionBlock.java | 4 +- .../gantry/GantryPinionRenderer.java | 2 +- .../sync/ContraptionInteractionPacket.java | 3 +- .../relays/advanced/GantryShaftBlock.java | 6 +- .../relays/belt/BeltTileEntity.java | 2 +- .../relays/encased/EncasedBeltBlock.java | 2 +- .../tools/ExtendoGripInteractionPacket.java | 3 +- .../SmartChuteFilterSlotPositioning.java | 10 +- .../block/chute/SmartChuteTileEntity.java | 2 +- .../HorizontalInteractionFunnelBlock.java | 128 ------------------ .../schematics/SchematicProcessor.java | 32 +++-- .../filtering/SchematicInstances.java | 6 +- src/main/resources/pack.mcmeta | 2 +- 23 files changed, 83 insertions(+), 197 deletions(-) delete mode 100644 src/main/java/com/simibubi/create/content/logistics/block/funnel/HorizontalInteractionFunnelBlock.java diff --git a/src/generated/resources/assets/create/blockstates/radial_chassis.json b/src/generated/resources/assets/create/blockstates/radial_chassis.json index 8bd829ffc..04e5c08ae 100644 --- a/src/generated/resources/assets/create/blockstates/radial_chassis.json +++ b/src/generated/resources/assets/create/blockstates/radial_chassis.json @@ -207,8 +207,8 @@ }, { "when": { - "axis": "x", - "sticky_east": "true" + "sticky_east": "true", + "axis": "x" }, "apply": { "model": "create:block/radial_chassis_side_x_sticky", @@ -217,8 +217,8 @@ }, { "when": { - "axis": "y", - "sticky_east": "true" + "sticky_east": "true", + "axis": "y" }, "apply": { "model": "create:block/radial_chassis_side_y_sticky", @@ -227,8 +227,8 @@ }, { "when": { - "axis": "z", - "sticky_east": "true" + "sticky_east": "true", + "axis": "z" }, "apply": { "model": "create:block/radial_chassis_side_z_sticky" @@ -236,8 +236,8 @@ }, { "when": { - "axis": "x", - "sticky_east": "false" + "sticky_east": "false", + "axis": "x" }, "apply": { "model": "create:block/radial_chassis_side_x", @@ -246,8 +246,8 @@ }, { "when": { - "axis": "y", - "sticky_east": "false" + "sticky_east": "false", + "axis": "y" }, "apply": { "model": "create:block/radial_chassis_side_y", @@ -256,8 +256,8 @@ }, { "when": { - "axis": "z", - "sticky_east": "false" + "sticky_east": "false", + "axis": "z" }, "apply": { "model": "create:block/radial_chassis_side_z" diff --git a/src/generated/resources/assets/create/lang/unfinished/es_mx.json b/src/generated/resources/assets/create/lang/unfinished/es_mx.json index 5982b8d60..afb1c29fc 100644 --- a/src/generated/resources/assets/create/lang/unfinished/es_mx.json +++ b/src/generated/resources/assets/create/lang/unfinished/es_mx.json @@ -67,6 +67,8 @@ "block.create.creative_crate": "Caja del Creativo", "block.create.creative_fluid_tank": "Tanque de Fluido del Creativo", "block.create.creative_motor": "Motor del Creativo", + "block.create.crimson_window": "Ventana Carmesí", + "block.create.crimson_window_pane": "Panel de Ventana Carmesí", "block.create.crushing_wheel": "Rueda Trituradora", "block.create.crushing_wheel_controller": "UNLOCALIZED:Crushing Wheel Controller", "block.create.cuckoo_clock": "Reloj Cuco", @@ -384,6 +386,8 @@ "block.create.turntable": "Mesa Giratoria", "block.create.vertical_framed_glass": "Vidrio Enmarcado Vertical", "block.create.vertical_framed_glass_pane": "Panel de Vidrio Enmarcado Vertical", + "block.create.warped_window": "Ventana Distorsionada", + "block.create.warped_window_pane": "Panel de ventana Distorsionada", "block.create.water_wheel": "Rueda Hidráulica", "block.create.weathered_limestone": "Caliza Meteorizada", "block.create.weathered_limestone_bricks": "Ladrillos de Caliza Meteorizada", diff --git a/src/generated/resources/assets/create/lang/unfinished/zh_tw.json b/src/generated/resources/assets/create/lang/unfinished/zh_tw.json index 8fa416308..cb5eaef8e 100644 --- a/src/generated/resources/assets/create/lang/unfinished/zh_tw.json +++ b/src/generated/resources/assets/create/lang/unfinished/zh_tw.json @@ -67,6 +67,8 @@ "block.create.creative_crate": "創造板條箱", "block.create.creative_fluid_tank": "創造液體儲存罐", "block.create.creative_motor": "創造馬達", + "block.create.crimson_window": "赤紅窗戶", + "block.create.crimson_window_pane": "赤紅窗戶片", "block.create.crushing_wheel": "粉碎輪", "block.create.crushing_wheel_controller": "粉碎輪控制器", "block.create.cuckoo_clock": "布穀鳥鐘", @@ -384,6 +386,8 @@ "block.create.turntable": "轉盤", "block.create.vertical_framed_glass": "豎直邊框玻璃", "block.create.vertical_framed_glass_pane": "豎直邊框玻璃片", + "block.create.warped_window": "扭曲蕈木窗戶", + "block.create.warped_window_pane": "扭曲蕈木窗戶片", "block.create.water_wheel": "水車", "block.create.weathered_limestone": "風化石灰岩", "block.create.weathered_limestone_bricks": "風化石灰岩磚", diff --git a/src/main/java/com/simibubi/create/AllBlocks.java b/src/main/java/com/simibubi/create/AllBlocks.java index 30890e757..ee1b0140c 100644 --- a/src/main/java/com/simibubi/create/AllBlocks.java +++ b/src/main/java/com/simibubi/create/AllBlocks.java @@ -708,7 +708,7 @@ public class AllBlocks { boolean isFlipped = s.get(GantryShaftBlock.FACING) .getAxisDirection() == AxisDirection.NEGATIVE; String partName = s.get(GantryShaftBlock.PART) - .getName(); + .getString(); String flipped = isFlipped ? "_flipped" : ""; String powered = isPowered ? "_powered" : ""; ModelFile existing = AssetLookup.partialBaseModel(c, p, partName); diff --git a/src/main/java/com/simibubi/create/AllSpriteShifts.java b/src/main/java/com/simibubi/create/AllSpriteShifts.java index e358b069c..904f025fd 100644 --- a/src/main/java/com/simibubi/create/AllSpriteShifts.java +++ b/src/main/java/com/simibubi/create/AllSpriteShifts.java @@ -91,7 +91,7 @@ public class AllSpriteShifts { } for (DyeColor color : DyeColor.values()) { - String id = color.getName(); + String id = color.getString(); DYED_BELTS.put(color, SpriteShifter.get("block/belt", "block/belt/" + id)); DYED_OFFSET_BELTS.put(color, SpriteShifter.get("block/belt_offset", "block/belt/" + id)); DYED_DIAGONAL_BELTS.put(color, SpriteShifter.get("block/belt_diagonal", "block/belt/" + id + "_diagonal")); diff --git a/src/main/java/com/simibubi/create/Create.java b/src/main/java/com/simibubi/create/Create.java index 6bffa3890..fdb4b9628 100644 --- a/src/main/java/com/simibubi/create/Create.java +++ b/src/main/java/com/simibubi/create/Create.java @@ -13,6 +13,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.tra import com.simibubi.create.content.logistics.RedstoneLinkNetworkHandler; import com.simibubi.create.content.palettes.AllPaletteBlocks; import com.simibubi.create.content.palettes.PalettesItemGroup; +import com.simibubi.create.content.schematics.SchematicProcessor; import com.simibubi.create.content.schematics.ServerSchematicLoader; import com.simibubi.create.content.schematics.filtering.SchematicInstances; import com.simibubi.create.foundation.advancement.AllAdvancements; @@ -114,6 +115,10 @@ public class Create { AllPackets.registerPackets(); AllTriggers.register(); + + event.enqueueWork(() -> { + SchematicProcessor.register(); + }); } public static void onBiomeLoad(BiomeLoadingEvent event) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/KineticBlock.java b/src/main/java/com/simibubi/create/content/contraptions/base/KineticBlock.java index 5db703f7a..f073783c9 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/KineticBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/KineticBlock.java @@ -89,11 +89,8 @@ public abstract class KineticBlock extends Block implements IRotate { @Override public abstract TileEntity createTileEntity(BlockState state, IBlockReader world); - // TODO 1.16 is this the right replacement for updateNeighbors? @Override - @Deprecated public void updateDiagonalNeighbors(BlockState stateIn, IWorld worldIn, BlockPos pos, int flags, int count) { - super.updateDiagonalNeighbors(stateIn, worldIn, pos, flags, count); if (worldIn.isRemote()) return; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/fan/EncasedFanBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/fan/EncasedFanBlock.java index b70de3e10..8cb03c361 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/fan/EncasedFanBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/fan/EncasedFanBlock.java @@ -37,8 +37,8 @@ public class EncasedFanBlock extends DirectionalKineticBlock implements ITE recipe = getRecipe(stack); @@ -236,7 +236,7 @@ public class MechanicalPressTileEntity extends BasinOperatingTileEntity { for (Entity entity : world.getEntitiesWithinAABBExcludingEntity(null, bb)) { if (!(entity instanceof ItemEntity)) continue; - if (!entity.isAlive() || !entity.onGround) + if (!entity.isAlive() || !entity.isOnGround()) continue; ItemEntity itemEntity = (ItemEntity) entity; pressedItems.add(itemEntity.getItem()); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryContraptionEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryContraptionEntity.java index ac2aacbc7..1f7f43623 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryContraptionEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryContraptionEntity.java @@ -21,7 +21,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -57,7 +57,7 @@ public class GantryContraptionEntity extends AbstractContraptionEntity { checkPinionShaft(); tickActors(); - Vec3d movementVec = getMotion(); + Vector3d movementVec = getMotion(); if (ContraptionCollider.collideBlocks(this)) { if (!world.isRemote) @@ -73,15 +73,15 @@ public class GantryContraptionEntity extends AbstractContraptionEntity { } protected void checkPinionShaft() { - Vec3d movementVec; + Vector3d movementVec; Direction facing = ((GantryContraption) contraption).getFacing(); - Vec3d currentPosition = getAnchorVec().add(.5, .5, .5); + Vector3d currentPosition = getAnchorVec().add(.5, .5, .5); BlockPos gantryShaftPos = new BlockPos(currentPosition).offset(facing.getOpposite()); TileEntity te = world.getTileEntity(gantryShaftPos); if (!(te instanceof GantryShaftTileEntity) || !AllBlocks.GANTRY_SHAFT.has(te.getBlockState())) { if (!world.isRemote) { - setContraptionMotion(Vec3d.ZERO); + setContraptionMotion(Vector3d.ZERO); disassemble(); } return; @@ -92,16 +92,16 @@ public class GantryContraptionEntity extends AbstractContraptionEntity { GantryShaftTileEntity gantryShaftTileEntity = (GantryShaftTileEntity) te; float pinionMovementSpeed = gantryShaftTileEntity.getPinionMovementSpeed(); - movementVec = new Vec3d(direction.getDirectionVec()).scale(pinionMovementSpeed); + movementVec = Vector3d.of(direction.getDirectionVec()).scale(pinionMovementSpeed); if (blockState.get(GantryShaftBlock.POWERED) || pinionMovementSpeed == 0) { - setContraptionMotion(Vec3d.ZERO); + setContraptionMotion(Vector3d.ZERO); if (!world.isRemote) disassemble(); return; } - Vec3d nextPosition = currentPosition.add(movementVec); + Vector3d nextPosition = currentPosition.add(movementVec); double currentCoord = direction.getAxis() .getCoordinate(currentPosition.x, currentPosition.y, currentPosition.z); double nextCoord = direction.getAxis() @@ -110,7 +110,7 @@ public class GantryContraptionEntity extends AbstractContraptionEntity { if ((MathHelper.floor(currentCoord) + .5f < nextCoord != (pinionMovementSpeed * direction.getAxisDirection() .getOffset() < 0))) if (!gantryShaftTileEntity.canAssembleOn()) { - setContraptionMotion(Vec3d.ZERO); + setContraptionMotion(Vector3d.ZERO); if (!world.isRemote) disassemble(); return; @@ -135,12 +135,12 @@ public class GantryContraptionEntity extends AbstractContraptionEntity { } @Override - public Vec3d applyRotation(Vec3d localPos, float partialTicks) { + public Vector3d applyRotation(Vector3d localPos, float partialTicks) { return localPos; } @Override - public Vec3d reverseRotation(Vec3d localPos, float partialTicks) { + public Vector3d reverseRotation(Vector3d localPos, float partialTicks) { return localPos; } @@ -175,12 +175,12 @@ public class GantryContraptionEntity extends AbstractContraptionEntity { public void updateClientMotion() { float modifier = movementAxis.getAxisDirection() .getOffset(); - setContraptionMotion(new Vec3d(movementAxis.getDirectionVec()) + setContraptionMotion(Vector3d.of(movementAxis.getDirectionVec()) .scale((axisMotion + clientOffsetDiff * modifier / 2f) * ServerSpeedProvider.get())); } public double getAxisCoord() { - Vec3d anchorVec = getAnchorVec(); + Vector3d anchorVec = getAnchorVec(); return movementAxis.getAxis() .getCoordinate(anchorVec.x, anchorVec.y, anchorVec.z); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryPinionBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryPinionBlock.java index 85c41d0af..d2120a056 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryPinionBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryPinionBlock.java @@ -39,8 +39,8 @@ public class GantryPinionBlock extends DirectionalAxisKineticBlock implements IT } @Override - public void updateNeighbors(BlockState stateIn, IWorld worldIn, BlockPos pos, int flags) { - super.updateNeighbors(stateIn, worldIn, pos, flags); + public void updateDiagonalNeighbors(BlockState stateIn, IWorld worldIn, BlockPos pos, int flags, int count) { + super.updateDiagonalNeighbors(stateIn, worldIn, pos, flags, count); withTileEntityDo(worldIn, pos, GantryPinionTileEntity::checkValidGantryShaft); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryPinionRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryPinionRenderer.java index 86a498d12..a660b6c6e 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryPinionRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryPinionRenderer.java @@ -11,12 +11,12 @@ import com.simibubi.create.foundation.utility.MatrixStacker; import net.minecraft.block.BlockState; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.Vector3f; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.util.Direction; import net.minecraft.util.Direction.Axis; import net.minecraft.util.Direction.AxisDirection; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.vector.Vector3f; public class GantryPinionRenderer extends KineticTileEntityRenderer { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/sync/ContraptionInteractionPacket.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/sync/ContraptionInteractionPacket.java index 83e37704b..b9e7e43a2 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/sync/ContraptionInteractionPacket.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/sync/ContraptionInteractionPacket.java @@ -12,6 +12,7 @@ import net.minecraft.network.PacketBuffer; import net.minecraft.util.Direction; import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; +import net.minecraftforge.common.ForgeMod; import net.minecraftforge.fml.network.NetworkEvent.Context; public class ContraptionInteractionPacket extends SimplePacketBase { @@ -54,7 +55,7 @@ public class ContraptionInteractionPacket extends SimplePacketBase { if (!(entityByID instanceof AbstractContraptionEntity)) return; AbstractContraptionEntity contraptionEntity = (AbstractContraptionEntity) entityByID; - double d = sender.getAttribute(PlayerEntity.REACH_DISTANCE).getValue(); + double d = sender.getAttribute(ForgeMod.REACH_DISTANCE.get()).getValue(); if (!sender.canEntityBeSeen(entityByID)) d -= 3; d *= d; diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/GantryShaftBlock.java b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/GantryShaftBlock.java index 6fa9bd927..8aa95d0ea 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/GantryShaftBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/GantryShaftBlock.java @@ -18,7 +18,7 @@ import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.ItemUseContext; import net.minecraft.state.BooleanProperty; import net.minecraft.state.EnumProperty; -import net.minecraft.state.IProperty; +import net.minecraft.state.Property; import net.minecraft.state.StateContainer.Builder; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.tileentity.TileEntity; @@ -36,14 +36,14 @@ import net.minecraft.world.World; public class GantryShaftBlock extends DirectionalKineticBlock { - public static final IProperty PART = EnumProperty.create("part", Part.class); + public static final Property PART = EnumProperty.create("part", Part.class); public static final BooleanProperty POWERED = BlockStateProperties.POWERED; public enum Part implements IStringSerializable { START, MIDDLE, END, SINGLE; @Override - public String getName() { + public String getString() { return Lang.asId(name()); } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltTileEntity.java index 18f2e7001..951c40d60 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltTileEntity.java @@ -478,7 +478,7 @@ public class BeltTileEntity extends KineticTileEntity { @Override protected boolean canPropagateDiagonally(IRotate block, BlockState state) { - return state.has(BeltBlock.SLOPE) + return state.contains(BeltBlock.SLOPE) && (state.get(BeltBlock.SLOPE) == BeltSlope.UPWARD || state.get(BeltBlock.SLOPE) == BeltSlope.DOWNWARD); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/encased/EncasedBeltBlock.java b/src/main/java/com/simibubi/create/content/contraptions/relays/encased/EncasedBeltBlock.java index 2d9ef08de..d74bd43df 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/encased/EncasedBeltBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/encased/EncasedBeltBlock.java @@ -139,7 +139,7 @@ public class EncasedBeltBlock extends RotatedPillarKineticBlock { // .updateNeighbors(context.getWorld(), context.getPos(), 1); Axis axis = newState.get(AXIS); newState = getDefaultState().with(AXIS, axis); - if (newState.has(BlockStateProperties.POWERED)) + if (newState.contains(BlockStateProperties.POWERED)) newState = newState.with(BlockStateProperties.POWERED, context.getWorld() .isBlockPowered(context.getPos())); for (Direction facing : Iterate.directions) { diff --git a/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripInteractionPacket.java b/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripInteractionPacket.java index d79af58ab..cace5783e 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripInteractionPacket.java +++ b/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripInteractionPacket.java @@ -10,6 +10,7 @@ import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.network.PacketBuffer; import net.minecraft.util.Hand; import net.minecraft.util.math.vector.Vector3d; +import net.minecraftforge.common.ForgeMod; import net.minecraftforge.fml.network.NetworkEvent.Context; public class ExtendoGripInteractionPacket extends SimplePacketBase { @@ -60,7 +61,7 @@ public class ExtendoGripInteractionPacket extends SimplePacketBase { return; Entity entityByID = sender.getServerWorld().getEntityByID(target); if (entityByID != null && ExtendoGripItem.isHoldingExtendoGrip(sender)) { - double d = sender.getAttribute(PlayerEntity.REACH_DISTANCE).getValue(); + double d = sender.getAttribute(ForgeMod.REACH_DISTANCE.get()).getValue(); if (!sender.canEntityBeSeen(entityByID)) d -= 3; d *= d; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/chute/SmartChuteFilterSlotPositioning.java b/src/main/java/com/simibubi/create/content/logistics/block/chute/SmartChuteFilterSlotPositioning.java index 7be5fd067..ad56ba184 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/chute/SmartChuteFilterSlotPositioning.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/chute/SmartChuteFilterSlotPositioning.java @@ -7,15 +7,15 @@ import com.simibubi.create.foundation.utility.VecHelper; import net.minecraft.block.BlockState; import net.minecraft.util.Direction; import net.minecraft.util.Direction.Axis; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Vector3d; public class SmartChuteFilterSlotPositioning extends ValueBoxTransform.Sided { @Override - protected Vec3d getLocalOffset(BlockState state) { + protected Vector3d getLocalOffset(BlockState state) { Direction side = getSide(); float horizontalAngle = AngleHelper.horizontalAngle(side); - Vec3d southLocation = VecHelper.voxelSpace(8, 12, 15.5f); + Vector3d southLocation = VecHelper.voxelSpace(8, 12, 15.5f); return VecHelper.rotateCentered(southLocation, horizontalAngle, Axis.Y); } @@ -26,8 +26,8 @@ public class SmartChuteFilterSlotPositioning extends ValueBoxTransform.Sided { } @Override - protected Vec3d getSouthLocation() { - return Vec3d.ZERO; + protected Vector3d getSouthLocation() { + return Vector3d.ZERO; } } diff --git a/src/main/java/com/simibubi/create/content/logistics/block/chute/SmartChuteTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/chute/SmartChuteTileEntity.java index d2ba5c271..a46acbaa5 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/chute/SmartChuteTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/chute/SmartChuteTileEntity.java @@ -32,7 +32,7 @@ public class SmartChuteTileEntity extends ChuteTileEntity { @Override protected boolean canCollectItemsFromBelow() { BlockState blockState = getBlockState(); - return blockState.has(SmartChuteBlock.POWERED) && !blockState.get(SmartChuteBlock.POWERED); + return blockState.contains(SmartChuteBlock.POWERED) && !blockState.get(SmartChuteBlock.POWERED); } @Override diff --git a/src/main/java/com/simibubi/create/content/logistics/block/funnel/HorizontalInteractionFunnelBlock.java b/src/main/java/com/simibubi/create/content/logistics/block/funnel/HorizontalInteractionFunnelBlock.java deleted file mode 100644 index f3236083b..000000000 --- a/src/main/java/com/simibubi/create/content/logistics/block/funnel/HorizontalInteractionFunnelBlock.java +++ /dev/null @@ -1,128 +0,0 @@ -package com.simibubi.create.content.logistics.block.funnel; - -import com.simibubi.create.AllTileEntities; -import com.simibubi.create.content.contraptions.wrench.IWrenchable; -import com.tterrag.registrate.util.entry.BlockEntry; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.HorizontalBlock; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.BlockItemUseContext; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemUseContext; -import net.minecraft.state.BooleanProperty; -import net.minecraft.state.StateContainer.Builder; -import net.minecraft.state.properties.BlockStateProperties; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ActionResultType; -import net.minecraft.util.Direction; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.IWorld; -import net.minecraft.world.IWorldReader; -import net.minecraft.world.World; - -public abstract class HorizontalInteractionFunnelBlock extends HorizontalBlock implements IWrenchable { - - public static final BooleanProperty POWERED = BlockStateProperties.POWERED; - public static final BooleanProperty PUSHING = BooleanProperty.create("pushing"); - private BlockEntry parent; - - public HorizontalInteractionFunnelBlock(BlockEntry parent, Properties p_i48377_1_) { - super(p_i48377_1_); - this.parent = parent; - BlockState defaultState = getDefaultState().with(PUSHING, true); - if (hasPoweredProperty()) - defaultState = defaultState.with(POWERED, false); - setDefaultState(defaultState); - } - - public abstract boolean hasPoweredProperty(); - - @Override - public boolean hasTileEntity(BlockState state) { - return true; - } - - @Override - public TileEntity createTileEntity(BlockState state, IBlockReader world) { - return AllTileEntities.FUNNEL.create(); - } - - @Override - protected void fillStateContainer(Builder p_206840_1_) { - if (hasPoweredProperty()) - p_206840_1_.add(POWERED); - super.fillStateContainer(p_206840_1_.add(HORIZONTAL_FACING, PUSHING)); - } - - @Override - public BlockState getStateForPlacement(BlockItemUseContext ctx) { - BlockState stateForPlacement = super.getStateForPlacement(ctx); - if (hasPoweredProperty()) - stateForPlacement = stateForPlacement.with(POWERED, ctx.getWorld() - .isBlockPowered(ctx.getPos())); - return stateForPlacement; - } - - @Override - public void onReplaced(BlockState p_196243_1_, World p_196243_2_, BlockPos p_196243_3_, BlockState p_196243_4_, - boolean p_196243_5_) { - if (p_196243_1_.hasTileEntity() - && (p_196243_1_.getBlock() != p_196243_4_.getBlock() && !FunnelBlock.isFunnel(p_196243_4_) - || !p_196243_4_.hasTileEntity())) { - p_196243_2_.removeTileEntity(p_196243_3_); - } - } - - @Override - public ItemStack getPickBlock(BlockState state, RayTraceResult target, IBlockReader world, BlockPos pos, - PlayerEntity player) { - return parent.asStack(); - } - - @Override - public BlockState updatePostPlacement(BlockState state, Direction direction, BlockState neighbour, IWorld world, - BlockPos pos, BlockPos p_196271_6_) { - if (!canStillInteract(state, world, pos)) { - BlockState parentState = parent.getDefaultState(); - if (state.method_28500(POWERED).orElse(false)) - parentState = parentState.with(POWERED, true); - return parentState.with(FunnelBlock.FACING, state.get(HORIZONTAL_FACING)); - } - return state; - } - - @Override - public boolean isValidPosition(BlockState state, IWorldReader world, BlockPos pos) { - return !world.getBlockState(pos.offset(state.get(HORIZONTAL_FACING) - .getOpposite())) - .getShape(world, pos) - .isEmpty(); - } - - protected abstract boolean canStillInteract(BlockState state, IWorldReader world, BlockPos pos); - - @Override - public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos, - boolean isMoving) { - if (!hasPoweredProperty()) - return; - if (worldIn.isRemote) - return; - boolean previouslyPowered = state.get(POWERED); - if (previouslyPowered != worldIn.isBlockPowered(pos)) - worldIn.setBlockState(pos, state.cycle(POWERED), 2); - } - - @Override - public ActionResultType onWrenched(BlockState state, ItemUseContext context) { - if (!context.getWorld().isRemote) - context.getWorld() - .setBlockState(context.getPos(), state.cycle(PUSHING)); - return ActionResultType.SUCCESS; - } - -} diff --git a/src/main/java/com/simibubi/create/content/schematics/SchematicProcessor.java b/src/main/java/com/simibubi/create/content/schematics/SchematicProcessor.java index 985338d5d..110444475 100644 --- a/src/main/java/com/simibubi/create/content/schematics/SchematicProcessor.java +++ b/src/main/java/com/simibubi/create/content/schematics/SchematicProcessor.java @@ -1,7 +1,10 @@ package com.simibubi.create.content.schematics; -import com.mojang.datafixers.Dynamic; -import com.mojang.datafixers.types.DynamicOps; +import java.util.Optional; + +import javax.annotation.Nullable; + +import com.mojang.serialization.Codec; import com.simibubi.create.foundation.utility.NBTProcessors; import net.minecraft.entity.Entity; @@ -16,15 +19,22 @@ import net.minecraft.world.gen.feature.template.PlacementSettings; import net.minecraft.world.gen.feature.template.StructureProcessor; import net.minecraft.world.gen.feature.template.Template; -import javax.annotation.Nullable; -import java.util.Optional; - public class SchematicProcessor extends StructureProcessor { + public static final SchematicProcessor INSTANCE = new SchematicProcessor(); - + public static final Codec CODEC = Codec.unit(() -> { + return INSTANCE; + }); + + public static IStructureProcessorType TYPE; + + public static void register() { + TYPE = IStructureProcessorType.register("schematic", CODEC); + } + @Nullable @Override - public Template.BlockInfo process(IWorldReader world, BlockPos pos, Template.BlockInfo rawInfo, + public Template.BlockInfo process(IWorldReader world, BlockPos pos, BlockPos anotherPos, Template.BlockInfo rawInfo, Template.BlockInfo info, PlacementSettings settings, @Nullable Template template) { if (info.nbt != null) { TileEntity te = info.state.createTileEntity(world); @@ -53,12 +63,8 @@ public class SchematicProcessor extends StructureProcessor { } @Override - protected IStructureProcessorType getType() { - return dynamic -> INSTANCE; + protected IStructureProcessorType getType() { + return TYPE; } - @Override - protected Dynamic serialize0(DynamicOps ops) { - return new Dynamic<>(ops, ops.emptyMap()); - } } diff --git a/src/main/java/com/simibubi/create/content/schematics/filtering/SchematicInstances.java b/src/main/java/com/simibubi/create/content/schematics/filtering/SchematicInstances.java index f8b612b61..a35791265 100644 --- a/src/main/java/com/simibubi/create/content/schematics/filtering/SchematicInstances.java +++ b/src/main/java/com/simibubi/create/content/schematics/filtering/SchematicInstances.java @@ -61,11 +61,7 @@ public class SchematicInstances { .getCompound("Anchor")); SchematicWorld world = new SchematicWorld(anchor, wrapped); PlacementSettings settings = SchematicItem.getSettings(schematic); - activeTemplate.addBlocksToWorld(world, anchor, settings); - - Debug.debugChat("Loading Schematic Instance of " + schematic.getTag() - .getString("File") + ". Total active instances: " + (loadedSchematics.get(wrapped).size() + 1)); - + activeTemplate.place(world, anchor, settings, wrapped.getRandom()); return world; } diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta index 76a2c3d19..8c6c34537 100644 --- a/src/main/resources/pack.mcmeta +++ b/src/main/resources/pack.mcmeta @@ -1,6 +1,6 @@ { "pack": { "description": "create resources", - "pack_format": 5 + "pack_format": 6 } }