From f6053da7de42c666a760e41d6609e710a7ae671c Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Sat, 21 Nov 2020 11:39:04 +0100 Subject: [PATCH 1/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3d8590c60..20d62523a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@

Logo

Create
- Patreon + Patreon Supported Versions License Discord From ddf28cfcea1efc458c57e2b23e32feb88b25888f Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Sun, 22 Nov 2020 13:22:36 +0100 Subject: [PATCH 2/7] More collision polish --- .../AbstractContraptionEntity.java | 44 +++++++++++--- .../ContraptionCollider.java | 57 ++++++++++--------- .../ContraptionDisassemblyPacket.java | 42 ++++++++++++++ .../ControlledContraptionEntity.java | 7 +++ .../structureMovement/StructureTransform.java | 55 +++++++++++++----- .../collision/ContinuousOBBCollider.java | 6 -- .../foundation/networking/AllPackets.java | 4 +- 7 files changed, 158 insertions(+), 57 deletions(-) create mode 100644 src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionDisassemblyPacket.java diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AbstractContraptionEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AbstractContraptionEntity.java index bfbb03470..3c3ecc0b2 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AbstractContraptionEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AbstractContraptionEntity.java @@ -1,10 +1,13 @@ package com.simibubi.create.content.contraptions.components.structureMovement; -import java.util.ArrayList; +import java.util.IdentityHashMap; +import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.Map.Entry; import java.util.UUID; +import org.apache.commons.lang3.mutable.MutableInt; import org.apache.commons.lang3.tuple.MutablePair; import com.simibubi.create.AllMovementBehaviours; @@ -49,7 +52,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit private static final DataParameter STALLED = EntityDataManager.createKey(AbstractContraptionEntity.class, DataSerializers.BOOLEAN); - public final List collidingEntities = new ArrayList<>(); + public final Map collidingEntities; protected Contraption contraption; protected boolean initialized; @@ -58,6 +61,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit public AbstractContraptionEntity(EntityType entityTypeIn, World worldIn) { super(entityTypeIn, worldIn); prevPosInvalid = true; + collidingEntities = new IdentityHashMap<>(); } protected void setContraption(Contraption contraption) { @@ -205,6 +209,13 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit return; } + for (Iterator> iterator = collidingEntities.entrySet() + .iterator(); iterator.hasNext();) + if (iterator.next() + .getValue() + .incrementAndGet() > 3) + iterator.remove(); + prevPosX = getX(); prevPosY = getY(); prevPosZ = getZ(); @@ -378,8 +389,13 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit return; if (contraption == null) return; + remove(); + StructureTransform transform = makeStructureTransform(); + AllPackets.channel.send(PacketDistributor.TRACKING_ENTITY.with(() -> this), + new ContraptionDisassemblyPacket(this.getEntityId(), transform)); + contraption.addBlocksToWorld(world, transform); contraption.addPassengersToWorld(world, transform, getPassengers()); @@ -396,14 +412,17 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit } removePassengers(); + moveCollidedEntitiesOnDisassembly(transform); + } - for (Entity entity : collidingEntities) { - Vec3d positionVec = getPositionVec(); - Vec3d localVec = entity.getPositionVec() - .subtract(positionVec); - localVec = reverseRotation(localVec, 1); + private void moveCollidedEntitiesOnDisassembly(StructureTransform transform) { + for (Entity entity : collidingEntities.keySet()) { + Vec3d localVec = toLocalVector(entity.getPositionVec(), 0); Vec3d transformed = transform.apply(localVec); - entity.setPositionAndUpdate(transformed.x, transformed.y, transformed.z); + if (world.isRemote) + entity.setPosition(transformed.x, transformed.y + 1 / 16f, transformed.z); + else + entity.setPositionAndUpdate(transformed.x, transformed.y + 1 / 16f, transformed.z); } } @@ -449,6 +468,15 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit ce.handleStallInformation(packet.x, packet.y, packet.z, packet.angle); } + @OnlyIn(Dist.CLIENT) + static void handleDisassemblyPacket(ContraptionDisassemblyPacket packet) { + Entity entity = Minecraft.getInstance().world.getEntityByID(packet.entityID); + if (!(entity instanceof AbstractContraptionEntity)) + return; + AbstractContraptionEntity ce = (AbstractContraptionEntity) entity; + ce.moveCollidedEntitiesOnDisassembly(packet.transform); + } + protected abstract float getStalledAngle(); protected abstract void handleStallInformation(float x, float y, float z, float angle); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionCollider.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionCollider.java index 0343a8e6b..3d9fd25ee 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionCollider.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionCollider.java @@ -8,6 +8,8 @@ import java.util.List; import java.util.stream.Stream; import org.apache.commons.lang3.mutable.MutableBoolean; +import org.apache.commons.lang3.mutable.MutableFloat; +import org.apache.commons.lang3.mutable.MutableInt; import org.apache.commons.lang3.mutable.MutableObject; import com.google.common.base.Predicates; @@ -65,8 +67,6 @@ public class ContraptionCollider { if (bounds == null) return; - contraptionEntity.collidingEntities.clear(); - Vec3d contraptionPosition = contraptionEntity.getPositionVec(); Vec3d contraptionMotion = contraptionPosition.subtract(contraptionEntity.getPrevPositionVec()); Vec3d anchorVec = contraptionEntity.getAnchorVec(); @@ -123,13 +123,12 @@ public class ContraptionCollider { // Prepare entity bounds OrientedBB obb = new OrientedBB(localBB); obb.setRotation(rotationMatrix); - motion = rotationMatrix.transform(motion); motion = motion.subtract(contraptionMotion); + motion = rotationMatrix.transform(motion); MutableObject collisionResponse = new MutableObject<>(Vec3d.ZERO); - MutableObject allowedMotion = new MutableObject<>(motion); - MutableBoolean futureCollision = new MutableBoolean(false); MutableBoolean surfaceCollision = new MutableBoolean(false); + MutableFloat temporalResponse = new MutableFloat(1); Vec3d obbCenter = obb.getCenter(); // Apply separation maths @@ -140,21 +139,22 @@ public class ContraptionCollider { boolean doHorizontalPass = !rotation.hasVerticalRotation(); for (boolean horizontalPass : Iterate.trueAndFalse) { + boolean verticalPass = !horizontalPass || !doHorizontalPass; for (AxisAlignedBB bb : bbs) { Vec3d currentResponse = collisionResponse.getValue(); obb.setCenter(obbCenter.add(currentResponse)); - ContinuousSeparationManifold intersect = obb.intersect(bb, allowedMotion.getValue()); + ContinuousSeparationManifold intersect = obb.intersect(bb, motion); if (intersect == null) continue; - if ((!horizontalPass || !doHorizontalPass) && surfaceCollision.isFalse()) + if (verticalPass && surfaceCollision.isFalse()) surfaceCollision.setValue(intersect.isSurfaceCollision()); double timeOfImpact = intersect.getTimeOfImpact(); if (timeOfImpact > 0 && timeOfImpact < 1) { - futureCollision.setTrue(); - allowedMotion.setValue(intersect.getAllowedMotion(allowedMotion.getValue())); + if (temporalResponse.getValue() > timeOfImpact) + temporalResponse.setValue(timeOfImpact); continue; } @@ -163,28 +163,28 @@ public class ContraptionCollider { collisionResponse.setValue(currentResponse.add(separation)); } - if (!horizontalPass || !doHorizontalPass) + if (verticalPass) break; - boolean noVerticalMotionResponse = allowedMotion.getValue().y == motion.y; + boolean noVerticalMotionResponse = temporalResponse.getValue() == 1; boolean noVerticalCollision = collisionResponse.getValue().y == 0; if (noVerticalCollision && noVerticalMotionResponse) break; // Re-run collisions with horizontal offset collisionResponse.setValue(collisionResponse.getValue() - .mul(1, 0, 1)); - allowedMotion.setValue(allowedMotion.getValue() - .mul(1, 0, 1) - .add(0, motion.y, 0)); + .mul(129 / 128f, 0, 129 / 128f)); continue; } // Resolve collision Vec3d entityMotion = entity.getMotion(); Vec3d totalResponse = collisionResponse.getValue(); - Vec3d motionResponse = allowedMotion.getValue(); boolean hardCollision = !totalResponse.equals(Vec3d.ZERO); + boolean temporalCollision = temporalResponse.getValue() != 1; + Vec3d motionResponse = !temporalCollision ? motion + : motion.normalize() + .scale(motion.length() * temporalResponse.getValue()); rotationMatrix.transpose(); motionResponse = rotationMatrix.transform(motionResponse) @@ -193,10 +193,11 @@ public class ContraptionCollider { totalResponse = VecHelper.rotate(totalResponse, yawOffset, Axis.Y); rotationMatrix.transpose(); - if (futureCollision.isTrue() && playerType != PlayerType.SERVER) { - if (motionResponse.y != entityMotion.y) { + if (temporalCollision && playerType != PlayerType.SERVER) { + double idealVerticalMotion = motionResponse.y; + if (idealVerticalMotion != entityMotion.y) { entity.setMotion(entityMotion.mul(1, 0, 1) - .add(0, motionResponse.y, 0)); + .add(0, idealVerticalMotion, 0)); entityMotion = entity.getMotion(); } } @@ -213,7 +214,8 @@ public class ContraptionCollider { if (motionX != 0 && Math.abs(intersectX) > horizonalEpsilon && motionX > 0 == intersectX < 0) entityMotion = entityMotion.mul(0, 1, 1); if (motionY != 0 && intersectY != 0 && motionY > 0 == intersectY < 0) - entityMotion = entityMotion.mul(1, 0, 1); + entityMotion = entityMotion.mul(1, 0, 1) + .add(0, contraptionMotion.y, 0); if (motionZ != 0 && Math.abs(intersectZ) > horizonalEpsilon && motionZ > 0 == intersectZ < 0) entityMotion = entityMotion.mul(1, 1, 0); } @@ -226,27 +228,25 @@ public class ContraptionCollider { continue; } -// totalResponse = totalResponse.add(contactPointMotion); Vec3d allowedMovement = getAllowedMovement(totalResponse, entity); - contraptionEntity.collidingEntities.add(entity); - entity.velocityChanged = true; entity.setPosition(entityPosition.x + allowedMovement.x, entityPosition.y + allowedMovement.y, entityPosition.z + allowedMovement.z); entityPosition = entity.getPositionVec(); + entity.velocityChanged = true; Vec3d contactPointMotion = Vec3d.ZERO; + if (surfaceCollision.isTrue()) { entity.fallDistance = 0; entity.onGround = true; - contraptionEntity.collidingEntities.add(entity); + contraptionEntity.collidingEntities.put(entity, new MutableInt(0)); if (entity instanceof ItemEntity) entityMotion = entityMotion.mul(.5f, 1, .5f); - if (playerType != PlayerType.SERVER) { contactPointMotion = contraptionEntity.getContactPointMotion(entityPosition); allowedMovement = getAllowedMovement(contactPointMotion, entity); - entity.setPosition(entityPosition.x + allowedMovement.x, entityPosition.y + allowedMovement.y, - entityPosition.z + allowedMovement.z); + entity.setPosition(entityPosition.x + allowedMovement.x, + entityPosition.y, entityPosition.z + allowedMovement.z); } } @@ -260,7 +260,8 @@ public class ContraptionCollider { float limbSwing = MathHelper.sqrt(d0 * d0 + d1 * d1) * 4.0F; if (limbSwing > 1.0F) limbSwing = 1.0F; - AllPackets.channel.sendToServer(new ClientMotionPacket(entityMotion, true, limbSwing)); + AllPackets.channel + .sendToServer(new ClientMotionPacket(entityMotion, true, limbSwing)); } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionDisassemblyPacket.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionDisassemblyPacket.java new file mode 100644 index 000000000..20baaaa45 --- /dev/null +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionDisassemblyPacket.java @@ -0,0 +1,42 @@ +package com.simibubi.create.content.contraptions.components.structureMovement; + +import java.util.function.Supplier; + +import com.simibubi.create.foundation.networking.SimplePacketBase; + +import net.minecraft.network.PacketBuffer; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.fml.DistExecutor; +import net.minecraftforge.fml.network.NetworkEvent.Context; + +public class ContraptionDisassemblyPacket extends SimplePacketBase { + + int entityID; + StructureTransform transform; + + public ContraptionDisassemblyPacket(int entityID, StructureTransform transform) { + this.entityID = entityID; + this.transform = transform; + } + + public ContraptionDisassemblyPacket(PacketBuffer buffer) { + entityID = buffer.readInt(); + transform = StructureTransform.fromBuffer(buffer); + } + + @Override + public void write(PacketBuffer buffer) { + buffer.writeInt(entityID); + transform.writeToBuffer(buffer); + } + + @Override + public void handle(Supplier context) { + context.get() + .enqueueWork(() -> DistExecutor.runWhenOn(Dist.CLIENT, + () -> () -> AbstractContraptionEntity.handleDisassemblyPacket(this))); + context.get() + .setPacketHandled(true); + } + +} diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ControlledContraptionEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ControlledContraptionEntity.java index e3cf6aab1..415fdc885 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ControlledContraptionEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ControlledContraptionEntity.java @@ -49,6 +49,13 @@ public class ControlledContraptionEntity extends AbstractContraptionEntity { public boolean supportsTerrainCollision() { return contraption instanceof TranslatingContraption; } + + @Override + public Vec3d getContactPointMotion(Vec3d globalContactPoint) { + if (contraption instanceof TranslatingContraption) + return getMotion(); + return super.getContactPointMotion(globalContactPoint); + } @Override protected void setContraption(Contraption contraption) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/StructureTransform.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/StructureTransform.java index ab0363569..0e7470654 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/StructureTransform.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/StructureTransform.java @@ -19,6 +19,7 @@ import net.minecraft.block.BlockState; import net.minecraft.block.HorizontalFaceBlock; import net.minecraft.block.SlabBlock; import net.minecraft.block.StairsBlock; +import net.minecraft.network.PacketBuffer; import net.minecraft.state.BooleanProperty; import net.minecraft.state.properties.AttachFace; import net.minecraft.state.properties.BellAttachment; @@ -40,6 +41,13 @@ public class StructureTransform { Axis rotationAxis; BlockPos offset; + private StructureTransform(BlockPos offset, int angle, Axis axis, Rotation rotation) { + this.offset = offset; + this.angle = angle; + rotationAxis = axis; + this.rotation = rotation; + } + public StructureTransform(BlockPos offset, float xRotation, float yRotation, float zRotation) { this.offset = offset; if (xRotation != 0) { @@ -71,14 +79,16 @@ public class StructureTransform { public Vec3d apply(Vec3d localVec) { Vec3d vec = localVec; - vec = VecHelper.rotateCentered(vec, angle, rotationAxis); + if (rotationAxis != null) + vec = VecHelper.rotateCentered(vec, angle, rotationAxis); vec = vec.add(new Vec3d(offset)); return vec; } - + public BlockPos apply(BlockPos localPos) { Vec3d vec = VecHelper.getCenterOf(localPos); - vec = VecHelper.rotateCentered(vec, angle, rotationAxis); + if (rotationAxis != null) + vec = VecHelper.rotateCentered(vec, angle, rotationAxis); localPos = new BlockPos(vec); return localPos.add(offset); } @@ -202,8 +212,9 @@ public class StructureTransform { protected BlockState transformBelt(BlockState state, boolean halfTurn) { Direction initialDirection = state.get(BeltBlock.HORIZONTAL_FACING); - boolean diagonal = state.get(BeltBlock.SLOPE) == BeltSlope.DOWNWARD || state.get(BeltBlock.SLOPE) == BeltSlope.UPWARD; - + boolean diagonal = + state.get(BeltBlock.SLOPE) == BeltSlope.DOWNWARD || state.get(BeltBlock.SLOPE) == BeltSlope.UPWARD; + if (!diagonal) { for (int i = 0; i < rotation.ordinal(); i++) { Direction direction = state.get(BeltBlock.HORIZONTAL_FACING); @@ -211,7 +222,7 @@ public class StructureTransform { boolean vertical = slope == BeltSlope.VERTICAL; boolean horizontal = slope == BeltSlope.HORIZONTAL; boolean sideways = slope == BeltSlope.SIDEWAYS; - + Direction newDirection = direction.getOpposite(); BeltSlope newSlope = BeltSlope.VERTICAL; @@ -229,15 +240,15 @@ public class StructureTransform { if (sideways) { newDirection = direction; - if (direction.getAxis() == rotationAxis) + if (direction.getAxis() == rotationAxis) newSlope = BeltSlope.HORIZONTAL; - else + else newDirection = direction.rotateYCCW(); } if (horizontal) { newDirection = direction; - if (direction.getAxis() == rotationAxis) + if (direction.getAxis() == rotationAxis) newSlope = BeltSlope.SIDEWAYS; } @@ -254,8 +265,7 @@ public class StructureTransform { boolean downward = slope == BeltSlope.DOWNWARD; // Rotate diagonal - if (direction.getAxisDirection() == AxisDirection.POSITIVE ^ downward - ^ direction.getAxis() == Axis.Z) { + if (direction.getAxisDirection() == AxisDirection.POSITIVE ^ downward ^ direction.getAxis() == Axis.Z) { state = state.with(BeltBlock.SLOPE, upward ? BeltSlope.DOWNWARD : BeltSlope.UPWARD); } else { state = state.with(BeltBlock.HORIZONTAL_FACING, newDirection); @@ -267,10 +277,10 @@ public class StructureTransform { Direction newDirection = direction.getOpposite(); BeltSlope slope = state.get(BeltBlock.SLOPE); boolean vertical = slope == BeltSlope.VERTICAL; - + if (diagonal) { - state = state.with(BeltBlock.SLOPE, - slope == BeltSlope.UPWARD ? BeltSlope.DOWNWARD : slope == BeltSlope.DOWNWARD ? BeltSlope.UPWARD : slope); + state = state.with(BeltBlock.SLOPE, slope == BeltSlope.UPWARD ? BeltSlope.DOWNWARD + : slope == BeltSlope.DOWNWARD ? BeltSlope.UPWARD : slope); } else if (vertical) { state = state.with(BeltBlock.HORIZONTAL_FACING, newDirection); } @@ -317,4 +327,21 @@ public class StructureTransform { return rotated; } + public static StructureTransform fromBuffer(PacketBuffer buffer) { + BlockPos readBlockPos = buffer.readBlockPos(); + int readAngle = buffer.readInt(); + int axisIndex = buffer.readVarInt(); + int rotationIndex = buffer.readVarInt(); + return new StructureTransform(readBlockPos, readAngle, + axisIndex == -1 ? null : Axis.values()[axisIndex], + rotationIndex == -1 ? null : Rotation.values()[rotationIndex]); + } + + public void writeToBuffer(PacketBuffer buffer) { + buffer.writeBlockPos(offset); + buffer.writeInt(angle); + buffer.writeVarInt(rotationAxis == null ? -1 : rotationAxis.ordinal()); + buffer.writeVarInt(rotation == null ? -1 : rotation.ordinal()); + } + } diff --git a/src/main/java/com/simibubi/create/foundation/collision/ContinuousOBBCollider.java b/src/main/java/com/simibubi/create/foundation/collision/ContinuousOBBCollider.java index b87de83b9..bc4015ac7 100644 --- a/src/main/java/com/simibubi/create/foundation/collision/ContinuousOBBCollider.java +++ b/src/main/java/com/simibubi/create/foundation/collision/ContinuousOBBCollider.java @@ -163,12 +163,6 @@ public class ContinuousOBBCollider extends OBBCollider { return true; } - public Vec3d getAllowedMotion(Vec3d motion) { - double length = motion.length(); - return motion.normalize() - .scale(getTimeOfImpact() * length); - } - public Vec3d asSeparationVec(double obbStepHeight) { if (isDiscreteCollision) { if (stepSeparation <= obbStepHeight) diff --git a/src/main/java/com/simibubi/create/foundation/networking/AllPackets.java b/src/main/java/com/simibubi/create/foundation/networking/AllPackets.java index 8feb79656..30f793bb5 100644 --- a/src/main/java/com/simibubi/create/foundation/networking/AllPackets.java +++ b/src/main/java/com/simibubi/create/foundation/networking/AllPackets.java @@ -5,6 +5,7 @@ import java.util.function.Function; import java.util.function.Supplier; import com.simibubi.create.Create; +import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionDisassemblyPacket; import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionStallPacket; import com.simibubi.create.content.contraptions.components.structureMovement.glue.GlueEffectPacket; import com.simibubi.create.content.contraptions.components.structureMovement.sync.ClientMotionPacket; @@ -25,8 +26,8 @@ import com.simibubi.create.content.logistics.packet.ConfigureStockswitchPacket; import com.simibubi.create.content.schematics.packet.ConfigureSchematicannonPacket; import com.simibubi.create.content.schematics.packet.InstantSchematicPacket; import com.simibubi.create.content.schematics.packet.SchematicPlacePacket; -import com.simibubi.create.content.schematics.packet.SchematicUploadPacket; import com.simibubi.create.content.schematics.packet.SchematicSyncPacket; +import com.simibubi.create.content.schematics.packet.SchematicUploadPacket; import com.simibubi.create.foundation.command.ConfigureConfigPacket; import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringCountUpdatePacket; import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollValueUpdatePacket; @@ -69,6 +70,7 @@ public enum AllPackets { BEAM_EFFECT(ZapperBeamPacket.class, ZapperBeamPacket::new), CONFIGURE_CONFIG(ConfigureConfigPacket.class, ConfigureConfigPacket::new), CONTRAPTION_STALL(ContraptionStallPacket.class, ContraptionStallPacket::new), + CONTRAPTION_DISASSEMBLE(ContraptionDisassemblyPacket.class, ContraptionDisassemblyPacket::new), GLUE_EFFECT(GlueEffectPacket.class, GlueEffectPacket::new), CONTRAPTION_SEAT_MAPPING(ContraptionSeatMappingPacket.class, ContraptionSeatMappingPacket::new), LIMBSWING_UPDATE(LimbSwingUpdatePacket.class, LimbSwingUpdatePacket::new), From c5163f09534de69e92baa53579288a24ee2e8652 Mon Sep 17 00:00:00 2001 From: Zelophed Date: Sun, 22 Nov 2020 14:27:50 +0100 Subject: [PATCH 3/7] Pole Vault - add placement helper for piston extension poles - add piston pole length to goggle overlay - fix mechanical pistons being a little too generous with pole alignment - allow ProperDirectionalBlocks to be rotated with the wrench --- .../contraptions/base/KineticTileEntity.java | 21 ++- .../components/fan/NozzleBlock.java | 4 +- .../piston/PistonContraption.java | 30 ++--- .../piston/PistonExtensionPoleBlock.java | 43 +++++- .../piston/PistonPolePlacementHelper.java | 126 ++++++++++++++++++ .../goggles/GoggleOverlayRenderer.java | 62 ++++++--- .../block/inventories/CrateBlock.java | 6 +- .../block/redstone/RedstoneContactBlock.java | 13 +- .../block/redstone/RedstoneLinkBlock.java | 11 +- .../simibubi/create/events/ClientEvents.java | 9 +- .../block/ProperDirectionalBlock.java | 19 ++- .../create/foundation/utility/Iterate.java | 28 ++-- 12 files changed, 285 insertions(+), 87 deletions(-) create mode 100644 src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/PistonPolePlacementHelper.java diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java index 29e5a8333..88f96feae 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java @@ -1,12 +1,5 @@ package com.simibubi.create.content.contraptions.base; -import static net.minecraft.util.text.TextFormatting.GOLD; -import static net.minecraft.util.text.TextFormatting.GRAY; - -import java.util.List; - -import javax.annotation.Nullable; - import com.simibubi.create.Create; import com.simibubi.create.content.contraptions.KineticNetwork; import com.simibubi.create.content.contraptions.RotationPropagator; @@ -20,7 +13,6 @@ import com.simibubi.create.foundation.item.TooltipHelper; import com.simibubi.create.foundation.tileEntity.SmartTileEntity; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.utility.Lang; - import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.client.resources.I18n; @@ -35,6 +27,12 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; +import javax.annotation.Nullable; +import java.util.List; + +import static net.minecraft.util.text.TextFormatting.GOLD; +import static net.minecraft.util.text.TextFormatting.GRAY; + public abstract class KineticTileEntity extends SmartTileEntity implements ITickableTileEntity, IHaveGoggleInformation, IHaveHoveringInformation { @@ -352,13 +350,12 @@ public abstract class KineticTileEntity extends SmartTileEntity return; TileEntity tileEntityIn = world.getTileEntity(pos); + BlockState currentState = world.getBlockState(pos); boolean isKinetic = tileEntityIn instanceof KineticTileEntity; - if (tileEntityIn == null) + if (currentState == state) return; - if (tileEntityIn.getBlockState() == state) - return; - if (!isKinetic) { + if (tileEntityIn == null || !isKinetic) { world.setBlockState(pos, state, 3); return; } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/fan/NozzleBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/fan/NozzleBlock.java index 34fd10d4e..2c0a842ce 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/fan/NozzleBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/fan/NozzleBlock.java @@ -2,9 +2,7 @@ package com.simibubi.create.content.contraptions.components.fan; import com.simibubi.create.AllShapes; import com.simibubi.create.AllTileEntities; -import com.simibubi.create.content.contraptions.wrench.IWrenchable; import com.simibubi.create.foundation.block.ProperDirectionalBlock; - import mcp.MethodsReturnNonnullByDefault; import net.minecraft.block.Block; import net.minecraft.block.BlockState; @@ -24,7 +22,7 @@ import javax.annotation.ParametersAreNonnullByDefault; @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault -public class NozzleBlock extends ProperDirectionalBlock implements IWrenchable { +public class NozzleBlock extends ProperDirectionalBlock { public NozzleBlock(Properties p_i48415_1_) { super(p_i48415_1_); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/PistonContraption.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/PistonContraption.java index 9e0e0972d..eb786c14e 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/PistonContraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/PistonContraption.java @@ -1,25 +1,11 @@ package com.simibubi.create.content.contraptions.components.structureMovement.piston; -import static com.simibubi.create.AllBlocks.MECHANICAL_PISTON_HEAD; -import static com.simibubi.create.AllBlocks.PISTON_EXTENSION_POLE; -import static com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock.isExtensionPole; -import static com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock.isPiston; -import static com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock.isPistonHead; -import static com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock.isStickyPiston; -import static net.minecraft.state.properties.BlockStateProperties.FACING; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.lang3.tuple.Pair; - import com.simibubi.create.content.contraptions.components.structureMovement.AllContraptionTypes; import com.simibubi.create.content.contraptions.components.structureMovement.BlockMovementTraits; import com.simibubi.create.content.contraptions.components.structureMovement.TranslatingContraption; -import com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock.PistonState; +import com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock.*; 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.nbt.CompoundNBT; @@ -32,6 +18,15 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.IWorld; import net.minecraft.world.World; import net.minecraft.world.gen.feature.template.Template.BlockInfo; +import org.apache.commons.lang3.tuple.Pair; + +import java.util.ArrayList; +import java.util.List; + +import static com.simibubi.create.AllBlocks.MECHANICAL_PISTON_HEAD; +import static com.simibubi.create.AllBlocks.PISTON_EXTENSION_POLE; +import static com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock.*; +import static net.minecraft.state.properties.BlockStateProperties.FACING; public class PistonContraption extends TranslatingContraption { @@ -77,8 +72,7 @@ public class PistonContraption extends TranslatingContraption { return false; if (blockState.get(MechanicalPistonBlock.STATE) == PistonState.EXTENDED) { - while (isExtensionPole(nextBlock) && nextBlock.get(FACING) - .getAxis() == direction.getAxis() || isPistonHead(nextBlock) && nextBlock.get(FACING) == direction) { + while (PistonPolePlacementHelper.matchesAxis(nextBlock, direction.getAxis()) || isPistonHead(nextBlock) && nextBlock.get(FACING) == direction) { actualStart = actualStart.offset(direction); poles.add(new BlockInfo(actualStart, nextBlock.with(FACING, direction), null)); @@ -105,7 +99,7 @@ public class PistonContraption extends TranslatingContraption { nextBlock = world.getBlockState(end.offset(direction.getOpposite())); int extensionsInBack = 0; - while (isExtensionPole(nextBlock)) { + while (PistonPolePlacementHelper.matchesAxis(nextBlock, direction.getAxis())) { end = end.offset(direction.getOpposite()); poles.add(new BlockInfo(end, nextBlock.with(FACING, direction), null)); extensionsInBack++; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/PistonExtensionPoleBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/PistonExtensionPoleBlock.java index 7e38330ad..f2949639d 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/PistonExtensionPoleBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/PistonExtensionPoleBlock.java @@ -1,14 +1,11 @@ package com.simibubi.create.content.contraptions.components.structureMovement.piston; -import static com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock.isExtensionPole; -import static com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock.isPiston; -import static com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock.isPistonHead; - +import com.simibubi.create.AllBlocks; import com.simibubi.create.AllShapes; -import com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock.PistonState; +import com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock.*; import com.simibubi.create.content.contraptions.wrench.IWrenchable; import com.simibubi.create.foundation.block.ProperDirectionalBlock; - +import com.simibubi.create.foundation.utility.Pair; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.IWaterLoggable; @@ -17,18 +14,24 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.Fluids; import net.minecraft.fluid.IFluidState; import net.minecraft.item.BlockItemUseContext; +import net.minecraft.item.ItemStack; import net.minecraft.state.StateContainer.Builder; import net.minecraft.state.properties.BlockStateProperties; +import net.minecraft.util.ActionResultType; import net.minecraft.util.Direction; import net.minecraft.util.Direction.Axis; import net.minecraft.util.Direction.AxisDirection; +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.World; +import static com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock.*; + public class PistonExtensionPoleBlock extends ProperDirectionalBlock implements IWrenchable, IWaterLoggable { public PistonExtensionPoleBlock(Properties properties) { @@ -99,6 +102,34 @@ public class PistonExtensionPoleBlock extends ProperDirectionalBlock implements .with(BlockStateProperties.WATERLOGGED, Boolean.valueOf(ifluidstate.getFluid() == Fluids.WATER)); } + @Override + public ActionResultType onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult ray) { + ItemStack heldItem = player.getHeldItem(hand); + + if (AllBlocks.PISTON_EXTENSION_POLE.isIn(heldItem) && !player.isSneaking()) { + Pair offset = PistonPolePlacementHelper.getPlacementOffset(world, state.get(FACING).getAxis(), pos, ray.getHitVec()); + + if (offset == null || offset.getSecond() == 0) + return ActionResultType.PASS; + + BlockPos newPos = pos.offset(offset.getFirst(), offset.getSecond()); + + if (!world.getBlockState(newPos).getMaterial().isReplaceable()) + return ActionResultType.PASS; + + if (world.isRemote) + return ActionResultType.SUCCESS; + + world.setBlockState(newPos, AllBlocks.PISTON_EXTENSION_POLE.getDefaultState().with(FACING, offset.getFirst())); + if (!player.isCreative()) + heldItem.shrink(1); + + return ActionResultType.SUCCESS; + } + + return ActionResultType.PASS; + } + @Override public IFluidState getFluidState(BlockState state) { return state.get(BlockStateProperties.WATERLOGGED) ? Fluids.WATER.getStillFluidState(false) : Fluids.EMPTY.getDefaultState(); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/PistonPolePlacementHelper.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/PistonPolePlacementHelper.java new file mode 100644 index 000000000..5559631e6 --- /dev/null +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/PistonPolePlacementHelper.java @@ -0,0 +1,126 @@ +package com.simibubi.create.content.contraptions.components.structureMovement.piston; + +import com.simibubi.create.AllBlocks; +import com.simibubi.create.CreateClient; +import com.simibubi.create.foundation.utility.Iterate; +import com.simibubi.create.foundation.utility.Pair; +import com.simibubi.create.foundation.utility.VecHelper; +import net.minecraft.block.BlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.world.ClientWorld; +import net.minecraft.entity.player.PlayerEntity; +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.Vec3d; +import net.minecraft.world.World; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +import java.util.Arrays; + +public class PistonPolePlacementHelper { + + @OnlyIn(Dist.CLIENT) + public static void tick() { + Minecraft mc = Minecraft.getInstance(); + ClientWorld world = mc.world; + + if (!(mc.objectMouseOver instanceof BlockRayTraceResult)) + return; + + BlockRayTraceResult ray = (BlockRayTraceResult) mc.objectMouseOver; + + if (!isHoldingPole(mc.player)) + return; + + BlockPos pos = ray.getPos(); + BlockState state = world.getBlockState(pos); + if (!(state.getBlock() instanceof PistonExtensionPoleBlock)) + return; + + Pair offset = getPlacementOffset(world, state.get(PistonExtensionPoleBlock.FACING).getAxis(), pos, ray.getHitVec()); + if (offset == null || offset.getSecond() == 0) + return; + + Direction hitFace = ray.getFace(); + + if (hitFace.getAxis() == offset.getFirst().getAxis()) + return; + + Vec3d hitCenter = VecHelper.getCenterOf(pos).add(new Vec3d(hitFace.getDirectionVec()).scale(0.3)); + + //get the two perpendicular directions to form the arrow + Direction[] directions = Arrays.stream(Direction.Axis.values()).filter(axis -> axis != hitFace.getAxis() && axis != offset.getFirst().getAxis()).map(Iterate::directionsInAxis).findFirst().orElse(new Direction[]{}); + Vec3d startOffset = new Vec3d(offset.getFirst().getDirectionVec()); + Vec3d start = hitCenter.add(startOffset); + for (Direction dir : directions) { + Vec3d arrowOffset = new Vec3d(dir.getDirectionVec()).scale(.25); + Vec3d target = hitCenter.add(startOffset.scale(0.75)).add(arrowOffset); + CreateClient.outliner.showLine("poleHelp" + offset.getFirst() + dir, start, target).lineWidth(1/16f); + } + } + + // first indicates the direction that the position needs to be offset into + // second indicates by how many blocks the position needs to be offset by; is 0 if there was no valid position on either end of the pole + public static Pair getPlacementOffset(World world, Direction.Axis poleAxis, BlockPos pos, Vec3d hit) { + Pair offset = null; + double min = Double.MAX_VALUE; + Vec3d localPos = hit.subtract(VecHelper.getCenterOf(pos)); + + //find target direction + for (Direction dir : Iterate.directionsInAxis(poleAxis)) { + double distance = new Vec3d(dir.getDirectionVec()).distanceTo(localPos); + if (distance > min) + continue; + min = distance; + offset = Pair.of(dir, 0); + } + + if (offset == null)//?? + return null; + + //check for space at the end of the pole + int poles = attachedPoles(world, pos, offset.getFirst()); + BlockState state = world.getBlockState(pos.offset(offset.getFirst(), poles + 1)); + + if (state.getMaterial().isReplaceable()) { + offset.setSecond(poles + 1); + return offset; + } + + //check the other end of the pole + offset.setFirst(offset.getFirst().getOpposite()); + poles = attachedPoles(world, pos, offset.getFirst()); + state = world.getBlockState(pos.offset(offset.getFirst(), poles + 1)); + + if (state.getMaterial().isReplaceable()) { + offset.setSecond(poles + 1); + } + + return offset; + } + + public static int attachedPoles(World world, BlockPos pos, Direction direction) { + BlockPos checkPos = pos.offset(direction); + BlockState state = world.getBlockState(checkPos); + int count = 0; + while (matchesAxis(state, direction.getAxis())) { + count++; + checkPos = checkPos.offset(direction); + state = world.getBlockState(checkPos); + } + return count; + } + + //checks if the given state is a piston pole on the given axis + public static boolean matchesAxis(BlockState state, Direction.Axis axis) { + return AllBlocks.PISTON_EXTENSION_POLE.has(state) && state.get(PistonExtensionPoleBlock.FACING).getAxis() == axis; + } + + public static boolean isHoldingPole(PlayerEntity player) { + return Arrays.stream(Hand.values()).anyMatch(hand -> AllBlocks.PISTON_EXTENSION_POLE.isIn(player.getHeldItem(hand))); + } + +} diff --git a/src/main/java/com/simibubi/create/content/contraptions/goggles/GoggleOverlayRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/goggles/GoggleOverlayRenderer.java index f3ee2f579..fcab3bcda 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/goggles/GoggleOverlayRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/goggles/GoggleOverlayRenderer.java @@ -1,19 +1,21 @@ package com.simibubi.create.content.contraptions.goggles; -import java.util.ArrayList; -import java.util.List; - import com.mojang.blaze3d.systems.RenderSystem; +import com.simibubi.create.AllBlocks; import com.simibubi.create.AllItems; +import com.simibubi.create.content.contraptions.components.structureMovement.piston.PistonExtensionPoleBlock; +import com.simibubi.create.content.contraptions.components.structureMovement.piston.PistonPolePlacementHelper; import com.simibubi.create.foundation.config.AllConfigs; import com.simibubi.create.foundation.gui.GuiGameElement; - +import com.simibubi.create.foundation.utility.Iterate; +import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.world.ClientWorld; import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.RayTraceResult; @@ -24,6 +26,11 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; +import java.util.ArrayList; +import java.util.List; + +import static com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation.spacing; + @EventBusSubscriber(value = Dist.CLIENT) public class GoggleOverlayRenderer { @@ -41,36 +48,52 @@ public class GoggleOverlayRenderer { Minecraft mc = Minecraft.getInstance(); ClientWorld world = mc.world; BlockPos pos = result.getPos(); - ItemStack goggles = mc.player.getItemStackFromSlot(EquipmentSlotType.HEAD); + ItemStack headSlot = mc.player.getItemStackFromSlot(EquipmentSlotType.HEAD); TileEntity te = world.getTileEntity(pos); - boolean goggleInformation = te instanceof IHaveGoggleInformation; - boolean hoveringInformation = te instanceof IHaveHoveringInformation; + boolean wearingGoggles = AllItems.GOGGLES.isIn(headSlot); - if (!goggleInformation && !hoveringInformation) - return; + boolean hasGoggleInformation = te instanceof IHaveGoggleInformation; + boolean hasHoveringInformation = te instanceof IHaveHoveringInformation; + + boolean goggleAddedInformation = false; + boolean hoverAddedInformation = false; List tooltip = new ArrayList<>(); - if (goggleInformation && AllItems.GOGGLES.isIn(goggles)) { + if (hasGoggleInformation && wearingGoggles) { IHaveGoggleInformation gte = (IHaveGoggleInformation) te; - if (!gte.addToGoggleTooltip(tooltip, mc.player.isSneaking())) - goggleInformation = false; + goggleAddedInformation = gte.addToGoggleTooltip(tooltip, mc.player.isSneaking()); } - if (hoveringInformation) { - boolean goggleAddedInformation = !tooltip.isEmpty(); - if (goggleAddedInformation) + if (hasHoveringInformation) { + if (!tooltip.isEmpty()) tooltip.add(""); IHaveHoveringInformation hte = (IHaveHoveringInformation) te; - if (!hte.addToTooltip(tooltip, mc.player.isSneaking())) - hoveringInformation = false; - if (goggleAddedInformation && !hoveringInformation) + hoverAddedInformation = hte.addToTooltip(tooltip, mc.player.isSneaking()); + + if (goggleAddedInformation && !hoverAddedInformation) tooltip.remove(tooltip.size() - 1); } - if (!goggleInformation && !hoveringInformation) + //break early if goggle or hover returned false when present + if ((hasGoggleInformation && !goggleAddedInformation) && (hasHoveringInformation && !hoverAddedInformation)) return; + + //check for piston poles if goggles are worn + BlockState state = world.getBlockState(pos); + if (wearingGoggles && AllBlocks.PISTON_EXTENSION_POLE.has(state)) { + Direction[] directions = Iterate.directionsInAxis(state.get(PistonExtensionPoleBlock.FACING).getAxis()); + int poles = 1; + for (Direction dir : directions) + poles += PistonPolePlacementHelper.attachedPoles(world, pos, dir); + + if (!tooltip.isEmpty()) + tooltip.add(""); + + tooltip.add(spacing + "Pole length: " + poles); + } + if (tooltip.isEmpty()) return; @@ -87,7 +110,6 @@ public class GoggleOverlayRenderer { GuiGameElement.of(item).at(posX + 10, posY - 16).render(); RenderSystem.popMatrix(); } - private static final class TooltipScreen extends Screen { private TooltipScreen(ITextComponent p_i51108_1_) { diff --git a/src/main/java/com/simibubi/create/content/logistics/block/inventories/CrateBlock.java b/src/main/java/com/simibubi/create/content/logistics/block/inventories/CrateBlock.java index 12ff27a6e..a54b6b92b 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/inventories/CrateBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/inventories/CrateBlock.java @@ -3,7 +3,6 @@ package com.simibubi.create.content.logistics.block.inventories; import com.simibubi.create.AllShapes; import com.simibubi.create.content.contraptions.wrench.IWrenchable; import com.simibubi.create.foundation.block.ProperDirectionalBlock; - import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.item.BlockItemUseContext; @@ -80,6 +79,11 @@ public class CrateBlock extends ProperDirectionalBlock implements IWrenchable { return getDefaultState(); } + @Override + public BlockState getRotatedBlockState(BlockState originalState, Direction targetedFace) { + return originalState; + } + @Override protected void fillStateContainer(Builder builder) { super.fillStateContainer(builder.add(DOUBLE)); diff --git a/src/main/java/com/simibubi/create/content/logistics/block/redstone/RedstoneContactBlock.java b/src/main/java/com/simibubi/create/content/logistics/block/redstone/RedstoneContactBlock.java index 5815f778b..a467c4cd4 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/redstone/RedstoneContactBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/redstone/RedstoneContactBlock.java @@ -1,14 +1,7 @@ package com.simibubi.create.content.logistics.block.redstone; -import java.util.Random; - -import javax.annotation.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; - import com.simibubi.create.AllBlocks; -import com.simibubi.create.content.contraptions.wrench.IWrenchable; import com.simibubi.create.foundation.block.ProperDirectionalBlock; - import mcp.MethodsReturnNonnullByDefault; import net.minecraft.block.Block; import net.minecraft.block.BlockState; @@ -23,9 +16,13 @@ import net.minecraft.world.IWorld; import net.minecraft.world.World; import net.minecraft.world.server.ServerWorld; +import javax.annotation.Nullable; +import javax.annotation.ParametersAreNonnullByDefault; +import java.util.Random; + @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault -public class RedstoneContactBlock extends ProperDirectionalBlock implements IWrenchable { +public class RedstoneContactBlock extends ProperDirectionalBlock { public static final BooleanProperty POWERED = BlockStateProperties.POWERED; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/redstone/RedstoneLinkBlock.java b/src/main/java/com/simibubi/create/content/logistics/block/redstone/RedstoneLinkBlock.java index bedc6d494..8d645f75b 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/redstone/RedstoneLinkBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/redstone/RedstoneLinkBlock.java @@ -2,12 +2,10 @@ package com.simibubi.create.content.logistics.block.redstone; import com.simibubi.create.AllShapes; import com.simibubi.create.AllTileEntities; -import com.simibubi.create.content.contraptions.wrench.IWrenchable; import com.simibubi.create.content.logistics.block.funnel.FunnelBlock; import com.simibubi.create.foundation.block.ITE; import com.simibubi.create.foundation.block.ProperDirectionalBlock; import com.simibubi.create.foundation.utility.Iterate; - import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; @@ -28,7 +26,7 @@ import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorldReader; import net.minecraft.world.World; -public class RedstoneLinkBlock extends ProperDirectionalBlock implements ITE, IWrenchable { +public class RedstoneLinkBlock extends ProperDirectionalBlock implements ITE { public static final BooleanProperty POWERED = BlockStateProperties.POWERED; public static final BooleanProperty RECEIVER = BooleanProperty.create("receiver"); @@ -152,7 +150,12 @@ public class RedstoneLinkBlock extends ProperDirectionalBlock implements ITE hereAndBelow(BlockPos pos) { return Arrays.asList(pos, pos.down()); } - - } From 0d9a6cc8c30e92c06ce4c4960ebd10e846d501de Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Tue, 24 Nov 2020 16:56:02 +0100 Subject: [PATCH 4/7] Tanks of Jank - Fluid tanks now attach the full multiblock when a part of them is moved by a contraption - Fluid tanks now rotate and mirror properly - Fluid tanks now react to movement properly - Creative fluid tanks no longer lose configured fluid when more tanks are added to it - Fluid tanks no longer render ghost fluids when placed with nbt - Fixed some inconsistencies with tanks distributing fluids when connecting/disconnecting in multiblocks - TileEntities are now being considered when rendering static blocks in a moving structure. Fixed brackets and tank blocks not rendering properly - Poles no longer display their length when used for decoration - Increased scope of caught exceptions when rendering modded tes in schematics and on contraptions --- .../BlockMovementTraits.java | 40 +++++++++----- .../structureMovement/Contraption.java | 11 +++- .../ContraptionRenderer.java | 1 + .../glue/SuperGlueEntity.java | 2 +- .../fluids/tank/FluidTankBlock.java | 53 +++++++++++++++++-- .../tank/FluidTankConnectivityHandler.java | 46 +++++++++++----- .../fluids/tank/FluidTankItem.java | 19 +++++++ .../fluids/tank/FluidTankTileEntity.java | 24 ++++++++- .../goggles/GoggleOverlayRenderer.java | 46 ++++++++++------ .../utility/TileEntityRenderHelper.java | 26 ++++----- .../PlacementSimulationWorld.java | 22 ++++++-- 11 files changed, 226 insertions(+), 64 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/BlockMovementTraits.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/BlockMovementTraits.java index 744444c12..941c91731 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/BlockMovementTraits.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/BlockMovementTraits.java @@ -19,6 +19,8 @@ import com.simibubi.create.content.contraptions.components.structureMovement.pis import com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock.PistonState; import com.simibubi.create.content.contraptions.components.structureMovement.pulley.PulleyBlock; import com.simibubi.create.content.contraptions.components.structureMovement.pulley.PulleyTileEntity; +import com.simibubi.create.content.contraptions.fluids.tank.FluidTankBlock; +import com.simibubi.create.content.contraptions.fluids.tank.FluidTankConnectivityHandler; import com.simibubi.create.content.logistics.block.redstone.RedstoneLinkBlock; import net.minecraft.block.AbstractPressurePlateBlock; @@ -45,6 +47,7 @@ import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockReader; import net.minecraft.world.World; public class BlockMovementTraits { @@ -55,9 +58,11 @@ public class BlockMovementTraits { return true; if (state.getBlock() instanceof FenceGateBlock) return true; - if (state.getMaterial().isReplaceable()) + if (state.getMaterial() + .isReplaceable()) return false; - if (state.getCollisionShape(world, pos).isEmpty()) + if (state.getCollisionShape(world, pos) + .isEmpty()) return false; return true; } @@ -104,7 +109,7 @@ public class BlockMovementTraits { Block block = state.getBlock(); if (state.has(BlockStateProperties.HANGING)) return true; - + if (block instanceof LadderBlock) return true; if (block instanceof TorchBlock) @@ -129,7 +134,8 @@ public class BlockMovementTraits { /** * Attached blocks will move if blocks they are attached to are moved */ - public static boolean isBlockAttachedTowards(BlockState state, Direction direction) { + public static boolean isBlockAttachedTowards(IBlockReader world, BlockPos pos, BlockState state, + Direction direction) { Block block = state.getBlock(); if (block instanceof LadderBlock) return state.get(LadderBlock.FACING) == direction.getOpposite(); @@ -167,23 +173,30 @@ public class BlockMovementTraits { if (block instanceof AbstractRailBlock) return direction == Direction.DOWN; if (block instanceof AttachedActorBlock) - return direction == state.get(HarvesterBlock.HORIZONTAL_FACING).getOpposite(); + return direction == state.get(HarvesterBlock.HORIZONTAL_FACING) + .getOpposite(); if (block instanceof HandCrankBlock) - return direction == state.get(HandCrankBlock.FACING).getOpposite(); + return direction == state.get(HandCrankBlock.FACING) + .getOpposite(); if (block instanceof NozzleBlock) - return direction == state.get(NozzleBlock.FACING).getOpposite(); + return direction == state.get(NozzleBlock.FACING) + .getOpposite(); if (block instanceof EngineBlock) - return direction == state.get(EngineBlock.HORIZONTAL_FACING).getOpposite(); + return direction == state.get(EngineBlock.HORIZONTAL_FACING) + .getOpposite(); if (block instanceof BellBlock) { BellAttachment attachment = state.get(BlockStateProperties.BELL_ATTACHMENT); - if (attachment == BellAttachment.FLOOR) + if (attachment == BellAttachment.FLOOR) return direction == Direction.DOWN; - if (attachment == BellAttachment.CEILING) + if (attachment == BellAttachment.CEILING) return direction == Direction.UP; return direction == state.get(HorizontalBlock.HORIZONTAL_FACING); } if (state.getBlock() instanceof SailBlock) - return direction.getAxis() != state.get(SailBlock.FACING).getAxis(); + return direction.getAxis() != state.get(SailBlock.FACING) + .getAxis(); + if (state.getBlock() instanceof FluidTankBlock) + return FluidTankConnectivityHandler.isConnected(world, pos, pos.offset(direction)); return false; } @@ -209,8 +222,9 @@ public class BlockMovementTraits { if (state.getBlock() instanceof CarpetBlock) return facing == Direction.UP; if (state.getBlock() instanceof SailBlock) - return facing.getAxis() == state.get(SailBlock.FACING).getAxis(); + return facing.getAxis() == state.get(SailBlock.FACING) + .getAxis(); return isBrittle(state); } - + } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java index f0d5cff5f..0f544f1cc 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java @@ -39,6 +39,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.pul import com.simibubi.create.content.contraptions.components.structureMovement.pulley.PulleyBlock.MagnetBlock; import com.simibubi.create.content.contraptions.components.structureMovement.pulley.PulleyBlock.RopeBlock; import com.simibubi.create.content.contraptions.components.structureMovement.pulley.PulleyTileEntity; +import com.simibubi.create.content.contraptions.fluids.tank.FluidTankTileEntity; import com.simibubi.create.content.contraptions.relays.belt.BeltBlock; import com.simibubi.create.content.logistics.block.inventories.AdjustableCrateBlock; import com.simibubi.create.content.logistics.block.redstone.RedstoneContactBlock; @@ -288,7 +289,7 @@ public abstract class Contraption { boolean wasVisited = visited.contains(offsetPos); boolean faceHasGlue = superglue.containsKey(offset); boolean blockAttachedTowardsFace = - BlockMovementTraits.isBlockAttachedTowards(blockState, offset.getOpposite()); + BlockMovementTraits.isBlockAttachedTowards(world, offsetPos, blockState, offset.getOpposite()); boolean brittle = BlockMovementTraits.isBrittle(blockState); if (!wasVisited && ((isSlimeBlock && !brittle) || blockAttachedTowardsFace || faceHasGlue)) @@ -461,6 +462,11 @@ public abstract class Contraption { nbt.remove("x"); nbt.remove("y"); nbt.remove("z"); + + if (tileentity instanceof FluidTankTileEntity && nbt.contains("Controller")) + nbt.put("Controller", + NBTUtil.writeBlockPos(toLocalPos(NBTUtil.readBlockPos(nbt.getCompound("Controller"))))); + return nbt; } @@ -734,6 +740,9 @@ public abstract class Contraption { tag.remove("InitialOffset"); } + if (tileEntity instanceof FluidTankTileEntity && tag.contains("LastKnownPos")) + tag.put("LastKnownPos", NBTUtil.writeBlockPos(BlockPos.ZERO.down())); + tileEntity.read(tag); if (storage.containsKey(block.pos)) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionRenderer.java index 1308d6270..ac1093e1b 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionRenderer.java @@ -86,6 +86,7 @@ public class ContraptionRenderer { Random random = new Random(); BufferBuilder builder = new BufferBuilder(DefaultVertexFormats.BLOCK.getIntegerSize()); builder.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); + renderWorld.setTileEntities(c.renderedTileEntities); for (BlockInfo info : c.getBlocks().values()) renderWorld.setBlockState(info.pos, info.state); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueEntity.java index 4a197308f..d4a6f9b65 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueEntity.java @@ -176,7 +176,7 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat public static boolean isValidFace(World world, BlockPos pos, Direction direction) { BlockState state = world.getBlockState(pos); - if (BlockMovementTraits.isBlockAttachedTowards(state, direction)) + if (BlockMovementTraits.isBlockAttachedTowards(world, pos, state, direction)) return true; if (!BlockMovementTraits.movementNecessary(world, pos)) return false; diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankBlock.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankBlock.java index c77744f36..7a8346118 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankBlock.java @@ -28,6 +28,8 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ActionResultType; import net.minecraft.util.Hand; import net.minecraft.util.IStringSerializable; +import net.minecraft.util.Mirror; +import net.minecraft.util.Rotation; import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundEvent; import net.minecraft.util.SoundEvents; @@ -41,6 +43,7 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.fluids.FluidAttributes; import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; public class FluidTankBlock extends Block implements IWrenchable, ITE { @@ -72,9 +75,11 @@ public class FluidTankBlock extends Block implements IWrenchable, ITE tankCapability = te.fluidCapability; + LazyOptional tankCapability = te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY); if (!tankCapability.isPresent()) return ActionResultType.PASS; IFluidHandler fluidTank = tankCapability.orElse(null); @@ -142,7 +147,8 @@ public class FluidTankBlock extends Block implements IWrenchable, ITE type = te.getType(); World world = te.getWorld(); BlockPos origin = te.getPos(); - FluidStack fluid = te.getTankInventory() - .getFluid(); + LazyOptional capability = te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY); + FluidTank teTank = (FluidTank) capability.orElse(null); + FluidStack fluid = capability.map(ifh -> ifh.getFluidInTank(0)) + .orElse(FluidStack.EMPTY); Search: @@ -192,6 +199,8 @@ public class FluidTankConnectivityHandler { if (simulate) return amount; + + boolean opaque = false; for (int yOffset = 0; yOffset < height; yOffset++) { for (int xOffset = 0; xOffset < width; xOffset++) { @@ -201,10 +210,15 @@ public class FluidTankConnectivityHandler { if (tank == te) continue; - if (tank.isController()) { - te.tankInventory.fill(tank.tankInventory.getFluid(), FluidAction.EXECUTE); - tank.tankInventory.setFluid(FluidStack.EMPTY); + opaque |= !tank.window; + FluidTank tankTank = tank.tankInventory; + FluidStack fluidInTank = tankTank.getFluid(); + if (!fluidInTank.isEmpty()) { + if (teTank.isEmpty() && teTank instanceof CreativeSmartFluidTank) + ((CreativeSmartFluidTank) teTank).setContainedFluid(fluidInTank); + teTank.fill(fluidInTank, FluidAction.EXECUTE); } + tankTank.setFluid(FluidStack.EMPTY); splitTankAndInvalidate(tank, cache, false); tank.setController(origin); @@ -220,6 +234,8 @@ public class FluidTankConnectivityHandler { } } } + + te.setWindows(!opaque); return amount; } @@ -243,8 +259,9 @@ public class FluidTankConnectivityHandler { FluidStack toDistribute = te.tankInventory.getFluid() .copy(); int maxCapacity = FluidTankTileEntity.getCapacityMultiplier(); - if (!toDistribute.isEmpty()) + if (!toDistribute.isEmpty() && !te.isRemoved()) toDistribute.shrink(maxCapacity); + te.applyFluidTankSize(1); for (int yOffset = 0; yOffset < height; yOffset++) { for (int xOffset = 0; xOffset < width; xOffset++) { @@ -259,14 +276,19 @@ public class FluidTankConnectivityHandler { continue; FluidTankTileEntity controllerTE = tankAt.getControllerTE(); tankAt.window = controllerTE == null || controllerTE.window; - tankAt.removeController(); + tankAt.removeController(true); if (!toDistribute.isEmpty() && tankAt != te) { - int split = Math.min(maxCapacity, toDistribute.getAmount()); FluidStack copy = toDistribute.copy(); - copy.setAmount(split); - toDistribute.shrink(split); - tankAt.tankInventory.fill(copy, FluidAction.EXECUTE); + FluidTank tankInventory = tankAt.tankInventory; + if (tankInventory.isEmpty() && tankInventory instanceof CreativeSmartFluidTank) + ((CreativeSmartFluidTank) tankInventory).setContainedFluid(toDistribute); + else { + int split = Math.min(maxCapacity, toDistribute.getAmount()); + copy.setAmount(split); + toDistribute.shrink(split); + tankInventory.fill(copy, FluidAction.EXECUTE); + } } if (tryReconnect) { @@ -300,7 +322,7 @@ public class FluidTankConnectivityHandler { return (FluidTankTileEntity) te; return null; } - + @Nullable public static FluidTankTileEntity anyTankAt(IBlockReader world, BlockPos pos) { TileEntity te = world.getTileEntity(pos); diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankItem.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankItem.java index 9dfc502dc..d126ac868 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankItem.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankItem.java @@ -6,6 +6,8 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.BlockItem; import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.server.MinecraftServer; import net.minecraft.util.ActionResultType; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; @@ -26,6 +28,23 @@ public class FluidTankItem extends BlockItem { return initialResult; } + @Override + protected boolean onBlockPlaced(BlockPos p_195943_1_, World p_195943_2_, PlayerEntity p_195943_3_, + ItemStack p_195943_4_, BlockState p_195943_5_) { + MinecraftServer minecraftserver = p_195943_2_.getServer(); + if (minecraftserver == null) + return false; + CompoundNBT nbt = p_195943_4_.getChildTag("BlockEntityTag"); + if (nbt != null) { + nbt.remove("Luminosity"); + nbt.remove("Size"); + nbt.remove("Height"); + nbt.remove("Controller"); + nbt.remove("LastKnownPos"); + } + return super.onBlockPlaced(p_195943_1_, p_195943_2_, p_195943_3_, p_195943_4_, p_195943_5_); + } + private void tryMultiPlace(BlockItemUseContext ctx) { PlayerEntity player = ctx.getPlayer(); if (player == null) diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankTileEntity.java index 469a34954..88717fd1a 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankTileEntity.java @@ -42,6 +42,7 @@ public class FluidTankTileEntity extends SmartTileEntity { protected boolean forceFluidLevelUpdate; protected FluidTank tankInventory; protected BlockPos controller; + protected BlockPos lastKnownPos; protected boolean updateConnectivity; protected boolean window; protected int luminosity; @@ -88,6 +89,14 @@ public class FluidTankTileEntity extends SmartTileEntity { if (syncCooldown == 0 && queuedSync) sendData(); } + + if (lastKnownPos == null) + lastKnownPos = getPos(); + else if (!lastKnownPos.equals(pos) && pos != null) { + onPositionChanged(); + return; + } + if (updateConnectivity) updateConnectivity(); if (fluidLevel != null) @@ -104,6 +113,11 @@ public class FluidTankTileEntity extends SmartTileEntity { sendData(); } + private void onPositionChanged() { + removeController(true); + lastKnownPos = pos; + } + protected void onFluidStackChanged(FluidStack newFluidStack) { if (!hasWorld()) return; @@ -163,11 +177,12 @@ public class FluidTankTileEntity extends SmartTileEntity { forceFluidLevelUpdate = true; } - public void removeController() { + public void removeController(boolean keepFluids) { if (world.isRemote) return; updateConnectivity = true; - applyFluidTankSize(1); + if (!keepFluids) + applyFluidTankSize(1); controller = null; width = 1; height = 1; @@ -292,7 +307,10 @@ public class FluidTankTileEntity extends SmartTileEntity { updateConnectivity = compound.contains("Uninitialized"); luminosity = compound.getInt("Luminosity"); controller = null; + lastKnownPos = null; + if (compound.contains("LastKnownPos")) + lastKnownPos = NBTUtil.readBlockPos(compound.getCompound("LastKnownPos")); if (compound.contains("Controller")) controller = NBTUtil.readBlockPos(compound.getCompound("Controller")); @@ -344,6 +362,8 @@ public class FluidTankTileEntity extends SmartTileEntity { public void write(CompoundNBT compound, boolean clientPacket) { if (updateConnectivity) compound.putBoolean("Uninitialized", true); + if (lastKnownPos != null) + compound.put("LastKnownPos", NBTUtil.writeBlockPos(lastKnownPos)); if (!isController()) compound.put("Controller", NBTUtil.writeBlockPos(controller)); if (isController()) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/goggles/GoggleOverlayRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/goggles/GoggleOverlayRenderer.java index fcab3bcda..8d428ac5e 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/goggles/GoggleOverlayRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/goggles/GoggleOverlayRenderer.java @@ -1,13 +1,20 @@ package com.simibubi.create.content.contraptions.goggles; +import static com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation.spacing; + +import java.util.ArrayList; +import java.util.List; + import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.AllBlocks; import com.simibubi.create.AllItems; +import com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock; import com.simibubi.create.content.contraptions.components.structureMovement.piston.PistonExtensionPoleBlock; import com.simibubi.create.content.contraptions.components.structureMovement.piston.PistonPolePlacementHelper; import com.simibubi.create.foundation.config.AllConfigs; import com.simibubi.create.foundation.gui.GuiGameElement; import com.simibubi.create.foundation.utility.Iterate; + import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screen.Screen; @@ -26,15 +33,9 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; -import java.util.ArrayList; -import java.util.List; - -import static com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation.spacing; - @EventBusSubscriber(value = Dist.CLIENT) public class GoggleOverlayRenderer { - @SubscribeEvent public static void lookingAtBlocksThroughGogglesShowsTooltip(RenderGameOverlayEvent.Post event) { if (event.getType() != ElementType.HOTBAR) @@ -76,18 +77,26 @@ public class GoggleOverlayRenderer { tooltip.remove(tooltip.size() - 1); } - //break early if goggle or hover returned false when present + // break early if goggle or hover returned false when present if ((hasGoggleInformation && !goggleAddedInformation) && (hasHoveringInformation && !hoverAddedInformation)) return; - //check for piston poles if goggles are worn + // check for piston poles if goggles are worn BlockState state = world.getBlockState(pos); if (wearingGoggles && AllBlocks.PISTON_EXTENSION_POLE.has(state)) { - Direction[] directions = Iterate.directionsInAxis(state.get(PistonExtensionPoleBlock.FACING).getAxis()); + Direction[] directions = Iterate.directionsInAxis(state.get(PistonExtensionPoleBlock.FACING) + .getAxis()); int poles = 1; - for (Direction dir : directions) - poles += PistonPolePlacementHelper.attachedPoles(world, pos, dir); + boolean pistonFound = false; + for (Direction dir : directions) { + int attachedPoles = PistonPolePlacementHelper.attachedPoles(world, pos, dir); + poles += attachedPoles; + pistonFound |= world.getBlockState(pos.offset(dir, attachedPoles + 1)) + .getBlock() instanceof MechanicalPistonBlock; + } + if (!pistonFound) + return; if (!tooltip.isEmpty()) tooltip.add(""); @@ -99,15 +108,22 @@ public class GoggleOverlayRenderer { RenderSystem.pushMatrix(); Screen tooltipScreen = new TooltipScreen(null); - tooltipScreen.init(mc, mc.getWindow().getScaledWidth(), mc.getWindow().getScaledHeight()); + tooltipScreen.init(mc, mc.getWindow() + .getScaledWidth(), + mc.getWindow() + .getScaledHeight()); int posX = tooltipScreen.width / 2 + AllConfigs.CLIENT.overlayOffsetX.get(); int posY = tooltipScreen.height / 2 + AllConfigs.CLIENT.overlayOffsetY.get(); - //tooltipScreen.renderTooltip(tooltip, tooltipScreen.width / 2, tooltipScreen.height / 2); + // tooltipScreen.renderTooltip(tooltip, tooltipScreen.width / 2, + // tooltipScreen.height / 2); tooltipScreen.renderTooltip(tooltip, posX, posY); ItemStack item = AllItems.GOGGLES.asStack(); - //GuiGameElement.of(item).at(tooltipScreen.width / 2 + 10, tooltipScreen.height / 2 - 16).render(); - GuiGameElement.of(item).at(posX + 10, posY - 16).render(); + // GuiGameElement.of(item).at(tooltipScreen.width / 2 + 10, tooltipScreen.height + // / 2 - 16).render(); + GuiGameElement.of(item) + .at(posX + 10, posY - 16) + .render(); RenderSystem.popMatrix(); } diff --git a/src/main/java/com/simibubi/create/foundation/utility/TileEntityRenderHelper.java b/src/main/java/com/simibubi/create/foundation/utility/TileEntityRenderHelper.java index 1f8a3150c..ea9e6e361 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/TileEntityRenderHelper.java +++ b/src/main/java/com/simibubi/create/foundation/utility/TileEntityRenderHelper.java @@ -14,20 +14,19 @@ import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; -import net.minecraft.crash.ReportedException; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class TileEntityRenderHelper { - + public static void renderTileEntities(World world, Iterable customRenderTEs, MatrixStack ms, MatrixStack localTransform, IRenderTypeBuffer buffer) { float pt = Minecraft.getInstance() .getRenderPartialTicks(); Matrix4f matrix = localTransform.peek() .getModel(); - + for (Iterator iterator = customRenderTEs.iterator(); iterator.hasNext();) { TileEntity tileEntity = iterator.next(); TileEntityRenderer renderer = TileEntityRendererDispatcher.instance.getRenderer(tileEntity); @@ -49,17 +48,18 @@ public class TileEntityRenderHelper { OverlayTexture.DEFAULT_UV); ms.pop(); - } catch (ReportedException e) { - if (AllConfigs.CLIENT.explainRenderErrors.get()) { - Create.logger.error("TileEntity " + tileEntity.getType() - .getRegistryName() - .toString() + " didn't want to render while moved.\n", e); - } else { - Create.logger.error("TileEntity " + tileEntity.getType() - .getRegistryName() - .toString() + " didn't want to render while moved.\n"); - } + } catch (Exception e) { iterator.remove(); + + String message = "TileEntity " + tileEntity.getType() + .getRegistryName() + .toString() + " didn't want to render while moved.\n"; + if (AllConfigs.CLIENT.explainRenderErrors.get()) { + Create.logger.error(message, e); + continue; + } + + Create.logger.error(message); continue; } } diff --git a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/PlacementSimulationWorld.java b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/PlacementSimulationWorld.java index c01cc95c6..ee209d16f 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/PlacementSimulationWorld.java +++ b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/PlacementSimulationWorld.java @@ -1,21 +1,30 @@ package com.simibubi.create.foundation.utility.worldWrappers; +import java.util.Collection; import java.util.HashMap; import java.util.function.Predicate; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; +import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class PlacementSimulationWorld extends WrappedWorld { public HashMap blocksAdded; + public HashMap tesAdded; public PlacementSimulationWorld(World wrapped) { super(wrapped); blocksAdded = new HashMap<>(); + tesAdded = new HashMap<>(); } - + + public void setTileEntities(Collection tileEntities) { + tesAdded.clear(); + tileEntities.forEach(te -> tesAdded.put(te.getPos(), te)); + } + public void clear() { blocksAdded.clear(); } @@ -31,16 +40,21 @@ public class PlacementSimulationWorld extends WrappedWorld { return setBlockState(pos, state, 0); } + @Override + public TileEntity getTileEntity(BlockPos pos) { + return tesAdded.get(pos); + } + @Override public boolean hasBlockState(BlockPos pos, Predicate condition) { return condition.test(getBlockState(pos)); } - + @Override public boolean isBlockPresent(BlockPos pos) { return true; } - + @Override public boolean isAreaLoaded(BlockPos center, int range) { return true; @@ -52,5 +66,5 @@ public class PlacementSimulationWorld extends WrappedWorld { return blocksAdded.get(pos); return Blocks.AIR.getDefaultState(); } - + } From 8ff98dc3fb3f9fe63c79af0cd394dcc53a25e5fd Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Wed, 25 Nov 2020 18:54:59 +0100 Subject: [PATCH 5/7] Fluid Delivery - Fluid Tanks and Creative Fluid Tanks now form a combined fluid inventory on contraptions - Added the Portable Fluid Interface - Fixed tanks placed with nbt not clamping their contained fluids - Item Storage information on Contraptions no longer get sent to the client - Combined fluid storage synchronizes to the client and applies new contents to the corresponding mounted TE renderers - Fixed motion of dripping potion particles from fluid pipe flow indication - Portable Storage interfaces now interrupt their connection when receiving redstone power --- src/generated/resources/.cache/cache | 31 ++-- .../assets/create/blockstates/fluid_pipe.json | 22 +-- .../blockstates/portable_fluid_interface.json | 30 ++++ .../resources/assets/create/lang/en_ud.json | 1 + .../resources/assets/create/lang/en_us.json | 1 + .../assets/create/lang/unfinished/de_de.json | 3 +- .../assets/create/lang/unfinished/fr_fr.json | 3 +- .../assets/create/lang/unfinished/it_it.json | 3 +- .../assets/create/lang/unfinished/ja_jp.json | 3 +- .../assets/create/lang/unfinished/ko_kr.json | 3 +- .../assets/create/lang/unfinished/nl_nl.json | 3 +- .../assets/create/lang/unfinished/pt_br.json | 3 +- .../assets/create/lang/unfinished/ru_ru.json | 3 +- .../assets/create/lang/unfinished/zh_cn.json | 3 +- .../models/item/portable_fluid_interface.json | 3 + .../kinetics/portable_fluid_interface.json | 32 ++++ .../blocks/portable_fluid_interface.json | 19 ++ .../kinetics/portable_fluid_interface.json | 18 ++ .../kinetics/portable_storage_interface.json | 2 +- .../com/simibubi/create/AllBlockPartials.java | 4 + .../java/com/simibubi/create/AllBlocks.java | 11 +- .../com/simibubi/create/AllTileEntities.java | 13 +- .../PortableFluidInterfaceTileEntity.java | 113 ++++++++++++ .../PortableItemInterfaceTileEntity.java | 78 +++++++++ .../actors/PortableStorageInterfaceBlock.java | 30 +++- .../PortableStorageInterfaceMovement.java | 18 +- .../PortableStorageInterfaceRenderer.java | 28 ++- .../PortableStorageInterfaceTileEntity.java | 98 +++++------ .../AbstractContraptionEntity.java | 45 +++-- .../structureMovement/Contraption.java | 87 +++++++-- .../ContraptionRenderer.java | 10 +- .../ControlledContraptionEntity.java | 8 +- .../MountedFluidStorage.java | 165 ++++++++++++++++++ .../structureMovement/MountedStorage.java | 2 +- .../OrientedContraptionEntity.java | 8 +- .../bearing/BearingContraption.java | 8 +- .../bearing/ClockworkContraption.java | 8 +- .../bearing/StabilizedContraption.java | 8 +- .../mounted/MinecartContraptionItem.java | 8 +- .../mounted/MountedContraption.java | 12 +- .../piston/PistonContraption.java | 16 +- .../pulley/PulleyContraption.java | 12 +- .../sync/ContraptionFluidPacket.java | 53 ++++++ .../content/contraptions/fluids/FluidFX.java | 2 +- .../tank/CreativeFluidTankTileEntity.java | 4 +- .../fluids/tank/FluidTankItem.java | 8 + .../fluids/tank/FluidTankTileEntity.java | 12 +- .../processing/BasinMovementBehaviour.java | 8 +- .../data/recipe/StandardRecipeGen.java | 8 +- .../foundation/networking/AllPackets.java | 2 + .../block/portable_fluid_interface/block.json | 8 + .../block_middle.json | 6 + .../block_middle_powered.json | 6 + .../portable_fluid_interface/block_top.json | 6 + .../block/portable_fluid_interface/item.json | 7 + .../brass_casing.png | Bin 432 -> 0 bytes .../portable_storage_interface.bbmodel | 1 - .../portable_storage_interface.png | Bin 4142 -> 0 bytes .../block/portable_fluid_interface.png | Bin 0 -> 822 bytes 59 files changed, 901 insertions(+), 206 deletions(-) create mode 100644 src/generated/resources/assets/create/blockstates/portable_fluid_interface.json create mode 100644 src/generated/resources/assets/create/models/item/portable_fluid_interface.json create mode 100644 src/generated/resources/data/create/advancements/recipes/create.base/crafting/kinetics/portable_fluid_interface.json create mode 100644 src/generated/resources/data/create/loot_tables/blocks/portable_fluid_interface.json create mode 100644 src/generated/resources/data/create/recipes/crafting/kinetics/portable_fluid_interface.json create mode 100644 src/main/java/com/simibubi/create/content/contraptions/components/actors/PortableFluidInterfaceTileEntity.java create mode 100644 src/main/java/com/simibubi/create/content/contraptions/components/actors/PortableItemInterfaceTileEntity.java create mode 100644 src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/sync/ContraptionFluidPacket.java create mode 100644 src/main/resources/assets/create/models/block/portable_fluid_interface/block.json create mode 100644 src/main/resources/assets/create/models/block/portable_fluid_interface/block_middle.json create mode 100644 src/main/resources/assets/create/models/block/portable_fluid_interface/block_middle_powered.json create mode 100644 src/main/resources/assets/create/models/block/portable_fluid_interface/block_top.json create mode 100644 src/main/resources/assets/create/models/block/portable_fluid_interface/item.json delete mode 100644 src/main/resources/assets/create/models/block/portable_storage_interface/brass_casing.png delete mode 100644 src/main/resources/assets/create/models/block/portable_storage_interface/portable_storage_interface.bbmodel delete mode 100644 src/main/resources/assets/create/models/block/portable_storage_interface/portable_storage_interface.png create mode 100644 src/main/resources/assets/create/textures/block/portable_fluid_interface.png diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index caa157bcd..b6479389a 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -137,7 +137,7 @@ de8a40b7daf1497d5aecee47a43b3e0b1d030b00 assets/create/blockstates/fancy_scoria_ fc9ac0a7e7191b93516719455a17177fa6524ecc assets/create/blockstates/fancy_weathered_limestone_bricks_slab.json b2a7c321b1795f20e7433f81a55ce4683de081b8 assets/create/blockstates/fancy_weathered_limestone_bricks_stairs.json 6372fe02ba0065acb0758121c45a15a1a8fdc5de assets/create/blockstates/fancy_weathered_limestone_bricks_wall.json -3d97226b5e8d8f70ed08e45e78db1faf78d5e28b assets/create/blockstates/fluid_pipe.json +fe9169716dd21a81a3710a89f0a9b7ea4dcd4d51 assets/create/blockstates/fluid_pipe.json f0eaab18e16c4f3f65ebf3b55b08f0dc445720fe assets/create/blockstates/fluid_tank.json 5408d92ab02af86539ac42971d4033545970bb3a assets/create/blockstates/fluid_valve.json e9da1794b6ece7f9aa8bcb43d42c23a55446133b assets/create/blockstates/flywheel.json @@ -322,6 +322,7 @@ c8467d55bc22d2e2256b8b732c06c9fdc64d336f assets/create/blockstates/polished_weat 5d811eab3c5e8411f98e2ea98d93d35955ce18fc assets/create/blockstates/polished_weathered_limestone_slab.json acec6cdebe772ca72de94a85d98199e827495acb assets/create/blockstates/polished_weathered_limestone_stairs.json f42ad32aefcfa7ccc6287f57ee1a5f092b65126f assets/create/blockstates/polished_weathered_limestone_wall.json +3bb571d0a2597907bf3a30686b4bfa0841ac990a assets/create/blockstates/portable_fluid_interface.json 1b70b4e5792dccd2110b84e209016ac258005e28 assets/create/blockstates/portable_storage_interface.json 8296d43d5f1c2113012d127038fb319af83aaee4 assets/create/blockstates/powered_latch.json e8b0a401c10d1ba67ed71ba31bd5f9bc28571b65 assets/create/blockstates/powered_toggle_latch.json @@ -392,17 +393,17 @@ a3a11524cd3515fc01d905767b4b7ea782adaf03 assets/create/blockstates/yellow_seat.j 6801fa1f466f172700e573e5b8ee8ee5f9ca4583 assets/create/blockstates/yellow_valve_handle.json 7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json -04f295b9cbe610bb3664e956437ae68d2a0776ad assets/create/lang/en_ud.json -3912eddc0fdb76afe08961c9d9ad9fe776fbbef5 assets/create/lang/en_us.json -66e50a9482f186f3b0b066bcc7a8d6194b5892b4 assets/create/lang/unfinished/de_de.json -d0adae002c2ca46ad24d4f08037308334c239c69 assets/create/lang/unfinished/fr_fr.json -98b6589d85a68eb4460a7d2da96816b026436c14 assets/create/lang/unfinished/it_it.json -9a9477f8257367993760fbc9e4b65a2d8190b868 assets/create/lang/unfinished/ja_jp.json -e9e466d962ccba589d6d14e37c82e98076a3e614 assets/create/lang/unfinished/ko_kr.json -9e8277f247b069bb45fd45b086a5138ec160847f assets/create/lang/unfinished/nl_nl.json -707ec25a7f45dd3dca8b96d4031b38d1be64f840 assets/create/lang/unfinished/pt_br.json -f645e781db3e254d64ea4b20a553e713bfca3610 assets/create/lang/unfinished/ru_ru.json -1e8a48a6ba2d7ec7947c312835c332e869757526 assets/create/lang/unfinished/zh_cn.json +67f9a92292948241e01ce6043445b2b3ddcf5350 assets/create/lang/en_ud.json +ea9f7788b7cae3ddd4ba1ae74c54f558d6b3f584 assets/create/lang/en_us.json +d2741d202f1b76c0c57fbd25d5f35cfab258edb0 assets/create/lang/unfinished/de_de.json +ce08c4a4163e667a5c20dfd241cb56b0ff5d064e assets/create/lang/unfinished/fr_fr.json +6fe663867f28389fdac5ac75a12089ca7279a0cb assets/create/lang/unfinished/it_it.json +28b1bbb303a20f43266ae089b5d8b920523ee854 assets/create/lang/unfinished/ja_jp.json +cfc50d41b77b5dfeb49da61b95496a65b3d71169 assets/create/lang/unfinished/ko_kr.json +9f9e817483a92c960db5a6cdd30e0c9e0ac0b2f3 assets/create/lang/unfinished/nl_nl.json +6d638fa512c863203ff7207c9a68782ba4fd9997 assets/create/lang/unfinished/pt_br.json +0dc96a32325dc79e7f0cf980a7011475aa22ecc3 assets/create/lang/unfinished/ru_ru.json +311937a993d6c186ba4c433cd7befca8e4da6d89 assets/create/lang/unfinished/zh_cn.json 846200eb548d3bfa2e77b41039de159b4b6cfb45 assets/create/models/block/acacia_window.json 1930fa3a3c98d53dd19e4ee7f55bc27fd47aa281 assets/create/models/block/acacia_window_pane_noside.json 1763ea2c9b981d187f5031ba608f3d5d3be3986a assets/create/models/block/acacia_window_pane_noside_alt.json @@ -1438,6 +1439,7 @@ e95125318055b8557afd7d108488cf0bdd81fe49 assets/create/models/item/polished_scor 68fb04f7a89c8117bb641e347df9bfc1f1248335 assets/create/models/item/polished_weathered_limestone_slab.json 6d92ee7112aa20e8a1adfe73d8933031c299bed1 assets/create/models/item/polished_weathered_limestone_stairs.json b4995fb4799f33508cd6bf2ded80c0b3e866ad43 assets/create/models/item/polished_weathered_limestone_wall.json +0e5638cdbf04d7af2222ec15fbe1d960385ea237 assets/create/models/item/portable_fluid_interface.json 3bc60b0d9884c2ee0f1dd530e90fceb699eea737 assets/create/models/item/portable_storage_interface.json d3cfc1a1137c4bc98848947d425d2972df144c95 assets/create/models/item/powdered_obsidian.json 1e501c1f2e9250aaaadcf17db62646d08177d4e1 assets/create/models/item/powered_latch.json @@ -1652,6 +1654,7 @@ ccd49c33260333ba850d0b843c4913cb6371eee9 data/create/advancements/recipes/create ca21e2192a2fea0f112764f96c928d337762158b data/create/advancements/recipes/create.base/crafting/kinetics/pink_seat_from_other_seat.json 6c11444884679c4dd03d43f5893fca5cdc271915 data/create/advancements/recipes/create.base/crafting/kinetics/pink_valve_handle_from_other_valve_handle.json 960d03f13b383fca0d9b7d3a2885da346d97c4ef data/create/advancements/recipes/create.base/crafting/kinetics/piston_extension_pole.json +164563947ebd951d36a839ee0787714b104ba090 data/create/advancements/recipes/create.base/crafting/kinetics/portable_fluid_interface.json 3190b3800152879614127c7cd2616e5607f1a0b1 data/create/advancements/recipes/create.base/crafting/kinetics/portable_storage_interface.json 02258b70f1db3d91f0ccb5a5ffd362349f8f359d data/create/advancements/recipes/create.base/crafting/kinetics/propeller.json d2a430820a87c24104729eede57628c6a92b277e data/create/advancements/recipes/create.base/crafting/kinetics/purple_seat.json @@ -2465,6 +2468,7 @@ c7029af40b6f5dd2cd8f2ae7dfb89b37074624e6 data/create/loot_tables/blocks/polished 93f7be402a8088d33a94954572e111bcd71f11c8 data/create/loot_tables/blocks/polished_weathered_limestone_slab.json 6ef650c723d409c7a678ffac45212e22e37581c0 data/create/loot_tables/blocks/polished_weathered_limestone_stairs.json 58715bc033e4740dbb754f91c93a22b9d06828e6 data/create/loot_tables/blocks/polished_weathered_limestone_wall.json +ac945ab9e78d52daff38b9c288824ec6f643b23a data/create/loot_tables/blocks/portable_fluid_interface.json fbe98efcb1a5970b6795fdbbb671fee704c0945f data/create/loot_tables/blocks/portable_storage_interface.json 6a46f00d9de7050eb9748d5dbed182caa6b29949 data/create/loot_tables/blocks/powered_latch.json a3fb7d3e3bf9dc73ce754002f10c469d57db1f71 data/create/loot_tables/blocks/powered_toggle_latch.json @@ -2664,7 +2668,8 @@ af871a02d363a619fff8e9dde753aa417b265a80 data/create/recipes/crafting/kinetics/p 840dc5aac716e3d1b79883e8db4bf56f2dc427f9 data/create/recipes/crafting/kinetics/pink_seat_from_other_seat.json 7e73bcde2b599f1ae5a241dd707c8ab6ce8c5a6e data/create/recipes/crafting/kinetics/pink_valve_handle_from_other_valve_handle.json 5399c3496a90bed9428c48fdd334ad4f763cbf9a data/create/recipes/crafting/kinetics/piston_extension_pole.json -0b09786f6d9823c6eddc91c3a6837377690dde49 data/create/recipes/crafting/kinetics/portable_storage_interface.json +a8e996bed77d3d20725f9d592c250392b3adb106 data/create/recipes/crafting/kinetics/portable_fluid_interface.json +7ed5699349faf2981228769c873057105a5ea3ea data/create/recipes/crafting/kinetics/portable_storage_interface.json 16199a6729005a279854cb1838401f6e73bdebae data/create/recipes/crafting/kinetics/propeller.json 76ba751b65d312d1b34229d76fff2111b593091a data/create/recipes/crafting/kinetics/purple_seat.json e6c462d64e1de9c7fca95f9c9a25b8d1575979da data/create/recipes/crafting/kinetics/purple_seat_from_other_seat.json diff --git a/src/generated/resources/assets/create/blockstates/fluid_pipe.json b/src/generated/resources/assets/create/blockstates/fluid_pipe.json index a4cffcde7..3b646b920 100644 --- a/src/generated/resources/assets/create/blockstates/fluid_pipe.json +++ b/src/generated/resources/assets/create/blockstates/fluid_pipe.json @@ -303,8 +303,8 @@ { "when": { "west": "false", - "down": "false", "east": "true", + "down": "false", "up": "true" }, "apply": { @@ -314,8 +314,8 @@ { "when": { "west": "true", - "down": "false", "east": "false", + "down": "false", "up": "true" }, "apply": { @@ -325,8 +325,8 @@ { "when": { "west": "false", - "down": "true", "east": "true", + "down": "true", "up": "false" }, "apply": { @@ -336,8 +336,8 @@ { "when": { "west": "true", - "down": "true", "east": "false", + "down": "true", "up": "false" }, "apply": { @@ -347,8 +347,8 @@ { "when": { "west": "false", - "down": "true", "east": "false", + "down": "true", "up": "true" }, "apply": { @@ -358,8 +358,8 @@ { "when": { "west": "false", - "down": "false", "east": "false", + "down": "false", "up": "true" }, "apply": { @@ -369,8 +369,8 @@ { "when": { "west": "false", - "down": "true", "east": "false", + "down": "true", "up": "false" }, "apply": { @@ -380,8 +380,8 @@ { "when": { "west": "true", - "down": "false", "east": "true", + "down": "false", "up": "false" }, "apply": { @@ -391,8 +391,8 @@ { "when": { "west": "false", - "down": "false", "east": "true", + "down": "false", "up": "false" }, "apply": { @@ -402,8 +402,8 @@ { "when": { "west": "true", - "down": "false", "east": "false", + "down": "false", "up": "false" }, "apply": { @@ -413,8 +413,8 @@ { "when": { "west": "false", - "down": "false", "east": "false", + "down": "false", "up": "false" }, "apply": { diff --git a/src/generated/resources/assets/create/blockstates/portable_fluid_interface.json b/src/generated/resources/assets/create/blockstates/portable_fluid_interface.json new file mode 100644 index 000000000..e231a5b5a --- /dev/null +++ b/src/generated/resources/assets/create/blockstates/portable_fluid_interface.json @@ -0,0 +1,30 @@ +{ + "variants": { + "facing=down": { + "model": "create:block/portable_fluid_interface/block", + "x": 180 + }, + "facing=up": { + "model": "create:block/portable_fluid_interface/block" + }, + "facing=north": { + "model": "create:block/portable_fluid_interface/block", + "x": 90 + }, + "facing=south": { + "model": "create:block/portable_fluid_interface/block", + "x": 90, + "y": 180 + }, + "facing=west": { + "model": "create:block/portable_fluid_interface/block", + "x": 90, + "y": 270 + }, + "facing=east": { + "model": "create:block/portable_fluid_interface/block", + "x": 90, + "y": 90 + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/create/lang/en_ud.json b/src/generated/resources/assets/create/lang/en_ud.json index 1e75bdd5e..a98ffe1fb 100644 --- a/src/generated/resources/assets/create/lang/en_ud.json +++ b/src/generated/resources/assets/create/lang/en_ud.json @@ -323,6 +323,7 @@ "block.create.polished_weathered_limestone_slab": "q\u0250\u05DFS \u01DDuo\u0287s\u01DD\u026F\u0131\uA780 p\u01DD\u0279\u01DD\u0265\u0287\u0250\u01DDM p\u01DD\u0265s\u0131\u05DFo\u0500", "block.create.polished_weathered_limestone_stairs": "s\u0279\u0131\u0250\u0287S \u01DDuo\u0287s\u01DD\u026F\u0131\uA780 p\u01DD\u0279\u01DD\u0265\u0287\u0250\u01DDM p\u01DD\u0265s\u0131\u05DFo\u0500", "block.create.polished_weathered_limestone_wall": "\u05DF\u05DF\u0250M \u01DDuo\u0287s\u01DD\u026F\u0131\uA780 p\u01DD\u0279\u01DD\u0265\u0287\u0250\u01DDM p\u01DD\u0265s\u0131\u05DFo\u0500", + "block.create.portable_fluid_interface": "\u01DD\u0254\u0250\u025F\u0279\u01DD\u0287uI p\u0131n\u05DF\u2132 \u01DD\u05DFq\u0250\u0287\u0279o\u0500", "block.create.portable_storage_interface": "\u01DD\u0254\u0250\u025F\u0279\u01DD\u0287uI \u01DDb\u0250\u0279o\u0287S \u01DD\u05DFq\u0250\u0287\u0279o\u0500", "block.create.powered_latch": "\u0265\u0254\u0287\u0250\uA780 p\u01DD\u0279\u01DD\u028Do\u0500", "block.create.powered_toggle_latch": "\u0265\u0254\u0287\u0250\uA780 \u01DD\u05DFbbo\u27D8 p\u01DD\u0279\u01DD\u028Do\u0500", diff --git a/src/generated/resources/assets/create/lang/en_us.json b/src/generated/resources/assets/create/lang/en_us.json index 1b4620c5e..c4d69c991 100644 --- a/src/generated/resources/assets/create/lang/en_us.json +++ b/src/generated/resources/assets/create/lang/en_us.json @@ -326,6 +326,7 @@ "block.create.polished_weathered_limestone_slab": "Polished Weathered Limestone Slab", "block.create.polished_weathered_limestone_stairs": "Polished Weathered Limestone Stairs", "block.create.polished_weathered_limestone_wall": "Polished Weathered Limestone Wall", + "block.create.portable_fluid_interface": "Portable Fluid Interface", "block.create.portable_storage_interface": "Portable Storage Interface", "block.create.powered_latch": "Powered Latch", "block.create.powered_toggle_latch": "Powered Toggle Latch", diff --git a/src/generated/resources/assets/create/lang/unfinished/de_de.json b/src/generated/resources/assets/create/lang/unfinished/de_de.json index 31cd74c98..a0469d075 100644 --- a/src/generated/resources/assets/create/lang/unfinished/de_de.json +++ b/src/generated/resources/assets/create/lang/unfinished/de_de.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 1042", + "_": "Missing Localizations: 1043", "_": "->------------------------] Game Elements [------------------------<-", @@ -327,6 +327,7 @@ "block.create.polished_weathered_limestone_slab": "Polierte Verwitterte Kalksteinstufe", "block.create.polished_weathered_limestone_stairs": "UNLOCALIZED: Polished Weathered Limestone Stairs", "block.create.polished_weathered_limestone_wall": "UNLOCALIZED: Polished Weathered Limestone Wall", + "block.create.portable_fluid_interface": "UNLOCALIZED: Portable Fluid Interface", "block.create.portable_storage_interface": "UNLOCALIZED: Portable Storage Interface", "block.create.powered_latch": "UNLOCALIZED: Powered Latch", "block.create.powered_toggle_latch": "UNLOCALIZED: Powered Toggle Latch", diff --git a/src/generated/resources/assets/create/lang/unfinished/fr_fr.json b/src/generated/resources/assets/create/lang/unfinished/fr_fr.json index 734ffd347..3827b205c 100644 --- a/src/generated/resources/assets/create/lang/unfinished/fr_fr.json +++ b/src/generated/resources/assets/create/lang/unfinished/fr_fr.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 671", + "_": "Missing Localizations: 672", "_": "->------------------------] Game Elements [------------------------<-", @@ -327,6 +327,7 @@ "block.create.polished_weathered_limestone_slab": "Dalle de calcaire patinées", "block.create.polished_weathered_limestone_stairs": "UNLOCALIZED: Polished Weathered Limestone Stairs", "block.create.polished_weathered_limestone_wall": "UNLOCALIZED: Polished Weathered Limestone Wall", + "block.create.portable_fluid_interface": "UNLOCALIZED: Portable Fluid Interface", "block.create.portable_storage_interface": "Interface de stockage portable", "block.create.powered_latch": "Verrou alimenté", "block.create.powered_toggle_latch": "Verrou alimenté à bascule", diff --git a/src/generated/resources/assets/create/lang/unfinished/it_it.json b/src/generated/resources/assets/create/lang/unfinished/it_it.json index 7b822c68d..ec2e3e609 100644 --- a/src/generated/resources/assets/create/lang/unfinished/it_it.json +++ b/src/generated/resources/assets/create/lang/unfinished/it_it.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 655", + "_": "Missing Localizations: 656", "_": "->------------------------] Game Elements [------------------------<-", @@ -327,6 +327,7 @@ "block.create.polished_weathered_limestone_slab": "Lastra di Calcare Consumato Levigato", "block.create.polished_weathered_limestone_stairs": "UNLOCALIZED: Polished Weathered Limestone Stairs", "block.create.polished_weathered_limestone_wall": "UNLOCALIZED: Polished Weathered Limestone Wall", + "block.create.portable_fluid_interface": "UNLOCALIZED: Portable Fluid Interface", "block.create.portable_storage_interface": "Interfaccia di Archiviazione Portatile", "block.create.powered_latch": "Leva Alimentata", "block.create.powered_toggle_latch": "Leva Alimentata Alterata", diff --git a/src/generated/resources/assets/create/lang/unfinished/ja_jp.json b/src/generated/resources/assets/create/lang/unfinished/ja_jp.json index b8dbdb671..8283f2543 100644 --- a/src/generated/resources/assets/create/lang/unfinished/ja_jp.json +++ b/src/generated/resources/assets/create/lang/unfinished/ja_jp.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 654", + "_": "Missing Localizations: 655", "_": "->------------------------] Game Elements [------------------------<-", @@ -327,6 +327,7 @@ "block.create.polished_weathered_limestone_slab": "磨かれた風化石灰岩のハーフブロック", "block.create.polished_weathered_limestone_stairs": "UNLOCALIZED: Polished Weathered Limestone Stairs", "block.create.polished_weathered_limestone_wall": "UNLOCALIZED: Polished Weathered Limestone Wall", + "block.create.portable_fluid_interface": "UNLOCALIZED: Portable Fluid Interface", "block.create.portable_storage_interface": "ポータブルストレージインターフェイス", "block.create.powered_latch": "パワードラッチ", "block.create.powered_toggle_latch": "パワードトグルラッチ", diff --git a/src/generated/resources/assets/create/lang/unfinished/ko_kr.json b/src/generated/resources/assets/create/lang/unfinished/ko_kr.json index 3a019fae3..67dd3c869 100644 --- a/src/generated/resources/assets/create/lang/unfinished/ko_kr.json +++ b/src/generated/resources/assets/create/lang/unfinished/ko_kr.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 655", + "_": "Missing Localizations: 656", "_": "->------------------------] Game Elements [------------------------<-", @@ -327,6 +327,7 @@ "block.create.polished_weathered_limestone_slab": "윤나는 풍화된 석회암 반 블록", "block.create.polished_weathered_limestone_stairs": "UNLOCALIZED: Polished Weathered Limestone Stairs", "block.create.polished_weathered_limestone_wall": "UNLOCALIZED: Polished Weathered Limestone Wall", + "block.create.portable_fluid_interface": "UNLOCALIZED: Portable Fluid Interface", "block.create.portable_storage_interface": "이동식 저장소 인터페이스", "block.create.powered_latch": "레드스톤 걸쇠", "block.create.powered_toggle_latch": "레드스톤 토글 걸쇠", diff --git a/src/generated/resources/assets/create/lang/unfinished/nl_nl.json b/src/generated/resources/assets/create/lang/unfinished/nl_nl.json index f622b9656..b87dccf6b 100644 --- a/src/generated/resources/assets/create/lang/unfinished/nl_nl.json +++ b/src/generated/resources/assets/create/lang/unfinished/nl_nl.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 983", + "_": "Missing Localizations: 984", "_": "->------------------------] Game Elements [------------------------<-", @@ -327,6 +327,7 @@ "block.create.polished_weathered_limestone_slab": "Gepolijste Verweerde Kalksteen Plaat", "block.create.polished_weathered_limestone_stairs": "UNLOCALIZED: Polished Weathered Limestone Stairs", "block.create.polished_weathered_limestone_wall": "UNLOCALIZED: Polished Weathered Limestone Wall", + "block.create.portable_fluid_interface": "UNLOCALIZED: Portable Fluid Interface", "block.create.portable_storage_interface": "UNLOCALIZED: Portable Storage Interface", "block.create.powered_latch": "UNLOCALIZED: Powered Latch", "block.create.powered_toggle_latch": "UNLOCALIZED: Powered Toggle Latch", diff --git a/src/generated/resources/assets/create/lang/unfinished/pt_br.json b/src/generated/resources/assets/create/lang/unfinished/pt_br.json index 80d89f6e0..14e55ca88 100644 --- a/src/generated/resources/assets/create/lang/unfinished/pt_br.json +++ b/src/generated/resources/assets/create/lang/unfinished/pt_br.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 1049", + "_": "Missing Localizations: 1050", "_": "->------------------------] Game Elements [------------------------<-", @@ -327,6 +327,7 @@ "block.create.polished_weathered_limestone_slab": "Lajota de Calcário Polido Resistido", "block.create.polished_weathered_limestone_stairs": "UNLOCALIZED: Polished Weathered Limestone Stairs", "block.create.polished_weathered_limestone_wall": "UNLOCALIZED: Polished Weathered Limestone Wall", + "block.create.portable_fluid_interface": "UNLOCALIZED: Portable Fluid Interface", "block.create.portable_storage_interface": "UNLOCALIZED: Portable Storage Interface", "block.create.powered_latch": "UNLOCALIZED: Powered Latch", "block.create.powered_toggle_latch": "UNLOCALIZED: Powered Toggle Latch", diff --git a/src/generated/resources/assets/create/lang/unfinished/ru_ru.json b/src/generated/resources/assets/create/lang/unfinished/ru_ru.json index 76a352012..ad536d123 100644 --- a/src/generated/resources/assets/create/lang/unfinished/ru_ru.json +++ b/src/generated/resources/assets/create/lang/unfinished/ru_ru.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 324", + "_": "Missing Localizations: 325", "_": "->------------------------] Game Elements [------------------------<-", @@ -327,6 +327,7 @@ "block.create.polished_weathered_limestone_slab": "Плита из полированного выветренного известняка", "block.create.polished_weathered_limestone_stairs": "Ступени из полированного выветренного известняка", "block.create.polished_weathered_limestone_wall": "Стена из полированного выветренного известняка", + "block.create.portable_fluid_interface": "UNLOCALIZED: Portable Fluid Interface", "block.create.portable_storage_interface": "Портативный интерфейс хранения", "block.create.powered_latch": "Механизированная защёлка", "block.create.powered_toggle_latch": "Механизированная рычаг-защёлка", diff --git a/src/generated/resources/assets/create/lang/unfinished/zh_cn.json b/src/generated/resources/assets/create/lang/unfinished/zh_cn.json index 8c1ef7e62..4e17d99ea 100644 --- a/src/generated/resources/assets/create/lang/unfinished/zh_cn.json +++ b/src/generated/resources/assets/create/lang/unfinished/zh_cn.json @@ -1,5 +1,5 @@ { - "_": "Missing Localizations: 337", + "_": "Missing Localizations: 338", "_": "->------------------------] Game Elements [------------------------<-", @@ -327,6 +327,7 @@ "block.create.polished_weathered_limestone_slab": "磨制风化石灰岩台阶", "block.create.polished_weathered_limestone_stairs": "磨制风化石灰岩楼梯", "block.create.polished_weathered_limestone_wall": "磨制风化石灰岩墙", + "block.create.portable_fluid_interface": "UNLOCALIZED: Portable Fluid Interface", "block.create.portable_storage_interface": "移动式存储接口", "block.create.powered_latch": "锁存器", "block.create.powered_toggle_latch": "T触发器", diff --git a/src/generated/resources/assets/create/models/item/portable_fluid_interface.json b/src/generated/resources/assets/create/models/item/portable_fluid_interface.json new file mode 100644 index 000000000..9418446e7 --- /dev/null +++ b/src/generated/resources/assets/create/models/item/portable_fluid_interface.json @@ -0,0 +1,3 @@ +{ + "parent": "create:block/portable_fluid_interface/item" +} \ No newline at end of file diff --git a/src/generated/resources/data/create/advancements/recipes/create.base/crafting/kinetics/portable_fluid_interface.json b/src/generated/resources/data/create/advancements/recipes/create.base/crafting/kinetics/portable_fluid_interface.json new file mode 100644 index 000000000..2b2f247b3 --- /dev/null +++ b/src/generated/resources/data/create/advancements/recipes/create.base/crafting/kinetics/portable_fluid_interface.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "rewards": { + "recipes": [ + "create:crafting/kinetics/portable_fluid_interface" + ] + }, + "criteria": { + "has_item": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "item": "create:copper_casing" + } + ] + } + }, + "has_the_recipe": { + "trigger": "minecraft:recipe_unlocked", + "conditions": { + "recipe": "create:crafting/kinetics/portable_fluid_interface" + } + } + }, + "requirements": [ + [ + "has_item", + "has_the_recipe" + ] + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/create/loot_tables/blocks/portable_fluid_interface.json b/src/generated/resources/data/create/loot_tables/blocks/portable_fluid_interface.json new file mode 100644 index 000000000..d4f291dad --- /dev/null +++ b/src/generated/resources/data/create/loot_tables/blocks/portable_fluid_interface.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "create:portable_fluid_interface" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/create/recipes/crafting/kinetics/portable_fluid_interface.json b/src/generated/resources/data/create/recipes/crafting/kinetics/portable_fluid_interface.json new file mode 100644 index 000000000..61bf4785c --- /dev/null +++ b/src/generated/resources/data/create/recipes/crafting/kinetics/portable_fluid_interface.json @@ -0,0 +1,18 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + " B ", + " I " + ], + "key": { + "I": { + "item": "create:copper_casing" + }, + "B": { + "item": "create:andesite_funnel" + } + }, + "result": { + "item": "create:portable_fluid_interface" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/create/recipes/crafting/kinetics/portable_storage_interface.json b/src/generated/resources/data/create/recipes/crafting/kinetics/portable_storage_interface.json index 87f103a47..ee961eefa 100644 --- a/src/generated/resources/data/create/recipes/crafting/kinetics/portable_storage_interface.json +++ b/src/generated/resources/data/create/recipes/crafting/kinetics/portable_storage_interface.json @@ -6,7 +6,7 @@ ], "key": { "I": { - "item": "create:redstone_contact" + "item": "create:brass_casing" }, "B": { "item": "create:andesite_funnel" diff --git a/src/main/java/com/simibubi/create/AllBlockPartials.java b/src/main/java/com/simibubi/create/AllBlockPartials.java index 4cfe13d22..7fdcfb261 100644 --- a/src/main/java/com/simibubi/create/AllBlockPartials.java +++ b/src/main/java/com/simibubi/create/AllBlockPartials.java @@ -88,6 +88,10 @@ public class AllBlockPartials { PORTABLE_STORAGE_INTERFACE_MIDDLE = get("portable_storage_interface/block_middle"), PORTABLE_STORAGE_INTERFACE_MIDDLE_POWERED = get("portable_storage_interface/block_middle_powered"), PORTABLE_STORAGE_INTERFACE_TOP = get("portable_storage_interface/block_top"), + + PORTABLE_FLUID_INTERFACE_MIDDLE = get("portable_fluid_interface/block_middle"), + PORTABLE_FLUID_INTERFACE_MIDDLE_POWERED = get("portable_fluid_interface/block_middle_powered"), + PORTABLE_FLUID_INTERFACE_TOP = get("portable_fluid_interface/block_top"), ARM_COG = get("mechanical_arm/cog"), ARM_BASE = get("mechanical_arm/base"), ARM_LOWER_BODY = get("mechanical_arm/lower_body"), ARM_UPPER_BODY = get("mechanical_arm/upper_body"), diff --git a/src/main/java/com/simibubi/create/AllBlocks.java b/src/main/java/com/simibubi/create/AllBlocks.java index e48a3ac76..d235fc682 100644 --- a/src/main/java/com/simibubi/create/AllBlocks.java +++ b/src/main/java/com/simibubi/create/AllBlocks.java @@ -630,6 +630,15 @@ public class AllBlocks { .item(BasinOperatorBlockItem::new) .transform(customItemModel()) .register(); + + public static final BlockEntry PORTABLE_FLUID_INTERFACE = + REGISTRATE.block("portable_fluid_interface", PortableStorageInterfaceBlock::forFluids) + .initialProperties(SharedProperties::softMetal) + .blockstate((c, p) -> p.directionalBlock(c.get(), AssetLookup.partialBaseModel(c, p))) + .onRegister(addMovementBehaviour(new PortableStorageInterfaceMovement())) + .item() + .transform(customItemModel()) + .register(); // Contraptions @@ -791,7 +800,7 @@ public class AllBlocks { .register(); public static final BlockEntry PORTABLE_STORAGE_INTERFACE = - REGISTRATE.block("portable_storage_interface", PortableStorageInterfaceBlock::new) + REGISTRATE.block("portable_storage_interface", PortableStorageInterfaceBlock::forItems) .initialProperties(SharedProperties::stone) .blockstate((c, p) -> p.directionalBlock(c.get(), AssetLookup.partialBaseModel(c, p))) .onRegister(addMovementBehaviour(new PortableStorageInterfaceMovement())) diff --git a/src/main/java/com/simibubi/create/AllTileEntities.java b/src/main/java/com/simibubi/create/AllTileEntities.java index 8d24eb6bc..aba35da40 100644 --- a/src/main/java/com/simibubi/create/AllTileEntities.java +++ b/src/main/java/com/simibubi/create/AllTileEntities.java @@ -5,8 +5,9 @@ import com.simibubi.create.content.contraptions.components.actors.DrillRenderer; import com.simibubi.create.content.contraptions.components.actors.DrillTileEntity; import com.simibubi.create.content.contraptions.components.actors.HarvesterRenderer; import com.simibubi.create.content.contraptions.components.actors.HarvesterTileEntity; +import com.simibubi.create.content.contraptions.components.actors.PortableFluidInterfaceTileEntity; +import com.simibubi.create.content.contraptions.components.actors.PortableItemInterfaceTileEntity; import com.simibubi.create.content.contraptions.components.actors.PortableStorageInterfaceRenderer; -import com.simibubi.create.content.contraptions.components.actors.PortableStorageInterfaceTileEntity; import com.simibubi.create.content.contraptions.components.clock.CuckooClockRenderer; import com.simibubi.create.content.contraptions.components.clock.CuckooClockTileEntity; import com.simibubi.create.content.contraptions.components.crafter.MechanicalCrafterRenderer; @@ -349,13 +350,19 @@ public class AllTileEntities { .renderer(() -> HarvesterRenderer::new) .register(); - public static final TileEntityEntry PORTABLE_STORAGE_INTERFACE = + public static final TileEntityEntry PORTABLE_STORAGE_INTERFACE = Create.registrate() - .tileEntity("portable_storage_interface", PortableStorageInterfaceTileEntity::new) + .tileEntity("portable_storage_interface", PortableItemInterfaceTileEntity::new) .validBlocks(AllBlocks.PORTABLE_STORAGE_INTERFACE) .renderer(() -> PortableStorageInterfaceRenderer::new) .register(); + public static final TileEntityEntry PORTABLE_FLUID_INTERFACE = Create.registrate() + .tileEntity("portable_fluid_interface", PortableFluidInterfaceTileEntity::new) + .validBlocks(AllBlocks.PORTABLE_FLUID_INTERFACE) + .renderer(() -> PortableStorageInterfaceRenderer::new) + .register(); + public static final TileEntityEntry FLYWHEEL = Create.registrate() .tileEntity("flywheel", FlywheelTileEntity::new) .validBlocks(AllBlocks.FLYWHEEL) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/PortableFluidInterfaceTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/PortableFluidInterfaceTileEntity.java new file mode 100644 index 000000000..981213c94 --- /dev/null +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/PortableFluidInterfaceTileEntity.java @@ -0,0 +1,113 @@ +package com.simibubi.create.content.contraptions.components.actors; + +import com.simibubi.create.content.contraptions.components.structureMovement.Contraption; + +import net.minecraft.tileentity.TileEntityType; +import net.minecraft.util.Direction; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.util.LazyOptional; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.capability.IFluidHandler; +import net.minecraftforge.fluids.capability.templates.FluidTank; + +public class PortableFluidInterfaceTileEntity extends PortableStorageInterfaceTileEntity { + + protected LazyOptional capability; + + public PortableFluidInterfaceTileEntity(TileEntityType tileEntityTypeIn) { + super(tileEntityTypeIn); + capability = createEmptyHandler(); + } + + @Override + public void startTransferringTo(Contraption contraption, float distance) { + LazyOptional oldcap = capability; + capability = LazyOptional.of(() -> new InterfaceFluidHandler(contraption.fluidInventory)); + oldcap.invalidate(); + super.startTransferringTo(contraption, distance); + } + + @Override + protected void invalidateCapability() { + capability.invalidate(); + } + + @Override + protected void stopTransferring() { + LazyOptional oldcap = capability; + capability = createEmptyHandler(); + oldcap.invalidate(); + } + + private LazyOptional createEmptyHandler() { + return LazyOptional.of(() -> new InterfaceFluidHandler(new FluidTank(0))); + } + + @Override + public LazyOptional getCapability(Capability cap, Direction side) { + if (isFluidHandlerCap(cap)) + return capability.cast(); + return super.getCapability(cap, side); + } + + class InterfaceFluidHandler implements IFluidHandler { + + private IFluidHandler wrapped; + + public InterfaceFluidHandler(IFluidHandler wrapped) { + this.wrapped = wrapped; + } + + @Override + public int getTanks() { + return wrapped.getTanks(); + } + + @Override + public FluidStack getFluidInTank(int tank) { + return wrapped.getFluidInTank(tank); + } + + @Override + public int getTankCapacity(int tank) { + return wrapped.getTankCapacity(tank); + } + + @Override + public boolean isFluidValid(int tank, FluidStack stack) { + return wrapped.isFluidValid(tank, stack); + } + + @Override + public int fill(FluidStack resource, FluidAction action) { + if (!isConnected()) + return 0; + int fill = wrapped.fill(resource, action); + if (fill > 0 && action.execute()) + onContentTransferred(); + return fill; + } + + @Override + public FluidStack drain(FluidStack resource, FluidAction action) { + if (!isConnected()) + return FluidStack.EMPTY; + FluidStack drain = wrapped.drain(resource, action); + if (!drain.isEmpty() && action.execute()) + onContentTransferred(); + return drain; + } + + @Override + public FluidStack drain(int maxDrain, FluidAction action) { + if (!isConnected()) + return FluidStack.EMPTY; + FluidStack drain = wrapped.drain(maxDrain, action); + if (!drain.isEmpty() && (action.execute() || drain.getAmount() == 1)) + onContentTransferred(); + return drain; + } + + } + +} diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/PortableItemInterfaceTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/PortableItemInterfaceTileEntity.java new file mode 100644 index 000000000..1642a30ed --- /dev/null +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/PortableItemInterfaceTileEntity.java @@ -0,0 +1,78 @@ +package com.simibubi.create.content.contraptions.components.actors; + +import com.simibubi.create.content.contraptions.components.structureMovement.Contraption; +import com.simibubi.create.foundation.item.ItemHandlerWrapper; + +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntityType; +import net.minecraft.util.Direction; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.util.LazyOptional; +import net.minecraftforge.items.IItemHandlerModifiable; +import net.minecraftforge.items.ItemStackHandler; + +public class PortableItemInterfaceTileEntity extends PortableStorageInterfaceTileEntity { + + protected LazyOptional capability; + + public PortableItemInterfaceTileEntity(TileEntityType tileEntityTypeIn) { + super(tileEntityTypeIn); + capability = LazyOptional.empty(); + } + + @Override + public void startTransferringTo(Contraption contraption, float distance) { + LazyOptional oldCap = capability; + capability = LazyOptional.of(() -> new InterfaceItemHandler(contraption.inventory)); + oldCap.invalidate(); + super.startTransferringTo(contraption, distance); + } + + @Override + protected void stopTransferring() { + LazyOptional oldCap = capability; + capability = LazyOptional.of(() -> new InterfaceItemHandler(new ItemStackHandler(0))); + oldCap.invalidate(); + } + + @Override + protected void invalidateCapability() { + capability.invalidate(); + } + + @Override + public LazyOptional getCapability(Capability cap, Direction side) { + if (isItemHandlerCap(cap)) + return capability.cast(); + return super.getCapability(cap, side); + } + + class InterfaceItemHandler extends ItemHandlerWrapper { + + public InterfaceItemHandler(IItemHandlerModifiable wrapped) { + super(wrapped); + } + + @Override + public ItemStack extractItem(int slot, int amount, boolean simulate) { + if (!isConnected()) + return ItemStack.EMPTY; + ItemStack extractItem = super.extractItem(slot, amount, simulate); + if (!simulate && !extractItem.isEmpty()) + onContentTransferred(); + return extractItem; + } + + @Override + public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) { + if (!isConnected()) + return stack; + ItemStack insertItem = super.insertItem(slot, stack, simulate); + if (!simulate && !insertItem.equals(stack, false)) + onContentTransferred(); + return insertItem; + } + + } + +} diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/PortableStorageInterfaceBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/PortableStorageInterfaceBlock.java index 078b33117..7afae49c4 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/PortableStorageInterfaceBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/PortableStorageInterfaceBlock.java @@ -8,6 +8,7 @@ import com.simibubi.create.foundation.block.ITE; import com.simibubi.create.foundation.block.ProperDirectionalBlock; import mcp.MethodsReturnNonnullByDefault; +import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.item.BlockItemUseContext; import net.minecraft.tileentity.TileEntity; @@ -22,8 +23,19 @@ import net.minecraft.world.World; public class PortableStorageInterfaceBlock extends ProperDirectionalBlock implements ITE { - public PortableStorageInterfaceBlock(Properties p_i48415_1_) { + boolean fluids; + + public static PortableStorageInterfaceBlock forItems(Properties p_i48415_1_) { + return new PortableStorageInterfaceBlock(p_i48415_1_, false); + } + + public static PortableStorageInterfaceBlock forFluids(Properties p_i48415_1_) { + return new PortableStorageInterfaceBlock(p_i48415_1_, true); + } + + private PortableStorageInterfaceBlock(Properties p_i48415_1_, boolean fluids) { super(p_i48415_1_); + this.fluids = fluids; } @Override @@ -33,7 +45,14 @@ public class PortableStorageInterfaceBlock extends ProperDirectionalBlock @Override public TileEntity createTileEntity(BlockState state, IBlockReader world) { - return AllTileEntities.PORTABLE_STORAGE_INTERFACE.create(); + return (fluids ? AllTileEntities.PORTABLE_FLUID_INTERFACE : AllTileEntities.PORTABLE_STORAGE_INTERFACE) + .create(); + } + + @Override + public void neighborChanged(BlockState state, World world, BlockPos pos, Block p_220069_4_, BlockPos p_220069_5_, + boolean p_220069_6_) { + withTileEntityDo(world, pos, PortableStorageInterfaceTileEntity::neighbourChanged); } @Override @@ -54,11 +73,8 @@ public class PortableStorageInterfaceBlock extends ProperDirectionalBlock @Override public int getComparatorInputOverride(BlockState blockState, World worldIn, BlockPos pos) { - try { - return getTileEntity(worldIn, pos).isConnected() ? 15 : 0; - } catch (TileEntityException e) { - } - return 0; + return getTileEntityOptional(worldIn, pos).map(te -> te.isConnected() ? 15 : 0) + .orElse(0); } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/PortableStorageInterfaceMovement.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/PortableStorageInterfaceMovement.java index a3ff3fa8b..bfb1fbca9 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/PortableStorageInterfaceMovement.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/PortableStorageInterfaceMovement.java @@ -3,7 +3,6 @@ package com.simibubi.create.content.contraptions.components.actors; import java.util.Optional; import com.mojang.blaze3d.matrix.MatrixStack; -import com.simibubi.create.AllBlocks; import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; import com.simibubi.create.foundation.utility.VecHelper; @@ -50,11 +49,12 @@ public class PortableStorageInterfaceMovement extends MovementBehaviour { return false; Direction currentFacing = currentFacingIfValid.get(); - PortableStorageInterfaceTileEntity psi = findStationaryInterface(context.world, pos, currentFacing); + PortableStorageInterfaceTileEntity psi = + findStationaryInterface(context.world, pos, context.state, currentFacing); if (psi == null) return false; - if (psi.isTransferring() && !context.world.isRemote) + if ((psi.isTransferring() || psi.isPowered()) && !context.world.isRemote) return false; context.data.put(_workingPos_, NBTUtil.writeBlockPos(psi.getPos())); if (!context.world.isRemote) { @@ -94,7 +94,7 @@ public class PortableStorageInterfaceMovement extends MovementBehaviour { return; PortableStorageInterfaceTileEntity stationaryInterface = - getStationaryInterfaceAt(context.world, pos, currentFacingIfValid.get()); + getStationaryInterfaceAt(context.world, pos, context.state, currentFacingIfValid.get()); if (stationaryInterface == null || !stationaryInterface.isTransferring()) { reset(context); return; @@ -112,10 +112,11 @@ public class PortableStorageInterfaceMovement extends MovementBehaviour { context.stall = false; } - private PortableStorageInterfaceTileEntity findStationaryInterface(World world, BlockPos pos, Direction facing) { + private PortableStorageInterfaceTileEntity findStationaryInterface(World world, BlockPos pos, BlockState state, + Direction facing) { for (int i = 0; i < 2; i++) { PortableStorageInterfaceTileEntity interfaceAt = - getStationaryInterfaceAt(world, pos.offset(facing, i), facing); + getStationaryInterfaceAt(world, pos.offset(facing, i), state, facing); if (interfaceAt == null) continue; return interfaceAt; @@ -123,12 +124,13 @@ public class PortableStorageInterfaceMovement extends MovementBehaviour { return null; } - private PortableStorageInterfaceTileEntity getStationaryInterfaceAt(World world, BlockPos pos, Direction facing) { + private PortableStorageInterfaceTileEntity getStationaryInterfaceAt(World world, BlockPos pos, BlockState state, + Direction facing) { TileEntity te = world.getTileEntity(pos); if (!(te instanceof PortableStorageInterfaceTileEntity)) return null; BlockState blockState = world.getBlockState(pos); - if (!AllBlocks.PORTABLE_STORAGE_INTERFACE.has(blockState)) + if (blockState.getBlock() != state.getBlock()) return null; if (blockState.get(PortableStorageInterfaceBlock.FACING) != facing.getOpposite()) return null; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/PortableStorageInterfaceRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/PortableStorageInterfaceRenderer.java index 9efa6b692..c45de1c3f 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/PortableStorageInterfaceRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/PortableStorageInterfaceRenderer.java @@ -5,6 +5,7 @@ import java.util.function.Consumer; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import com.simibubi.create.AllBlockPartials; +import com.simibubi.create.AllBlocks; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer; import com.simibubi.create.foundation.utility.AngleHelper; @@ -33,7 +34,8 @@ public class PortableStorageInterfaceRenderer extends SafeTileEntityRenderer sbb.light(light).renderInto(ms, vb), ms); + render(blockState, progress, te.isConnected(), sbb -> sbb.light(light) + .renderInto(ms, vb), ms); } public static void renderInContraption(MovementContext context, MatrixStack ms, MatrixStack msLocal, @@ -43,14 +45,14 @@ public class PortableStorageInterfaceRenderer extends SafeTileEntityRenderer sbb.light(msLocal.peek() .getModel()) .renderInto(ms, vb), ms, msLocal); @@ -77,10 +79,8 @@ public class PortableStorageInterfaceRenderer extends SafeTileEntityRenderer capability; protected LerpedFloat connectionAnimation; + protected boolean powered; public PortableStorageInterfaceTileEntity(TileEntityType tileEntityTypeIn) { super(tileEntityTypeIn); transferTimer = 0; - capability = LazyOptional.empty(); - connectionAnimation = LerpedFloat.linear().startWithValue(0); + connectionAnimation = LerpedFloat.linear() + .startWithValue(0); + powered = false; } public void startTransferringTo(Contraption contraption, float distance) { - capability.invalidate(); - capability = LazyOptional.of(() -> new InterfaceItemHandler(contraption.inventory)); this.distance = distance; startConnecting(); notifyUpdate(); } + protected abstract void stopTransferring(); + + protected abstract void invalidateCapability(); + @Override public void tick() { super.tick(); boolean wasConnected = isConnected(); - + if (transferTimer > 0) { transferTimer--; - if (transferTimer == 0) - capability.invalidate(); + if (transferTimer == 0 || powered) + stopTransferring(); } - + boolean isConnected = isConnected(); if (wasConnected != isConnected && !world.isRemote) markDirty(); - + float progress = 0; int timeUnit = getTransferTimeout() / 2; if (isConnected) @@ -68,21 +65,41 @@ public class PortableStorageInterfaceTileEntity extends SmartTileEntity { progress = MathHelper.lerp(transferTimer / (float) timeUnit, 0, 1); connectionAnimation.setValue(progress); } - + + @Override + public void remove() { + super.remove(); + invalidateCapability(); + } + @Override protected void read(CompoundNBT compound, boolean clientPacket) { super.read(compound, clientPacket); transferTimer = compound.getInt("Timer"); distance = compound.getFloat("Distance"); + powered = compound.getBoolean("Powered"); } - + @Override protected void write(CompoundNBT compound, boolean clientPacket) { super.write(compound, clientPacket); compound.putInt("Timer", transferTimer); compound.putFloat("Distance", distance); + compound.putBoolean("Powered", powered); + } + + public void neighbourChanged() { + boolean isBlockPowered = world.isBlockPowered(pos); + if (isBlockPowered == powered) + return; + powered = isBlockPowered; + sendData(); } + public boolean isPowered() { + return powered; + } + @Override @OnlyIn(Dist.CLIENT) public AxisAlignedBB getRenderBoundingBox() { @@ -92,31 +109,24 @@ public class PortableStorageInterfaceTileEntity extends SmartTileEntity { public boolean isTransferring() { return transferTimer != 0; } - + boolean isConnected() { int timeUnit = getTransferTimeout() / 2; return transferTimer >= timeUnit && transferTimer <= timeUnit * 3; } - + float getExtensionDistance(float partialTicks) { return connectionAnimation.getValue(partialTicks) * distance / 2; } - + float getConnectionDistance() { return distance; } - @Override - public LazyOptional getCapability(Capability cap, Direction side) { - if (isItemHandlerCap(cap)) - return capability.cast(); - return super.getCapability(cap, side); - } - public void startConnecting() { transferTimer = getTransferTimeout() * 2; } - + public void onContentTransferred() { int timeUnit = getTransferTimeout() / 2; transferTimer = timeUnit * 3; @@ -130,32 +140,4 @@ public class PortableStorageInterfaceTileEntity extends SmartTileEntity { @Override public void addBehaviours(List behaviours) {} - class InterfaceItemHandler extends ItemHandlerWrapper { - - public InterfaceItemHandler(IItemHandlerModifiable wrapped) { - super(wrapped); - } - - @Override - public ItemStack extractItem(int slot, int amount, boolean simulate) { - if (!isConnected()) - return ItemStack.EMPTY; - ItemStack extractItem = super.extractItem(slot, amount, simulate); - if (!simulate && !extractItem.isEmpty()) - onContentTransferred(); - return extractItem; - } - - @Override - public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) { - if (!isConnected()) - return stack; - ItemStack insertItem = super.insertItem(slot, stack, simulate); - if (!simulate && !insertItem.equals(stack, false)) - onContentTransferred(); - return insertItem; - } - - } - } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AbstractContraptionEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AbstractContraptionEntity.java index 3c3ecc0b2..c8bfc9585 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AbstractContraptionEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AbstractContraptionEntity.java @@ -223,6 +223,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit if (!initialized) contraptionInitialize(); + contraption.onEntityTick(world); tickContraption(); super.tick(); } @@ -351,22 +352,6 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit this.dataManager.register(STALLED, false); } - @Override - protected void readAdditional(CompoundNBT compound) { - initialized = compound.getBoolean("Initialized"); - contraption = Contraption.fromNBT(world, compound.getCompound("Contraption")); - contraption.entity = this; - dataManager.set(STALLED, compound.getBoolean("Stalled")); - } - - @Override - protected void writeAdditional(CompoundNBT compound) { - if (contraption != null) - compound.put("Contraption", contraption.writeNBT()); - compound.putBoolean("Stalled", isStalled()); - compound.putBoolean("Initialized", initialized); - } - @Override public IPacket createSpawnPacket() { return NetworkHooks.getEntitySpawningPacket(this); @@ -375,13 +360,37 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit @Override public void writeSpawnData(PacketBuffer buffer) { CompoundNBT compound = new CompoundNBT(); - writeAdditional(compound); + writeAdditional(compound, true); buffer.writeCompoundTag(compound); } + + @Override + protected final void writeAdditional(CompoundNBT compound) { + writeAdditional(compound, false); + } + + protected void writeAdditional(CompoundNBT compound, boolean spawnPacket) { + if (contraption != null) + compound.put("Contraption", contraption.writeNBT(spawnPacket)); + compound.putBoolean("Stalled", isStalled()); + compound.putBoolean("Initialized", initialized); + } @Override public void readSpawnData(PacketBuffer additionalData) { - readAdditional(additionalData.readCompoundTag()); + readAdditional(additionalData.readCompoundTag(), true); + } + + @Override + protected final void readAdditional(CompoundNBT compound) { + readAdditional(compound, false); + } + + protected void readAdditional(CompoundNBT compound, boolean spawnData) { + initialized = compound.getBoolean("Initialized"); + contraption = Contraption.fromNBT(world, compound.getCompound("Contraption"), spawnData); + contraption.entity = this; + dataManager.set(STALLED, compound.getBoolean("Stalled")); } public void disassemble() { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java index 0f544f1cc..41e20d42b 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java @@ -44,6 +44,7 @@ import com.simibubi.create.content.contraptions.relays.belt.BeltBlock; import com.simibubi.create.content.logistics.block.inventories.AdjustableCrateBlock; import com.simibubi.create.content.logistics.block.redstone.RedstoneContactBlock; import com.simibubi.create.foundation.config.AllConfigs; +import com.simibubi.create.foundation.fluid.CombinedTankWrapper; import com.simibubi.create.foundation.utility.BlockFace; import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.NBTHelper; @@ -81,6 +82,10 @@ import net.minecraft.world.World; import net.minecraft.world.gen.feature.template.Template.BlockInfo; import net.minecraftforge.common.util.Constants.BlockFlags; import net.minecraftforge.common.util.Constants.NBT; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.IFluidTank; +import net.minecraftforge.fluids.capability.IFluidHandler; +import net.minecraftforge.fluids.capability.templates.FluidTank; import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.wrapper.CombinedInvWrapper; @@ -88,12 +93,14 @@ public abstract class Contraption { public AbstractContraptionEntity entity; public CombinedInvWrapper inventory; + public CombinedTankWrapper fluidInventory; public AxisAlignedBB bounds; public BlockPos anchor; public boolean stalled; protected Map blocks; protected Map storage; + protected Map fluidStorage; protected List> actors; protected Set> superglue; protected List seats; @@ -105,7 +112,7 @@ public abstract class Contraption { private List pendingSubContraptions; // Client - public List renderedTileEntities; + public Map renderedTileEntities; public Contraption() { blocks = new HashMap<>(); @@ -114,9 +121,10 @@ public abstract class Contraption { actors = new ArrayList<>(); superglue = new HashSet<>(); seatMapping = new HashMap<>(); + fluidStorage = new HashMap<>(); glueToRemove = new ArrayList<>(); initialPassengers = new HashMap<>(); - renderedTileEntities = new ArrayList<>(); + renderedTileEntities = new HashMap<>(); pendingSubContraptions = new ArrayList<>(); stabilizedSubContraptions = new HashMap<>(); } @@ -140,10 +148,10 @@ public abstract class Contraption { return true; } - public static Contraption fromNBT(World world, CompoundNBT nbt) { + public static Contraption fromNBT(World world, CompoundNBT nbt, boolean spawnData) { String type = nbt.getString("Type"); Contraption contraption = AllContraptionTypes.fromType(type); - contraption.readNBT(world, nbt); + contraption.readNBT(world, nbt, spawnData); return contraption; } @@ -195,6 +203,13 @@ public abstract class Contraption { .map(MountedStorage::getItemHandler) .collect(Collectors.toList()); inventory = new CombinedInvWrapper(Arrays.copyOf(list.toArray(), list.size(), IItemHandlerModifiable[].class)); + + List fluidHandlers = fluidStorage.values() + .stream() + .map(MountedFluidStorage::getFluidHandler) + .collect(Collectors.toList()); + fluidInventory = new CombinedTankWrapper( + Arrays.copyOf(fluidHandlers.toArray(), fluidHandlers.size(), IFluidHandler[].class)); } public void onEntityInitialize(World world, AbstractContraptionEntity contraptionEntity) { @@ -218,6 +233,10 @@ public abstract class Contraption { } } + public void onEntityTick(World world) { + fluidStorage.forEach((pos, mfs) -> mfs.tick(entity, pos, world.isRemote)); + } + protected boolean moveBlock(World world, BlockPos pos, Direction forcedDirection, List frontier, Set visited) { visited.add(pos); @@ -449,6 +468,8 @@ public abstract class Contraption { TileEntity te = pair.getValue(); if (te != null && MountedStorage.canUseAsStorage(te)) storage.put(localPos, new MountedStorage(te)); + if (te != null && MountedFluidStorage.canUseAsStorage(te)) + fluidStorage.put(localPos, new MountedFluidStorage(te)); if (AllMovementBehaviours.contains(captured.state.getBlock())) actors.add(MutablePair.of(blockInfo, null)); } @@ -489,7 +510,7 @@ public abstract class Contraption { return pos.equals(anchor); } - public void readNBT(World world, CompoundNBT nbt) { + public void readNBT(World world, CompoundNBT nbt, boolean spawnData) { blocks.clear(); renderedTileEntities.clear(); @@ -528,7 +549,7 @@ public abstract class Contraption { if (te instanceof KineticTileEntity) ((KineticTileEntity) te).setSpeed(0); te.getBlockState(); - renderedTileEntities.add(te); + renderedTileEntities.put(info.pos, te); } }); @@ -560,6 +581,24 @@ public abstract class Contraption { NBTHelper.iterateCompoundList(nbt.getList("Storage", NBT.TAG_COMPOUND), c -> storage .put(NBTUtil.readBlockPos(c.getCompound("Pos")), MountedStorage.deserialize(c.getCompound("Data")))); + fluidStorage.clear(); + NBTHelper.iterateCompoundList(nbt.getList("FluidStorage", NBT.TAG_COMPOUND), c -> fluidStorage + .put(NBTUtil.readBlockPos(c.getCompound("Pos")), MountedFluidStorage.deserialize(c.getCompound("Data")))); + + if (spawnData) + fluidStorage.forEach((pos, mfs) -> { + TileEntity tileEntity = renderedTileEntities.get(pos); + if (!(tileEntity instanceof FluidTankTileEntity)) + return; + FluidTankTileEntity tank = (FluidTankTileEntity) tileEntity; + IFluidTank tankInventory = tank.getTankInventory(); + if (tankInventory instanceof FluidTank) + ((FluidTank) tankInventory).setFluid(mfs.tank.getFluid()); + tank.getFluidLevel() + .start(tank.getFillState()); + mfs.assignTileEntity(tank); + }); + IItemHandlerModifiable[] handlers = new IItemHandlerModifiable[storage.size()]; int index = 0; for (MountedStorage mountedStorage : storage.values()) @@ -573,7 +612,7 @@ public abstract class Contraption { anchor = NBTUtil.readBlockPos(nbt.getCompound("Anchor")); } - public CompoundNBT writeNBT() { + public CompoundNBT writeNBT(boolean spawnPacket) { CompoundNBT nbt = new CompoundNBT(); nbt.putString("Type", getType().id); ListNBT blocksNBT = new ListNBT(); @@ -606,14 +645,27 @@ public abstract class Contraption { } ListNBT storageNBT = new ListNBT(); - for (BlockPos pos : storage.keySet()) { + if (!spawnPacket) { + for (BlockPos pos : storage.keySet()) { + CompoundNBT c = new CompoundNBT(); + MountedStorage mountedStorage = storage.get(pos); + if (!mountedStorage.isValid()) + continue; + c.put("Pos", NBTUtil.writeBlockPos(pos)); + c.put("Data", mountedStorage.serialize()); + storageNBT.add(c); + } + } + + ListNBT fluidStorageNBT = new ListNBT(); + for (BlockPos pos : fluidStorage.keySet()) { CompoundNBT c = new CompoundNBT(); - MountedStorage mountedStorage = storage.get(pos); + MountedFluidStorage mountedStorage = fluidStorage.get(pos); if (!mountedStorage.isValid()) continue; c.put("Pos", NBTUtil.writeBlockPos(pos)); c.put("Data", mountedStorage.serialize()); - storageNBT.add(c); + fluidStorageNBT.add(c); } nbt.put("Seats", NBTHelper.writeCompoundList(getSeats(), NBTUtil::writeBlockPos)); @@ -636,6 +688,7 @@ public abstract class Contraption { nbt.put("Actors", actorsNBT); nbt.put("Superglue", superglueNBT); nbt.put("Storage", storageNBT); + nbt.put("FluidStorage", fluidStorageNBT); nbt.put("Anchor", NBTUtil.writeBlockPos(anchor)); nbt.putBoolean("Stalled", stalled); @@ -650,6 +703,8 @@ public abstract class Contraption { public void removeBlocksFromWorld(IWorld world, BlockPos offset) { storage.values() .forEach(MountedStorage::removeStorageFromWorld); + fluidStorage.values() + .forEach(MountedFluidStorage::removeStorageFromWorld); glueToRemove.forEach(SuperGlueEntity::remove); for (boolean brittles : Iterate.trueAndFalse) { @@ -750,6 +805,12 @@ public abstract class Contraption { if (mountedStorage.isValid()) mountedStorage.addStorageToWorld(tileEntity); } + + if (fluidStorage.containsKey(block.pos)) { + MountedFluidStorage mountedStorage = fluidStorage.get(block.pos); + if (mountedStorage.isValid()) + mountedStorage.addStorageToWorld(tileEntity); + } } } } @@ -868,4 +929,10 @@ public abstract class Contraption { return actors; } + public void updateContainedFluid(BlockPos localPos, FluidStack containedFluid) { + MountedFluidStorage mountedFluidStorage = fluidStorage.get(localPos); + if (mountedFluidStorage != null) + mountedFluidStorage.updateFluid(containedFluid); + } + } \ No newline at end of file diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionRenderer.java index ac1093e1b..32398f9e5 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionRenderer.java @@ -71,7 +71,7 @@ public class ContraptionRenderer { private static void renderTileEntities(World world, Contraption c, MatrixStack ms, MatrixStack msLocal, IRenderTypeBuffer buffer) { - TileEntityRenderHelper.renderTileEntities(world, c.renderedTileEntities, ms, msLocal, buffer); + TileEntityRenderHelper.renderTileEntities(world, c.renderedTileEntities.values(), ms, msLocal, buffer); } private static SuperByteBuffer buildStructureBuffer(Contraption c, RenderType layer) { @@ -86,11 +86,13 @@ public class ContraptionRenderer { Random random = new Random(); BufferBuilder builder = new BufferBuilder(DefaultVertexFormats.BLOCK.getIntegerSize()); builder.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); - renderWorld.setTileEntities(c.renderedTileEntities); + renderWorld.setTileEntities(c.renderedTileEntities.values()); - for (BlockInfo info : c.getBlocks().values()) + for (BlockInfo info : c.getBlocks() + .values()) renderWorld.setBlockState(info.pos, info.state); - for (BlockInfo info : c.getBlocks().values()) { + for (BlockInfo info : c.getBlocks() + .values()) { BlockState state = info.state; if (state.getRenderType() == BlockRenderType.ENTITYBLOCK_ANIMATED) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ControlledContraptionEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ControlledContraptionEntity.java index 415fdc885..cc3496b24 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ControlledContraptionEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ControlledContraptionEntity.java @@ -67,8 +67,8 @@ public class ControlledContraptionEntity extends AbstractContraptionEntity { } @Override - protected void readAdditional(CompoundNBT compound) { - super.readAdditional(compound); + protected void readAdditional(CompoundNBT compound, boolean spawnPacket) { + super.readAdditional(compound, spawnPacket); controllerPos = NBTUtil.readBlockPos(compound.getCompound("Controller")); if (compound.contains("Axis")) rotationAxis = NBTHelper.readEnum(compound, "Axis", Axis.class); @@ -76,8 +76,8 @@ public class ControlledContraptionEntity extends AbstractContraptionEntity { } @Override - protected void writeAdditional(CompoundNBT compound) { - super.writeAdditional(compound); + protected void writeAdditional(CompoundNBT compound, boolean spawnPacket) { + super.writeAdditional(compound, spawnPacket); compound.put("Controller", NBTUtil.writeBlockPos(controllerPos)); if (rotationAxis != null) NBTHelper.writeEnum(compound, "Axis", rotationAxis); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MountedFluidStorage.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MountedFluidStorage.java index 0617a77e1..135996fb4 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MountedFluidStorage.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MountedFluidStorage.java @@ -1,5 +1,170 @@ package com.simibubi.create.content.contraptions.components.structureMovement; +import com.simibubi.create.content.contraptions.components.structureMovement.sync.ContraptionFluidPacket; +import com.simibubi.create.content.contraptions.fluids.tank.CreativeFluidTankTileEntity; +import com.simibubi.create.content.contraptions.fluids.tank.CreativeFluidTankTileEntity.CreativeSmartFluidTank; +import com.simibubi.create.content.contraptions.fluids.tank.FluidTankTileEntity; +import com.simibubi.create.foundation.fluid.SmartFluidTank; +import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingValue; +import com.simibubi.create.foundation.networking.AllPackets; +import com.simibubi.create.foundation.utility.NBTHelper; + +import net.minecraft.entity.Entity; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.math.BlockPos; +import net.minecraftforge.common.util.LazyOptional; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.IFluidTank; +import net.minecraftforge.fluids.capability.CapabilityFluidHandler; +import net.minecraftforge.fluids.capability.IFluidHandler; +import net.minecraftforge.fml.network.PacketDistributor; + public class MountedFluidStorage { + SmartFluidTank tank; + private boolean valid; + private TileEntity te; + + private int packetCooldown = 0; + private boolean sendPacket = false; + + public static boolean canUseAsStorage(TileEntity te) { + if (te instanceof FluidTankTileEntity) + return ((FluidTankTileEntity) te).isController(); + return false; + } + + public MountedFluidStorage(TileEntity te) { + assignTileEntity(te); + } + + public void assignTileEntity(TileEntity te) { + this.te = te; + tank = createMountedTank(te); + } + + private SmartFluidTank createMountedTank(TileEntity te) { + if (te instanceof CreativeFluidTankTileEntity) + return new CreativeSmartFluidTank( + ((FluidTankTileEntity) te).getTotalTankSize() * FluidTankTileEntity.getCapacityMultiplier(), $ -> { + }); + if (te instanceof FluidTankTileEntity) + return new SmartFluidTank( + ((FluidTankTileEntity) te).getTotalTankSize() * FluidTankTileEntity.getCapacityMultiplier(), + this::onFluidStackChanged); + return null; + } + + public void tick(Entity entity, BlockPos pos, boolean isRemote) { + if (!isRemote) { + if (packetCooldown > 0) + packetCooldown--; + else if (sendPacket) { + sendPacket = false; + AllPackets.channel.send(PacketDistributor.TRACKING_ENTITY.with(() -> entity), + new ContraptionFluidPacket(entity.getEntityId(), pos, tank.getFluid())); + packetCooldown = 8; + } + return; + } + + if (!(te instanceof FluidTankTileEntity)) + return; + FluidTankTileEntity tank = (FluidTankTileEntity) te; + tank.getFluidLevel() + .tick(); + } + + public void updateFluid(FluidStack fluid) { + tank.setFluid(fluid); + if (!(te instanceof FluidTankTileEntity)) + return; + float fillState = tank.getFluidAmount() / (float) tank.getCapacity(); + FluidTankTileEntity tank = (FluidTankTileEntity) te; + if (tank.getFluidLevel() == null) + tank.setFluidLevel(new InterpolatedChasingValue().start(fillState)); + tank.getFluidLevel() + .target(fillState); + IFluidTank tankInventory = tank.getTankInventory(); + if (tankInventory instanceof SmartFluidTank) + ((SmartFluidTank) tankInventory).setFluid(fluid); + } + + public void removeStorageFromWorld() { + valid = false; + if (te == null) + return; + + IFluidHandler teHandler = te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) + .orElse(null); + if (!(teHandler instanceof SmartFluidTank)) + return; + SmartFluidTank smartTank = (SmartFluidTank) teHandler; + tank.setFluid(smartTank.getFluid()); + sendPacket = false; + valid = true; + } + + private void onFluidStackChanged(FluidStack fs) { + sendPacket = true; + } + + public void addStorageToWorld(TileEntity te) { + if (tank instanceof CreativeSmartFluidTank) + return; + + LazyOptional capability = te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY); + IFluidHandler teHandler = capability.orElse(null); + if (!(teHandler instanceof SmartFluidTank)) + return; + + SmartFluidTank inv = (SmartFluidTank) teHandler; + inv.setFluid(tank.getFluid()); + } + + public IFluidHandler getFluidHandler() { + return tank; + } + + public CompoundNBT serialize() { + if (!valid) + return null; + CompoundNBT tag = tank.writeToNBT(new CompoundNBT()); + tag.putInt("Capacity", tank.getCapacity()); + + if (tank instanceof CreativeSmartFluidTank) { + NBTHelper.putMarker(tag, "Bottomless"); + tag.put("ProvidedStack", tank.getFluid() + .writeToNBT(new CompoundNBT())); + } + return tag; + } + + public static MountedFluidStorage deserialize(CompoundNBT nbt) { + MountedFluidStorage storage = new MountedFluidStorage(null); + if (nbt == null) + return storage; + + int capacity = nbt.getInt("Capacity"); + storage.tank = new SmartFluidTank(capacity, storage::onFluidStackChanged); + storage.valid = true; + + if (nbt.contains("Bottomless")) { + FluidStack providedStack = FluidStack.loadFluidStackFromNBT(nbt.getCompound("ProvidedStack")); + CreativeSmartFluidTank creativeSmartFluidTank = new CreativeSmartFluidTank(capacity, $ -> { + }); + creativeSmartFluidTank.setContainedFluid(providedStack); + storage.tank = creativeSmartFluidTank; + return storage; + } + + storage.tank.readFromNBT(nbt); + return storage; + } + + public boolean isValid() { + return valid; + } + } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MountedStorage.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MountedStorage.java index e1b17a9e0..02ce47715 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MountedStorage.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MountedStorage.java @@ -31,7 +31,7 @@ public class MountedStorage { public static boolean canUseAsStorage(TileEntity te) { if (te == null) return false; - + if (AllTileEntities.ADJUSTABLE_CRATE.is(te)) return true; if (AllTileEntities.CREATIVE_CRATE.is(te)) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/OrientedContraptionEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/OrientedContraptionEntity.java index fc1c04a42..801cdee3b 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/OrientedContraptionEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/OrientedContraptionEntity.java @@ -146,8 +146,8 @@ public class OrientedContraptionEntity extends AbstractContraptionEntity { } @Override - protected void readAdditional(CompoundNBT compound) { - super.readAdditional(compound); + protected void readAdditional(CompoundNBT compound, boolean spawnPacket) { + super.readAdditional(compound, spawnPacket); if (compound.contains("InitialOrientation")) setInitialOrientation(NBTHelper.readEnum(compound, "InitialOrientation", Direction.class)); @@ -170,8 +170,8 @@ public class OrientedContraptionEntity extends AbstractContraptionEntity { } @Override - protected void writeAdditional(CompoundNBT compound) { - super.writeAdditional(compound); + protected void writeAdditional(CompoundNBT compound, boolean spawnPacket) { + super.writeAdditional(compound, spawnPacket); if (motionBeforeStall != null) compound.put("CachedMotion", diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/BearingContraption.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/BearingContraption.java index 8614d6c60..63f141114 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/BearingContraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/BearingContraption.java @@ -62,18 +62,18 @@ public class BearingContraption extends Contraption { } @Override - public CompoundNBT writeNBT() { - CompoundNBT tag = super.writeNBT(); + public CompoundNBT writeNBT(boolean spawnPacket) { + CompoundNBT tag = super.writeNBT(spawnPacket); tag.putInt("Sails", sailBlocks); tag.putInt("Facing", facing.getIndex()); return tag; } @Override - public void readNBT(World world, CompoundNBT tag) { + public void readNBT(World world, CompoundNBT tag, boolean spawnData) { sailBlocks = tag.getInt("Sails"); facing = Direction.byIndex(tag.getInt("Facing")); - super.readNBT(world, tag); + super.readNBT(world, tag, spawnData); } public int getSailBlocks() { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/ClockworkContraption.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/ClockworkContraption.java index 7a772108d..31b7709f3 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/ClockworkContraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/ClockworkContraption.java @@ -100,8 +100,8 @@ public class ClockworkContraption extends Contraption { } @Override - public CompoundNBT writeNBT() { - CompoundNBT tag = super.writeNBT(); + public CompoundNBT writeNBT(boolean spawnPacket) { + CompoundNBT tag = super.writeNBT(spawnPacket); tag.putInt("facing", facing.getIndex()); tag.putInt("offset", offset); NBTHelper.writeEnum(tag, "HandType", handType); @@ -109,11 +109,11 @@ public class ClockworkContraption extends Contraption { } @Override - public void readNBT(World world, CompoundNBT tag) { + public void readNBT(World world, CompoundNBT tag, boolean spawnData) { facing = Direction.byIndex(tag.getInt("Facing")); handType = NBTHelper.readEnum(tag, "HandType", HandType.class); offset = tag.getInt("offset"); - super.readNBT(world, tag); + super.readNBT(world, tag, spawnData); } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/StabilizedContraption.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/StabilizedContraption.java index 2e70f6f92..f54d09beb 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/StabilizedContraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/StabilizedContraption.java @@ -42,16 +42,16 @@ public class StabilizedContraption extends Contraption { } @Override - public CompoundNBT writeNBT() { - CompoundNBT tag = super.writeNBT(); + public CompoundNBT writeNBT(boolean spawnPacket) { + CompoundNBT tag = super.writeNBT(spawnPacket); tag.putInt("Facing", facing.getIndex()); return tag; } @Override - public void readNBT(World world, CompoundNBT tag) { + public void readNBT(World world, CompoundNBT tag, boolean spawnData) { facing = Direction.byIndex(tag.getInt("Facing")); - super.readNBT(world, tag); + super.readNBT(world, tag, spawnData); } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/MinecartContraptionItem.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/MinecartContraptionItem.java index b3822ff1c..94ae89035 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/MinecartContraptionItem.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/MinecartContraptionItem.java @@ -167,7 +167,7 @@ public class MinecartContraptionItem extends Item { intialOrientation = Optional.of(NBTHelper.readEnum(contraptionTag, "InitialOrientation", Direction.class)); - Contraption mountedContraption = Contraption.fromNBT(world, contraptionTag); + Contraption mountedContraption = Contraption.fromNBT(world, contraptionTag, false); OrientedContraptionEntity contraptionEntity = OrientedContraptionEntity.create(world, mountedContraption, intialOrientation); @@ -220,7 +220,7 @@ public class MinecartContraptionItem extends Item { public static ItemStack create(Type type, OrientedContraptionEntity entity) { ItemStack stack = ItemStack.EMPTY; - + switch (type) { case RIDEABLE: stack = AllItems.MINECART_CONTRAPTION.asStack(); @@ -234,12 +234,12 @@ public class MinecartContraptionItem extends Item { default: break; } - + if (stack.isEmpty()) return stack; CompoundNBT tag = entity.getContraption() - .writeNBT(); + .writeNBT(false); tag.remove("UUID"); tag.remove("Pos"); tag.remove("Motion"); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/MountedContraption.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/MountedContraption.java index 47c47f5f1..3d6a28dd8 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/MountedContraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/MountedContraption.java @@ -126,16 +126,16 @@ public class MountedContraption extends Contraption { } @Override - public CompoundNBT writeNBT() { - CompoundNBT writeNBT = super.writeNBT(); - NBTHelper.writeEnum(writeNBT, "RotationMode", rotationMode); - return writeNBT; + public CompoundNBT writeNBT(boolean spawnPacket) { + CompoundNBT tag = super.writeNBT(spawnPacket); + NBTHelper.writeEnum(tag, "RotationMode", rotationMode); + return tag; } @Override - public void readNBT(World world, CompoundNBT nbt) { + public void readNBT(World world, CompoundNBT nbt, boolean spawnData) { rotationMode = NBTHelper.readEnum(nbt, "RotationMode", CartMovementMode.class); - super.readNBT(world, nbt); + super.readNBT(world, nbt, spawnData); } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/PistonContraption.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/PistonContraption.java index eb786c14e..9c67056ee 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/PistonContraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/PistonContraption.java @@ -203,20 +203,20 @@ public class PistonContraption extends TranslatingContraption { } @Override - public void readNBT(World world, CompoundNBT nbt) { - super.readNBT(world, nbt); + public void readNBT(World world, CompoundNBT nbt, boolean spawnData) { + super.readNBT(world, nbt, spawnData); initialExtensionProgress = nbt.getInt("InitialLength"); extensionLength = nbt.getInt("ExtensionLength"); orientation = Direction.byIndex(nbt.getInt("Orientation")); } @Override - public CompoundNBT writeNBT() { - CompoundNBT nbt = super.writeNBT(); - nbt.putInt("InitialLength", initialExtensionProgress); - nbt.putInt("ExtensionLength", extensionLength); - nbt.putInt("Orientation", orientation.getIndex()); - return nbt; + public CompoundNBT writeNBT(boolean spawnPacket) { + CompoundNBT tag = super.writeNBT(spawnPacket); + tag.putInt("InitialLength", initialExtensionProgress); + tag.putInt("ExtensionLength", extensionLength); + tag.putInt("Orientation", orientation.getIndex()); + return tag; } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyContraption.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyContraption.java index 021206c24..d4a48a889 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyContraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyContraption.java @@ -41,16 +41,16 @@ public class PulleyContraption extends TranslatingContraption { } @Override - public CompoundNBT writeNBT() { - CompoundNBT writeNBT = super.writeNBT(); - writeNBT.putInt("InitialOffset", initialOffset); - return writeNBT; + public CompoundNBT writeNBT(boolean spawnPacket) { + CompoundNBT tag = super.writeNBT(spawnPacket); + tag.putInt("InitialOffset", initialOffset); + return tag; } @Override - public void readNBT(World world, CompoundNBT nbt) { + public void readNBT(World world, CompoundNBT nbt, boolean spawnData) { initialOffset = nbt.getInt("InitialOffset"); - super.readNBT(world, nbt); + super.readNBT(world, nbt, spawnData); } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/sync/ContraptionFluidPacket.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/sync/ContraptionFluidPacket.java new file mode 100644 index 000000000..bc0d308bd --- /dev/null +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/sync/ContraptionFluidPacket.java @@ -0,0 +1,53 @@ +package com.simibubi.create.content.contraptions.components.structureMovement.sync; + +import java.util.function.Supplier; + +import com.simibubi.create.content.contraptions.components.structureMovement.AbstractContraptionEntity; +import com.simibubi.create.foundation.networking.SimplePacketBase; + +import net.minecraft.client.Minecraft; +import net.minecraft.entity.Entity; +import net.minecraft.network.PacketBuffer; +import net.minecraft.util.math.BlockPos; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fml.network.NetworkEvent.Context; + +public class ContraptionFluidPacket extends SimplePacketBase { + + private int entityId; + private BlockPos localPos; + private FluidStack containedFluid; + + public ContraptionFluidPacket(int entityId, BlockPos localPos, FluidStack containedFluid) { + this.entityId = entityId; + this.localPos = localPos; + this.containedFluid = containedFluid; + } + + public ContraptionFluidPacket(PacketBuffer buffer) { + entityId = buffer.readInt(); + localPos = buffer.readBlockPos(); + containedFluid = FluidStack.readFromPacket(buffer); + } + + @Override + public void write(PacketBuffer buffer) { + buffer.writeInt(entityId); + buffer.writeBlockPos(localPos); + containedFluid.writeToPacket(buffer); + } + + @Override + public void handle(Supplier context) { + context.get() + .enqueueWork(() -> { + Entity entityByID = Minecraft.getInstance().world.getEntityByID(entityId); + if (!(entityByID instanceof AbstractContraptionEntity)) + return; + AbstractContraptionEntity contraptionEntity = (AbstractContraptionEntity) entityByID; + contraptionEntity.getContraption().updateContainedFluid(localPos, containedFluid); + }); + context.get() + .setPacketHandled(true); + } +} diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/FluidFX.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/FluidFX.java index 6f02282af..21a7bdd33 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/FluidFX.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/FluidFX.java @@ -68,7 +68,7 @@ public class FluidFX { vec = VecHelper.clampComponentWise(vec, rimRadius) .mul(VecHelper.axisAlingedPlaneOf(directionVec)) .add(directionVec.scale(.45 + r.nextFloat() / 16f)); - Vec3d m = vec; + Vec3d m = vec.scale(.05f); vec = vec.add(VecHelper.getCenterOf(pos)); world.addOptionalParticle(particle, vec.x, vec.y - 1 / 16f, vec.z, m.x, m.y, m.z); diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/CreativeFluidTankTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/CreativeFluidTankTileEntity.java index aeb03c5f5..dfa661558 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/CreativeFluidTankTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/CreativeFluidTankTileEntity.java @@ -18,7 +18,7 @@ public class CreativeFluidTankTileEntity extends FluidTankTileEntity { return new CreativeSmartFluidTank(getCapacityMultiplier(), this::onFluidStackChanged); } - class CreativeSmartFluidTank extends SmartFluidTank { + public static class CreativeSmartFluidTank extends SmartFluidTank { public CreativeSmartFluidTank(int capacity, Consumer updateCallback) { super(capacity, updateCallback); @@ -33,7 +33,7 @@ public class CreativeFluidTankTileEntity extends FluidTankTileEntity { fluid = fluidStack.copy(); if (!fluidStack.isEmpty()) fluid.setAmount(getTankCapacity(0)); - notifyUpdate(); + onContentsChanged(); } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankItem.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankItem.java index d126ac868..da2ef25ad 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankItem.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankItem.java @@ -12,6 +12,7 @@ import net.minecraft.util.ActionResultType; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import net.minecraftforge.fluids.FluidStack; public class FluidTankItem extends BlockItem { @@ -41,6 +42,13 @@ public class FluidTankItem extends BlockItem { nbt.remove("Height"); nbt.remove("Controller"); nbt.remove("LastKnownPos"); + if (nbt.contains("TankContent")) { + FluidStack fluid = FluidStack.loadFluidStackFromNBT(nbt.getCompound("TankContent")); + if (!fluid.isEmpty()) { + fluid.setAmount(Math.min(FluidTankTileEntity.getCapacityMultiplier(), fluid.getAmount())); + nbt.put("TankContent", fluid.writeToNBT(new CompoundNBT())); + } + } } return super.onBlockPlaced(p_195943_1_, p_195943_2_, p_195943_3_, p_195943_4_, p_195943_5_); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankTileEntity.java index 88717fd1a..bfe3857c4 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankTileEntity.java @@ -354,7 +354,7 @@ public class FluidTankTileEntity extends SmartTileEntity { fluidLevel.withSpeed(compound.contains("LazySync") ? 1 / 8f : 1 / 2f); } - protected float getFillState() { + public float getFillState() { return (float) tankInventory.getFluidAmount() / tankInventory.getCapacity(); } @@ -414,12 +414,20 @@ public class FluidTankTileEntity extends SmartTileEntity { return MAX_SIZE; } - protected static int getCapacityMultiplier() { + public static int getCapacityMultiplier() { return AllConfigs.SERVER.fluids.fluidTankCapacity.get() * 1000; } public static int getMaxHeight() { return AllConfigs.SERVER.fluids.fluidTankMaxHeight.get(); } + + public InterpolatedChasingValue getFluidLevel() { + return fluidLevel; + } + + public void setFluidLevel(InterpolatedChasingValue fluidLevel) { + this.fluidLevel = fluidLevel; + } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/processing/BasinMovementBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/processing/BasinMovementBehaviour.java index ba5788b1c..4412e0b0c 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/processing/BasinMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/processing/BasinMovementBehaviour.java @@ -8,6 +8,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Mov import net.minecraft.entity.item.ItemEntity; import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Direction; import net.minecraft.util.math.Vec3d; import net.minecraftforge.items.ItemStackHandler; @@ -51,10 +52,9 @@ public class BasinMovementBehaviour extends MovementBehaviour { } context.tileData.put(key, itemStackHandler.serializeNBT()); }); - context.contraption.renderedTileEntities.stream() - .filter(te -> te.getPos() - .equals(context.localPos) && te instanceof BasinTileEntity) - .forEach(te -> ((BasinTileEntity) te).readOnlyItems(context.tileData)); + TileEntity tileEntity = context.contraption.renderedTileEntities.get(context.localPos); + if (tileEntity instanceof BasinTileEntity) + ((BasinTileEntity) tileEntity).readOnlyItems(context.tileData); context.temporaryData = false; // did already dump, so can't any more } } diff --git a/src/main/java/com/simibubi/create/foundation/data/recipe/StandardRecipeGen.java b/src/main/java/com/simibubi/create/foundation/data/recipe/StandardRecipeGen.java index c8f1c91e3..e2ca5de45 100644 --- a/src/main/java/com/simibubi/create/foundation/data/recipe/StandardRecipeGen.java +++ b/src/main/java/com/simibubi/create/foundation/data/recipe/StandardRecipeGen.java @@ -499,7 +499,13 @@ public class StandardRecipeGen extends CreateRecipeProvider { .patternLine(" I ")), PORTABLE_STORAGE_INTERFACE = create(AllBlocks.PORTABLE_STORAGE_INTERFACE).unlockedBy(I::brassCasing) - .viaShaped(b -> b.key('I', AllBlocks.REDSTONE_CONTACT.get()) + .viaShaped(b -> b.key('I', I.brassCasing()) + .key('B', AllBlocks.ANDESITE_FUNNEL.get()) + .patternLine(" B ") + .patternLine(" I ")), + + PORTABLE_FLUID_INTERFACE = create(AllBlocks.PORTABLE_FLUID_INTERFACE).unlockedBy(I::copperCasing) + .viaShaped(b -> b.key('I', I.copperCasing()) .key('B', AllBlocks.ANDESITE_FUNNEL.get()) .patternLine(" B ") .patternLine(" I ")), diff --git a/src/main/java/com/simibubi/create/foundation/networking/AllPackets.java b/src/main/java/com/simibubi/create/foundation/networking/AllPackets.java index 30f793bb5..0d4dbf5fa 100644 --- a/src/main/java/com/simibubi/create/foundation/networking/AllPackets.java +++ b/src/main/java/com/simibubi/create/foundation/networking/AllPackets.java @@ -9,6 +9,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Con import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionStallPacket; import com.simibubi.create.content.contraptions.components.structureMovement.glue.GlueEffectPacket; import com.simibubi.create.content.contraptions.components.structureMovement.sync.ClientMotionPacket; +import com.simibubi.create.content.contraptions.components.structureMovement.sync.ContraptionFluidPacket; import com.simibubi.create.content.contraptions.components.structureMovement.sync.ContraptionInteractionPacket; import com.simibubi.create.content.contraptions.components.structureMovement.sync.ContraptionSeatMappingPacket; import com.simibubi.create.content.contraptions.components.structureMovement.sync.LimbSwingUpdatePacket; @@ -76,6 +77,7 @@ public enum AllPackets { LIMBSWING_UPDATE(LimbSwingUpdatePacket.class, LimbSwingUpdatePacket::new), MINECART_CONTROLLER(MinecartControllerUpdatePacket.class, MinecartControllerUpdatePacket::new), FLUID_SPLASH(FluidSplashPacket.class, FluidSplashPacket::new), + CONTRAPTION_FLUID(ContraptionFluidPacket.class, ContraptionFluidPacket::new), ; diff --git a/src/main/resources/assets/create/models/block/portable_fluid_interface/block.json b/src/main/resources/assets/create/models/block/portable_fluid_interface/block.json new file mode 100644 index 000000000..62c31c029 --- /dev/null +++ b/src/main/resources/assets/create/models/block/portable_fluid_interface/block.json @@ -0,0 +1,8 @@ +{ + "parent": "create:block/portable_storage_interface/block", + "textures": { + "0": "create:block/portable_fluid_interface", + "1": "create:block/copper_casing", + "particle": "create:block/copper_casing" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/portable_fluid_interface/block_middle.json b/src/main/resources/assets/create/models/block/portable_fluid_interface/block_middle.json new file mode 100644 index 000000000..0b3d3ab30 --- /dev/null +++ b/src/main/resources/assets/create/models/block/portable_fluid_interface/block_middle.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/portable_storage_interface/block_middle", + "textures": { + "0": "create:block/portable_fluid_interface" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/portable_fluid_interface/block_middle_powered.json b/src/main/resources/assets/create/models/block/portable_fluid_interface/block_middle_powered.json new file mode 100644 index 000000000..c2a3789b4 --- /dev/null +++ b/src/main/resources/assets/create/models/block/portable_fluid_interface/block_middle_powered.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/portable_storage_interface/block_middle_powered", + "textures": { + "0": "create:block/portable_fluid_interface" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/portable_fluid_interface/block_top.json b/src/main/resources/assets/create/models/block/portable_fluid_interface/block_top.json new file mode 100644 index 000000000..ebd764857 --- /dev/null +++ b/src/main/resources/assets/create/models/block/portable_fluid_interface/block_top.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/portable_storage_interface/block_top", + "textures": { + "0": "create:block/portable_fluid_interface" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/portable_fluid_interface/item.json b/src/main/resources/assets/create/models/block/portable_fluid_interface/item.json new file mode 100644 index 000000000..ffa83d0d0 --- /dev/null +++ b/src/main/resources/assets/create/models/block/portable_fluid_interface/item.json @@ -0,0 +1,7 @@ +{ + "parent": "create:block/portable_storage_interface/item", + "textures": { + "0": "create:block/portable_fluid_interface", + "1": "create:block/copper_casing" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/portable_storage_interface/brass_casing.png b/src/main/resources/assets/create/models/block/portable_storage_interface/brass_casing.png deleted file mode 100644 index fb657ce47b52fd3940f9f47a581da366d3023e64..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 432 zcmV;h0Z;ykP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGizW@LZzX3P}QzQTY0YynfK~y+TjZnc# z!$1(-q)BQLwJ9iAJxMPGDG2_C$6f{hKoAd}{Uv|Iga1%bA!#Amc9U4&=7mZ0AU=l2 z%8!ig~x}(aTt)}zy~u#LB26yw@^Mj z^sdZTp=(p`#PBQ*2co#0APcN=1ItYbqt86H%8k8&3(?Skn4Jn!k7BzF3{F#Q=g>iM zHz63lhE%=}o1q9sOS*kl}v zbmrNy6HQPzxNlKt&p=oWBKl*!O|?BdoW3nTHJBd&=V>uZ&JNn>PZYV6W!kyFzGxHw afl}Y;%erM$6Rz+80000 zaB^>EX>4U6ba`-PAZ2)IW&i+q+O3yqlH)iIh5z#ua|CfGkHa-$ZZOB6?@_Xyl~rBQ z72S5Gtc4<$2Rr~~{qMiq{D+Uf(q%%-CDoKJKB0!{8YkttKkXdt70&T|-1CU*AMTs? z1II1TufH!#dhRdov&cRR%Xs!_+>c*2s_S{se|*rMja+#IJojIMyuAfn&&H-b8+rFg z4)=Ax&AL)8`Kt-zS-+p>#|``&9fHp;#bk5f7~GX}s+<>hg^b^(6y3vBy%+nl(YI^! zTI$frEpPqB(Mdyp|2O_CN5^yBv7CorYeC>7_$fqyBJqQQSUH8_-9L+G2Po1mkgY!N7KP?Ew5e+D~x#1GHyh zPGZ!SeGWP1lyfe* z=4Og7p~R9(E~V7cs;eHxjg@??rPkUSLK{0b-fk>tt-J1f=&`4sd+D{e;mq(Oj5yNB zql`M*bkk4rc&3?WnRT{h7ooJmiYu+W%BrhvLT&pUcHC*_U3N9Qy-|B${ptG$sM!ZK zcaYM;{6>wtIls2BqLV1hK+FXT;8_S*Z=4fmSFs^DAt%hP>d1=dP%;XfX@wXFhGkvc z_Kn>KxoCX)cW^TR;r@;*L#c zIY1N>&s>tiQ=A?_6!f*@EnxFzv{U`Y`@M4lXP;fA(CasD=kZO}i96~6RjVZ#-E8Wc1Ixg#OsWn@DHu;STMT=$!Pc_ zwsH~YpYtTSy2g{B-Y+B>-#D|WdI4M_w-$FwYK4TGqaT^>Jlw6XVL4euBtjy)jNE3x z7~qdszy&Q>{hW7UBbvm>J>M#G(nBo|?mSb75rmj*96{2Q0yHBbwJ~#GmG8w4Xdx2d zT#jpD6ASU6TUYiQ8#{WrqJI`_V^gSh~m9!8Hg# zpp?eWmtS3Ic4=y^7o2{Lcru+3l-Dwj7`zjJp(5P1IS8FNW~n)KyH>)oJ|Vc(XE!@u zt*%PZN-`3%jDeDFNVKi-6rB;3}~u zJmik!Lj&KNM8cKuVU0x2oYx_j90@D31xx4WiG3xyIayCUgOpf%C#Qt4SodNr+zB|A z_-Iu_!amMhRm478J_JagomDwn4jP+Wt#?`YvX-r3gaLx63fU{ufcMJZ#F*d9`CDR+ z1;+hMz<>G+4-GV$s=EY^?uZpt9&+~+pfi(`jVo+|J4GEc2mKb8A;A>kUg)_Hbp~Mj zOuiJ<#m2+yXitpHNMi=59S5z^_hM9`m%aiCRk)rsSr47CfhmRY0&4u!WQBt8_M%hB z3>qnmr4zr5q+sp{<8dMSR`8|KQ&odk^*)i{bel$sF$6LesksWz63>{p=&0K29O_m) z(gHa=l*N%Tv&zt$t?21xc$EWqsS+{*)guCmgf8g3778O{v4rRAE}7)`4isKa4J=B( zG{^Rf2-&n&c;BLKm&@qsW=c+lv8!AHNj^#2Y1x|ar+*?smS`la5>b(eJKIkZc(r6` zoM7wI87ZsAK&DTfQYvK{+>DN8vODs#Nhp9S^6GVtMe0)5P-$h_zfB7FNKnFkJ9=ij z1zVn?P1|RE*2N+J8sST_+@TYMqARLg)YmcD!J80$AKP_NRAod-by7>C5&#lj>;PwD z4rG1&QxtUZ$}_!KkCGqZNfy_g#Hr-sdS+#C=?H>2<$-7O}tGw&;^H| zIy&rMmsoRkpxOUb7!9=Rg*v2muw>DspN|mfE1oPk_p?*C;e2$ zhg!JQ9U)JvhrKPDpZp?sDa?*vxS;gJ^~pG(o?!T7923oyUJS=mIfP6Rz^`&H$Ryf| z0r@3#Y9t9rdeye7iDEQQ%K_DfQ&E)#wVYrfs$eu%h%XV8TEvS!X2%mhOkn-;ccgH8 zpC6oNj@RT?z*d*k(!5iQW|YmrlpI%ImDERUm0MrA68)>@N z`5APUGpwGd*zr`&JV|jCQmTDjlox#SjDD&ia+2z(-*o=!Z4FDx=Y6JQ&Ya}L|L*FHGGpZd7>h}$;F~!XD2w?d1iKAIAyR_z(~u`H^wnE zQZ2^*!MLY1q%^s#*0M9+`{1da%o3_cH2;>;9XiCY7)jJ7OJ#G{%{l!beorS#bZIC` zysgOY;xs4PtBEo??q;`Xc!L*4vUd{=v2``aYV*O1N~!*gwM;8$hdSS1bosOz?|xM6 zG@Xh0KZ+4D_9RJj)&Kwi24YJ`L;(K){{a7>y{D4^000SaNLh0L04^f{04^f|c%?sf z00007bV*G`2jmGB6e%;=+H6+<000?uMObu0Z*6U5Zgc=ca%Ew3Wn>_CX>@2HM@dak zSAh-}000EJNkl8 z94r2T+&Jdg0}?k{B!nu|v>@P&P*tIV1WFJR>IEf-WSwr-cE;m12YY76&bFvc-(|*c z_dE0E`@Zja?3HDSvGeCHluBs;fXj>{)*2xM0A}v`0Pd}? zTfA@===TFVYOMi*5FJ2RpS#dJ(|U>!)#h4H0p0Mm@uCUVD5VjigVxjfXnd|7jvs%Equ>t(ptUAVQwvJd)Q;|g z#(dxBDELDum?ViE(=-LJqw6y!Wsjra0X$QNH*VZ0^E@Zd^XIDE_kDcd=l1Q}-qO;0 zY;OMX()b1gd7g86X^CGSKW6{I0|r0@jPO{bWD8ihbcr*|%lx^ySu-G+hkxV#ea-@} z1MdJ2>-iU#FE{WF4di*w&%ZomclRkhJR)EWEK)KCdU)*aKIP$~NA{G1Fk~M7Ebv;r z`ICD7JsiR}7$|CmhG8G?!g=DltPTJnIuv?}P<3<3vI^`p6&L^Q#f!EqsquOaz7arG ztJ=DgBy%=s*0q5Jf#4|kRsd5bNn&Yr=VpVpuWHjTk8cE^l(uCu2*XCn48pKcMrIK= z1uui2lY+wj$(@^eZu`2Toq`v`Hv%wCq`im>ZvTE}d6}c&8;$5FcK!PGa(_HVYt7oq zkiD&#)w?iUTm&E}HQz7mJ<=*-nvg;rBk zQKE{Hpz9IJE}`rabUn11+Td<|wP_asSiM{2)==zj?gmkoB~nU+5Uk#9_kp}*ghJ;f z!uQzAD+Yu=y8xTt+BRHVBu!J&G_|zPvn~ce6Oj2YqR?xU zA8JHqZh{j+aPwBocOSL_IDV{eg=bG5G^q@v$0$`~Nls6SMtgNTT%omX#m0Y-Wrw~M zJMCP#Vl$$21uBA$WyRP+6xoH>R)$s+CM724Yb!(AZCd~&6OT_mKKZ{TGpMg%gMPr% zbXM=?gh`^<+ltxV*(XT?pi+90D7JT$orhtCu>r(!N*vE#KF@v`9UOWY%`PL=cj5Mq sVv;Ge?x6MTGkuaNws-a&f0e5L0P#E|0%6t&tN;K207*qoM6N<$g5E>mq5uE@ diff --git a/src/main/resources/assets/create/textures/block/portable_fluid_interface.png b/src/main/resources/assets/create/textures/block/portable_fluid_interface.png new file mode 100644 index 0000000000000000000000000000000000000000..b0768413a79753ba2168b6a2fbcba7df4386ffe4 GIT binary patch literal 822 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyjKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCijU1^9%xg48;@+Sxk#czb)eyIWb>>gyY;scA(x|+ePB*-uLKRJM5VZWat&;-r`kH}&M20bMZW?c2? z?j)e$w>@1PLoEDrCv}%Ca^Pv3D}5#NYS!rni!BEZ6+{-6hTr>t_1pOu-{x$THvFhQ z|D?)>8P8`Hp8L?)-oU9@aFCOOiA8vlr^T+1D>x^_1hL-v@-yJKSXbfEhwpTmd>Q(8 zbcx7({}~{>AW8J7;G9oDmIGJYgU<`uK5V&C9&HzBcZFfv`A4Z+@2!bH@_7=&i|cRS zA1UX!8UGo+tn*lCTDeEC zyLR6D@Bd@w$*27}o3Xf1QiOTJ(rrI}Xe3-qdzt9B^rz10RjW?RXD~0=nEN{B`JC+A z%Ph~#ypnqL@T#EGJPooj=95b2O4rG)boKnXZ+*UQ&TZbyoMwEn+zfAP8~6QhZ9dbz zr%?9O<)1b4c5VB~_lDa%NKEutH*ue1ZY`k~wsSL5OyP-2PYfX~5{`39%Ytnx#wB4fzjC%%8S3j3^P6 Date: Wed, 25 Nov 2020 16:13:45 -0600 Subject: [PATCH 6/7] "but the copper doesn't look minecraft-y enough!!" yeah?? here you go, shush --- .../textures/block/bearing_top_wooden.png | Bin 516 -> 867 bytes .../textures/block/brass_storage_block.png | Bin 0 -> 394 bytes .../textures/block/oxidized/copper_block_0.png | Bin 552 -> 389 bytes .../block/oxidized/copper_shingles_0.png | Bin 295 -> 373 bytes .../textures/block/oxidized/copper_tiles_0.png | Bin 625 -> 398 bytes .../textures/block/windmill_bearing_side.png | Bin 432 -> 495 bytes .../assets/create/textures/block/zinc_block.png | Bin 642 -> 324 bytes 7 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/main/resources/assets/create/textures/block/brass_storage_block.png diff --git a/src/main/resources/assets/create/textures/block/bearing_top_wooden.png b/src/main/resources/assets/create/textures/block/bearing_top_wooden.png index f9977a98dbe41cc77c7848a5761ac406fa2bc023..05fb05a4dc518ec47168dcf628fd82d849adb645 100644 GIT binary patch delta 827 zcmV-B1H}A<1mgyf83+ad001BJ|6!3KAb$yPNLh0L01m$Z01m$aI0aKA0008`NklZTT~r5hn8;7nr7hnWvDlbOkk@6EjVczySd32pyyIPc#7|9{+j z&O7H?!r`!yip2=uzr+9W-RzIj&&_@-{l9VL`fdDOU06l1K#R*+w@`qV{XW`!3W5{n z?`ffRsAF$m=mZ33nF#GOgo2fx33N_JCY{&|$DsYoR>Rx4Zdf7r*^REWYy9q*&4XV4t* z(7aP(aeWJ$V&TQ(1vFK|>2}cB-_F};442bQSt*i_7fHX_#+%k;2J!$;seeM#g)x-X zZI%-$E?&RDxi6>ib$AK12hb`ip`if^r92Hj2WnDBG3!^eMQq>C{WRMi947MM7d)4T zuJP5X&2CrLeBVfu?3oSwdheYcGQYp*saq*WH5MWlIJ z-Ew`PuZx8z5&lZQkh-8nx_^2bkM%Se-R+I6^|mlRbClDglSGzZNx{SWj~Kr?B5xKr z+&3V(KOQ{C`{x_Baz(6emz}Ctkpdyy4UX?@$_(-wYP}S5Ex71Hl*YFi%;AwbIY_QU zej4>E=_5WqyL3j1Mam-m-7*Bc=6B67*pB8os8z{q=H7Qfv7-)laer=N1PmA*K7ra; zz~}RkOYJcF)gULv$2foNIP<^$P2M~tV0J(?ySF#WHiw16sa_gd9hA~#tjQeOY8HRB zhCY1=qXv4WEcxP-72G?z9Ob>&_}kC-um;?y4R%?Mz?GT1(uaSzx%Zz8vmA@X!slP# z`tNHLr={1jXwej@)hJBeOitK(@|~<#ShiS}T7gt7#y?ORanmp+G0gw~002ovPDHLk FV1nE{l*Ir5 delta 473 zcmV;~0Ve+A280BV83+Ra001a04^xpLAb+}0OjJdwsi~EZk2N6=Fdhy&CJ{p{6i-qp zPedV8I2uw(BT-f=ScgnASt?6>KSWq6LUcEKylaZTZ>#2*Zns!rnodG;GIF$7i@k1M zoKHDuEk7v|Pcj&4wpfJ6bZfa;Ghrw{bTWg+b8N9zSeZ#RSt?+RQLF2mMshnoNPir?bH;?DJYT+DHs|8qftUj$VfM_imgOh@KaLvpIfY|!r0E}&B zaXwFN*h{eq4vk&xA1n`#j!#a{==@@Z1{dj)g>oUex=t%=u#H)5=`^AB6oi{L^DT47 zA~h-w0u^HFiZI>nu%YCfOTJf$irw@{w2+0hSA$}GVrD5s!Vj(9utO~BwMLU4pSE8A zc&;z6Z$d@hKZb2ktn2GoKfl8GUB@4172|$~7>((@|8qO6jz zijNM?J1ic^yQAc-Tu7I}gXsbZJ8Hig-e6FhaNuzH`v*ey`~IqRI6k<#JU>Ayhk>KP zWdEM;QfK~s`O7YIn4#zV!J}NFjSM>&<>PA@E}xk7!@}}_iI0!Z4DlR6qXy{)9tWw! zS&0nGB+~?W5+oRcIEvLaomJT1yywTOx9K9z0Xz(uEvza&#vVLk1t;z?H^$4`Ir2;p z7h>W*z$COx;0bTZ*%xuiO`He*wC8biC}g+o4C?9U)@c*sHn=^3aaURigBin=2??_t zxe_IoFp4ysVC?35peGP6#F{+8NrKH%RN9TL$M}@bgPk7_TX$44IsHFiV$^U_kvTxe kKzopr0OWg%jsO4v literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/create/textures/block/oxidized/copper_block_0.png b/src/main/resources/assets/create/textures/block/oxidized/copper_block_0.png index ee40eba885e569869a992ae5f5ad5426c7edff63..7897603882a48a9b32054b3b67c03b3470c443fb 100644 GIT binary patch delta 337 zcmV-X0j~b21cd{T83+ad001BJ|6!3KD1X8L01m&O!5}KY49DmISsuiO0k{Ew zKl}#MuRr_+(=XqA0n;#mEDvLY0Nel&07)X-{^}E|Auz*X03^@!`N?N62VGKJgntK2 zqszlAfVmLG1t3W&6+tKu6Ck?|2H*x@(=5iv!@w)U3uePKGYhbSX_yO{UPz(fY<7J$5n5skP2x@H)F8-N^5$WDX- znCsBx;DHDN*fb-j1LPzO1B?$QB|iO!vN6E!eGeFd;&kDLpo5EN-Y_uE4siPa^4mYC j5GD}kVq(B8&%gixdJK^Hkl4Lh00000NkvXXu0mjfx;cg_ delta 501 zcmVU$83+OZ005AYXf}}{D1XBM01m?e$8V@)0005KNkle3}^0~P2Ed9I$_X(AXD2ZzP6ZV5ataaiqoGvX8_a{FOJ;5m-4kRKVzcga7NC~(D!T{Rnc zG~30)xJkUUB=o05*Cl1cp$^RV@za{lr2G$3BohGvF5k`ZobvrjWxU~qzCP}2W@cDs zYNb!UeltfWR2Bfh$6`SUQj)d>-GA&%k6UxVp&p$XST78|Jyd-OkpJY rc7xlRpTkCP2D4N+8bh@G4?=zc>$$)Z7fozP00000NkvXXu0mjfJHp~4 diff --git a/src/main/resources/assets/create/textures/block/oxidized/copper_shingles_0.png b/src/main/resources/assets/create/textures/block/oxidized/copper_shingles_0.png index 385718f7ef13e8b45050ddb1ed459f61e4767b38..3a661304f34053d24c0acb6481e64ea16d02b785 100644 GIT binary patch delta 330 zcmV-Q0k!_80`&rr7zqdl0000V^Z#LyAs~MVa7bBm000ib000ib0l1NC?EnA)3Q0sk zR5(wKk}+-qF%U()i|CdJBp?z(spx4q2S=dbES!KNqTkN4Rs*#@Vm7nosc!+@5RdIBKw(5%fHjPn%?Pu6ycS|*Yoy6l7{!5gAVe&*Sy^Q8kPf=T!RwPJW&ba<`|epUXO@geCx@pT@`&kWD*yk}q*U}X>&;bGvF;bl0o;XVTh;FD((6<`K4B(0Pfq*Me^ zBtdf6h7WL?<*zaM^sop$Nc8?d0B zo(Ka>3`TOz!uLSfICdyFaQ86=k0rw|GpOh0000 z{qW25q5WNAorvM_e>ty?y&amFTCoj-hl<8bQn|5-JxOn(xvy(>qtZ~`bUcd?;Kv7e z;bNXY)@MdxD02)&o~}YMdAJ2rl^W zfsG_HXAMta4xZ$@GnPmnprctI1m@;Co1twjc7x_Vq0GUvR6}>q$447JdE=)K2<({R6L;%&|{J*M_}SRFqh|R)&uJP$4nABZ^zyS$$=@<89vr%AmaZ%2|9kc zwO7~uquVd7JxO39@Ps;_A3ti}^Z|#5x3SHWJENz4sB`H1FwzGg1!hhQy+T8w{{a+v VLbQAOf|z*bpa+k}pM&86y!rs1cowc)B*7nklCou`)Xqnjw2dB&lT3GZW_H_b zS9H7Gu-EI+%hL^IarO92zhy_QYpU1lWT4RR_sO-*6ak$%W+9bf4j;JzF&qwQBo$Ky ze<2glnWw(k)18T@*hg+a08?+l9E>CrI+J#$-EX%86yPI7jcFZzOK-@50TJ z!-d(@Bds;y0a+hFCK|_$)rrM$oYf!jf1-m*Li<26Gw?Xv-%S-X;8m(FkCyE)0eB$5 z8+iVl!)%c~YhyjS+vRlzjlQAZoGrqK*7z8G(qQmPzVz5vzR!LB0xU2si;H?h2(9O} z+8#6Oi;LD->Ja}5(Y|c|YXif!im{AtTBO09+5r=&xYadvo}7#3d6U0DUs+sJ9gXZY d29h2T(Kqh=%g+N1afko_002ovPDHLkV1h@m&rbjV delta 369 zcmV-%0gnFf1F!>-83+Ra001a04^xpLAb*5VOjJd-wziIrjx`|dD->Q}Ut?xtT3uR+kB^3khkSp4f`x>Cf`WN`d4h+Ac6oPy zgobi*kf^GAo;Omla0Te(aykvsO|Nqa-M|w%F z*EUz8OsT~}C4*<^_0kxVXFAVKzSJ3MTa+tPYP&M)vap)0#i~-);w~Av%@^ML4a(7$ zrK)y&J}@6o6$h%DI@C=Qnox%Tl5_331upHyot<;kMWBmU)JKU-d+BB19{y3f4Kj@P zzw$tjDNgYTCXJ7XP-G!71-CDR&MYF#GJ{89A(>~9aYT;^Na^X{=MeATOP&*Z_`eGu P00000NkvXXu0mjfk?EjW diff --git a/src/main/resources/assets/create/textures/block/zinc_block.png b/src/main/resources/assets/create/textures/block/zinc_block.png index c1b565cfbe92ef285547e63570100c13b724b80d..6ef49c21b226074381e765ce4bca2f2835aeafb6 100644 GIT binary patch delta 271 zcmV+q0r38U1;hf783+ad001BJ|6!3KD1X5K01m+cxRGn^0002lNklEm5A9l#95>jHc>!vNR-e11eX1f~{iAR-&|?9^E(3qN4=4)XjDWs?CI7yyYr VT>jVL?_mG{002ovPDHLkV1m#%Xwd)w delta 592 zcmV-W07Qe;Pgz8ec+u$j2$GQKjDhFfdJXI-S<*4Sz*Z zL{T7;7zSA!|K|CIZO=8$U@XhBbU3`nMNwcZSk|m4s{NjAHXfYxce^m$5ki9??)AE| zT;ur~LO6;NbbI@w-~S{@^_Q;yl;_OzmQbsz;5jB4dtR-UHCZO-=en+IuIsc~9aW{{ z@tD$gs;VkVb29ma#U<$rSd1W0+BhNIDl<0{8_vaE?95Z8U;xV`JnJDnDA zLit96wA(5KuSjKC!Z%=Sw{Kw%Iw0{kH=j-O;_B*s5bO-2+itgdJwp`hfC2d=i72Ip zp9A~yz%mo3# zI}EpyRP(&e*;(gc*IT5MFbAC&9L%UJF~-GeB~z+c)-Ui4@|xDo^L>)UN2Dm)K0Ms# z`SWZxU$5<=NJNqIyp^sS+dZwX>m5Q$D9;$HsuJDZeItax6_1Vot}*N!1hQO@qVzCO e5bS)GWq$x Date: Thu, 26 Nov 2020 00:17:49 +0100 Subject: [PATCH 7/7] Get to the copper! - Some asset rewiring --- src/generated/resources/.cache/cache | 2 +- .../assets/create/models/block/brass_block.json | 2 +- src/main/java/com/simibubi/create/AllBlocks.java | 6 ++++-- .../create/models/block/hose_pulley/block.json | 4 ++-- .../block/hose_pulley/copper_pulley.bbmodel | 1 - .../block/hose_pulley/copper_pulley_rope.bbmodel | 1 - .../create/models/block/hose_pulley/item.json | 4 ++-- .../assets/create/models/block/spout/block.json | 2 +- .../assets/create/models/block/spout/item.json | 2 +- .../create/textures/block/copper_plating.png | Bin 0 -> 552 bytes 10 files changed, 12 insertions(+), 12 deletions(-) delete mode 100644 src/main/resources/assets/create/models/block/hose_pulley/copper_pulley.bbmodel delete mode 100644 src/main/resources/assets/create/models/block/hose_pulley/copper_pulley_rope.bbmodel create mode 100644 src/main/resources/assets/create/textures/block/copper_plating.png diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index b6479389a..e31caaba9 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -491,7 +491,7 @@ bc23a91f300e46761bb14c597fad39c3d414e84d assets/create/models/block/brass_belt_f dfc6250e28e12ff193a45891978ec50c406fc0c2 assets/create/models/block/brass_belt_funnel__pulling.json 5409325494780afe32e6e30377314e2992ca4aa5 assets/create/models/block/brass_belt_funnel__pushing.json 97410a12b7c1461f88fb633f26ff566a0636b627 assets/create/models/block/brass_belt_funnel__retracted.json -0934933df6bfbb19a1b14cd0e3cab2c18d5a3ebc assets/create/models/block/brass_block.json +71d0ad31d89d4ea3f243c6003b17f57fd168c933 assets/create/models/block/brass_block.json 166a5c053a81e6aadc24509ed24dc144a7255969 assets/create/models/block/brass_casing.json 838e7ab4c0c9d89eacfa078daf64995e505db896 assets/create/models/block/brass_funnel.json 6099ba0366065d15d3b2821474850a1ae85485ea assets/create/models/block/brass_funnel_powered.json diff --git a/src/generated/resources/assets/create/models/block/brass_block.json b/src/generated/resources/assets/create/models/block/brass_block.json index 6c71856ea..aebde89ac 100644 --- a/src/generated/resources/assets/create/models/block/brass_block.json +++ b/src/generated/resources/assets/create/models/block/brass_block.json @@ -1,6 +1,6 @@ { "parent": "block/cube_all", "textures": { - "all": "create:block/brass_block" + "all": "create:block/brass_storage_block" } } \ No newline at end of file diff --git a/src/main/java/com/simibubi/create/AllBlocks.java b/src/main/java/com/simibubi/create/AllBlocks.java index d235fc682..c4861f26c 100644 --- a/src/main/java/com/simibubi/create/AllBlocks.java +++ b/src/main/java/com/simibubi/create/AllBlocks.java @@ -564,7 +564,7 @@ public class AllBlocks { .register(); public static final BlockEntry[] DYED_VALVE_HANDLES = new BlockEntry[DyeColor.values().length]; - + static { for (DyeColor colour : DyeColor.values()) { String colourName = colour.getName(); @@ -630,7 +630,7 @@ public class AllBlocks { .item(BasinOperatorBlockItem::new) .transform(customItemModel()) .register(); - + public static final BlockEntry PORTABLE_FLUID_INTERFACE = REGISTRATE.block("portable_fluid_interface", PortableStorageInterfaceBlock::forFluids) .initialProperties(SharedProperties::softMetal) @@ -1211,6 +1211,8 @@ public class AllBlocks { public static final BlockEntry BRASS_BLOCK = REGISTRATE.block("brass_block", p -> new MetalBlock(p, true)) .initialProperties(() -> Blocks.IRON_BLOCK) + .blockstate((c, p) -> p.simpleBlock(c.get(), p.models() + .cubeAll(c.getName(), p.modLoc("block/brass_storage_block")))) .tag(Tags.Blocks.STORAGE_BLOCKS) .transform(tagBlockAndItem("storage_blocks/brass")) .tag(Tags.Items.STORAGE_BLOCKS) diff --git a/src/main/resources/assets/create/models/block/hose_pulley/block.json b/src/main/resources/assets/create/models/block/hose_pulley/block.json index 4e251b554..78baefdcc 100644 --- a/src/main/resources/assets/create/models/block/hose_pulley/block.json +++ b/src/main/resources/assets/create/models/block/hose_pulley/block.json @@ -3,9 +3,9 @@ "parent": "block/block", "textures": { "4": "create:block/copper_gearbox", - "8": "create:block/oxidized/copper_block_0", + "8": "create:block/copper_plating", "9": "create:block/fluid_pipe", - "particle": "create:block/oxidized/copper_block_0" + "particle": "create:block/copper_plating" }, "elements": [ { diff --git a/src/main/resources/assets/create/models/block/hose_pulley/copper_pulley.bbmodel b/src/main/resources/assets/create/models/block/hose_pulley/copper_pulley.bbmodel deleted file mode 100644 index 341190326..000000000 --- a/src/main/resources/assets/create/models/block/hose_pulley/copper_pulley.bbmodel +++ /dev/null @@ -1 +0,0 @@ -{"meta":{"format_version":"3.2","model_format":"java_block","box_uv":false},"name":"item","parent":"block/block","ambientocclusion":true,"resolution":{"width":16,"height":16},"elements":[{"name":"coil","from":[4,4,2],"to":[12,12,14],"autouv":0,"color":6,"rotation":[0,0,-45],"origin":[8,8,-10],"faces":{"north":{"uv":[0,0,0,0],"texture":null},"east":{"uv":[2,1,14,9],"texture":3},"south":{"uv":[0,0,0,0],"texture":null},"west":{"uv":[2,1,14,9],"rotation":180,"texture":3},"up":{"uv":[2,1,14,9],"rotation":270,"texture":3},"down":{"uv":[2,1,14,9],"rotation":90,"texture":3}},"uuid":"c6880831-d683-f703-04a3-fd39148ebb5c"},{"name":"coil","from":[3.5,3.5,3],"to":[12.5,12.5,7],"autouv":0,"color":6,"rotation":[0,0,45],"origin":[8,8,-10],"faces":{"north":{"uv":[0,0,1,1],"texture":3},"east":{"uv":[0,3,4,12],"rotation":180,"texture":3},"south":{"uv":[0,0,1,1],"texture":3},"west":{"uv":[0,3,4,12],"texture":3},"up":{"uv":[0,3,4,12],"rotation":90,"texture":3},"down":{"uv":[0,3,4,12],"rotation":270,"texture":3}},"uuid":"d93793b9-dd62-5818-2564-da40eed87601"},{"name":"side","from":[2,2,14],"to":[14,14,15],"autouv":0,"color":2,"origin":[8,-8,8],"faces":{"north":{"uv":[2,2,14,14],"texture":2},"east":{"uv":[0,0,0,0],"texture":null},"south":{"uv":[2,2,14,14],"texture":2},"west":{"uv":[0,0,0,0],"texture":null},"up":{"uv":[0,0,1,12],"rotation":270},"down":{"uv":[2,11,14,12],"texture":2}},"uuid":"50235661-64a5-c971-c6e6-0975baa71d99"},{"name":"side","from":[2,2,1],"to":[14,14,2],"autouv":0,"color":3,"origin":[8,-8,8],"faces":{"north":{"uv":[14,2,2,14],"texture":5},"east":{"uv":[0,0,0,0],"texture":null},"south":{"uv":[14,2,2,14],"texture":5},"west":{"uv":[0,0,0,0],"texture":null},"up":{"uv":[1,0,0,12],"rotation":270},"down":{"uv":[2,12,14,11],"texture":2}},"uuid":"f16b6f4f-7c00-62c6-e29b-a9d790a92d84"},{"name":"side_frame","from":[0,2,14],"to":[2,14,16],"autouv":0,"color":3,"origin":[8,1,8],"faces":{"north":{"uv":[14,2,16,14],"texture":5},"east":{"uv":[0,2,2,14],"texture":5},"south":{"uv":[14,2,16,14],"rotation":180,"texture":5},"west":{"uv":[14,2,16,14],"texture":5},"up":{"uv":[0,14,2,16],"texture":5},"down":{"uv":[0,0,2,2],"texture":5}},"uuid":"8e0b92f4-fea1-c76e-eec7-fa197247034b"},{"name":"side_frame","from":[0,2,0],"to":[2,14,2],"autouv":0,"color":6,"origin":[8,1,8],"faces":{"north":{"uv":[16,2,14,14],"rotation":180,"texture":5},"east":{"uv":[2,2,0,14],"texture":5},"south":{"uv":[16,2,14,14],"texture":5},"west":{"uv":[16,2,14,14],"texture":5},"up":{"uv":[0,16,2,14],"texture":5},"down":{"uv":[0,2,2,0],"texture":5}},"uuid":"c6e4de46-37af-8304-d04a-e3a06202a6d1"},{"name":"side_frame","from":[14,2,14],"to":[16,14,16],"autouv":0,"color":7,"origin":[8,1,8],"faces":{"north":{"uv":[2,2,0,14],"rotation":180,"texture":5},"east":{"uv":[16,2,14,14],"texture":5},"south":{"uv":[16,2,14,14],"rotation":180,"texture":5},"west":{"uv":[2,2,0,14],"texture":5},"up":{"uv":[2,14,0,16],"texture":5},"down":{"uv":[2,0,0,2],"texture":5}},"uuid":"22157158-613c-9abb-d3b9-2a2d576e1f98"},{"name":"side_frame","from":[14,2,0],"to":[16,14,2],"autouv":0,"color":5,"origin":[8,1,8],"faces":{"north":{"uv":[14,2,16,14],"rotation":180,"texture":5},"east":{"uv":[14,2,16,14],"texture":5},"south":{"uv":[0,2,2,14],"rotation":180,"texture":5},"west":{"uv":[0,2,2,14],"texture":5},"up":{"uv":[2,16,0,14],"texture":5},"down":{"uv":[2,2,0,0],"texture":5}},"uuid":"82c9a138-92db-c34a-f8e7-45283db7413d"},{"name":"side_frame","from":[0,0,14],"to":[16,2,16],"autouv":0,"color":3,"origin":[8,1,8],"faces":{"north":{"uv":[0,14,16,16],"texture":5},"east":{"uv":[0,14,2,16],"texture":5},"south":{"uv":[0,14,16,16],"texture":5},"west":{"uv":[14,14,16,16],"texture":5},"up":{"uv":[0,14,16,16],"rotation":180,"texture":5},"down":{"uv":[0,14,16,16],"rotation":180,"texture":5}},"uuid":"6965d55e-49aa-ab6d-4568-5de4c1501c57"},{"name":"side_frame","from":[0,14,14],"to":[16,16,16],"autouv":0,"color":2,"origin":[8,15,8],"faces":{"north":{"uv":[0,16,16,14],"texture":5},"east":{"uv":[0,16,2,14],"texture":5},"south":{"uv":[0,16,16,14],"texture":5},"west":{"uv":[14,16,16,14],"texture":5},"up":{"uv":[0,16,16,14],"rotation":180,"texture":5},"down":{"uv":[0,16,16,14],"rotation":180,"texture":5}},"uuid":"639134c9-125c-c945-7ece-ee0b946543c7"},{"name":"side_frame","from":[0,0,0],"to":[16,2,2],"autouv":0,"color":2,"origin":[8,1,8],"faces":{"north":{"uv":[16,14,0,16],"texture":5},"east":{"uv":[2,14,0,16],"texture":5},"south":{"uv":[16,14,0,16],"texture":5},"west":{"uv":[16,14,14,16],"texture":5},"up":{"uv":[0,16,16,14],"rotation":180,"texture":5},"down":{"uv":[0,14,16,16],"texture":5}},"uuid":"b27e1c88-26b6-190b-f005-a259810655a1"},{"name":"side_frame","from":[0,14,0],"to":[16,16,2],"autouv":0,"color":6,"origin":[8,15,8],"faces":{"north":{"uv":[16,16,0,14],"texture":5},"east":{"uv":[2,16,0,14],"texture":5},"south":{"uv":[16,16,0,14],"texture":5},"west":{"uv":[16,16,14,14],"texture":5},"up":{"uv":[0,16,16,14],"texture":5},"down":{"uv":[0,14,16,16],"rotation":180,"texture":5}},"uuid":"e06d0f90-92de-1302-190a-fbd10c267e74"},{"name":"front","from":[1,1,2],"to":[3,3,14],"autouv":0,"color":1,"origin":[8,-8,8],"faces":{"north":{"uv":[0,0,0,0],"texture":5},"east":{"uv":[2,14,14,16],"rotation":180,"texture":5},"south":{"uv":[0,0,0,0],"texture":5},"west":{"uv":[2,14,14,16],"texture":5},"up":{"uv":[2,0,14,2],"rotation":270,"texture":5},"down":{"uv":[2,14,14,16],"rotation":90,"texture":5}},"uuid":"8f39075d-3ce3-b4f6-6ef0-6bb131af4333"},{"name":"front","from":[13,1,2],"to":[15,3,14],"autouv":0,"color":1,"origin":[8,-8,8],"faces":{"north":{"uv":[0,0,0,0],"texture":5},"east":{"uv":[14,14,2,16],"texture":5},"south":{"uv":[0,0,0,0],"texture":5},"west":{"uv":[14,14,2,16],"rotation":180,"texture":5},"up":{"uv":[2,2,14,0],"rotation":90,"texture":5},"down":{"uv":[2,16,14,14],"rotation":90,"texture":5}},"uuid":"4af7b711-49e2-96cc-804f-025c079ee52f"},{"name":"front","from":[13,13,2],"to":[15,15,14],"autouv":0,"color":1,"origin":[8,10,8],"faces":{"north":{"uv":[0,0,0,0],"texture":5},"east":{"uv":[14,16,2,14],"texture":5},"south":{"uv":[0,0,0,0],"texture":5},"west":{"uv":[14,2,2,0],"texture":5},"up":{"uv":[14,15,2,13],"rotation":90,"texture":5},"down":{"uv":[14,2,2,0],"rotation":90,"texture":5}},"uuid":"ecde023c-1297-0247-44c2-571ac0de9df1"},{"name":"front","from":[1,13,2],"to":[3,15,14],"autouv":0,"color":0,"origin":[8,10,8],"faces":{"north":{"uv":[0,0,0,0],"texture":5},"east":{"uv":[2,2,14,0],"texture":5},"south":{"uv":[0,0,0,0],"texture":5},"west":{"uv":[2,16,14,14],"texture":5},"up":{"uv":[14,13,2,15],"rotation":90,"texture":5},"down":{"uv":[14,0,2,2],"rotation":270,"texture":5}},"uuid":"b062f25c-f8f3-548b-2f46-fc6bb96083b3"},{"name":"Axis","from":[6,6,8],"to":[10,10,16],"autouv":0,"color":5,"origin":[8,1,16],"faces":{"north":{"uv":[0,0,0,0],"rotation":180,"texture":null},"east":{"uv":[6,8,10,16],"rotation":90,"texture":0},"south":{"uv":[6,6,10,10],"texture":1},"west":{"uv":[6,8,10,16],"rotation":270,"texture":0},"up":{"uv":[6,8,10,16],"texture":0},"down":{"uv":[6,8,10,16],"rotation":180,"texture":0}},"uuid":"e3b9c976-9f92-23c7-9744-b6d5f4bca3b8"},{"name":"rope","from":[6,2,6],"to":[10,8,10],"autouv":0,"color":6,"origin":[7.75,13,8],"faces":{"north":{"uv":[12,10,16,16],"texture":4},"east":{"uv":[12,10,16,16],"texture":4},"south":{"uv":[12,10,16,16],"texture":4},"west":{"uv":[12,10,16,16],"texture":4},"up":{"uv":[12,0,16,4],"rotation":90,"texture":4},"down":{"uv":[0,0,0,0],"texture":null}},"uuid":"ffe805a0-fba3-54be-ff6f-ea4d1c3bd848"},{"name":"top","from":[2,14,2],"to":[14,16,14],"autouv":0,"color":6,"origin":[8,10,8],"faces":{"north":{"uv":[0,0,0,0],"texture":5},"east":{"uv":[2,1,14,3],"rotation":180,"texture":5},"south":{"uv":[0,0,0,0],"texture":5},"west":{"uv":[2,13,14,15],"texture":5},"up":{"uv":[2,2,14,14],"rotation":90,"texture":5},"down":{"uv":[2,2,14,14],"rotation":90,"texture":5}},"uuid":"06ae5406-365f-7935-e0d8-7832b0a3aaf9"},{"name":"coil","from":[3.5,3.5,9],"to":[12.5,12.5,13],"autouv":0,"color":6,"rotation":[0,0,45],"origin":[8,8,-4],"faces":{"north":{"uv":[0,0,1,1],"texture":3},"east":{"uv":[0,3,4,12],"rotation":180,"texture":3},"south":{"uv":[0,0,1,1],"texture":3},"west":{"uv":[0,3,4,12],"texture":3},"up":{"uv":[0,3,4,12],"rotation":90,"texture":3},"down":{"uv":[0,3,4,12],"rotation":270,"texture":3}},"uuid":"4a787d9b-a04d-eafd-9dc3-ae1b61869b56"},{"name":"side","from":[3,3,-1],"to":[13,13,1],"autouv":0,"color":3,"origin":[9,-7,7],"faces":{"north":{"uv":[11,0,6,5],"texture":6},"east":{"uv":[11,5,6,6],"rotation":90,"texture":6},"south":{"uv":[0,0,0,0],"texture":null},"west":{"uv":[11,5,6,6],"rotation":270,"texture":6},"up":{"uv":[11,5,6,6],"texture":6},"down":{"uv":[11,5,6,6],"rotation":180,"texture":6}},"uuid":"79d24535-547d-b692-62e2-bcb231a40b02"},{"name":"drain 1","from":[4.5,0,4.5],"to":[11.5,2,11.5],"autouv":0,"color":6,"origin":[6.75,14,6],"faces":{"north":{"uv":[0,0,7,2],"texture":4},"east":{"uv":[0,0,7,2],"texture":4},"south":{"uv":[0,0,7,2],"texture":4},"west":{"uv":[0,0,7,2],"texture":4},"up":{"uv":[0,0,0,0],"rotation":90,"texture":null},"down":{"uv":[0,2,7,9],"texture":4}},"uuid":"6bb4086f-6bf3-c374-3149-743ee69bfa01"},{"name":"drain 2","from":[4.5,2,4.5],"to":[11.5,3,11.5],"autouv":0,"color":6,"origin":[6.75,16,6],"faces":{"north":{"uv":[0,1,7,2],"texture":4},"east":{"uv":[0,1,7,2],"texture":4},"south":{"uv":[0,1,7,2],"texture":4},"west":{"uv":[0,1,7,2],"texture":4},"up":{"uv":[0,2,7,9],"rotation":90,"texture":4},"down":{"uv":[0,9,7,16],"texture":4}},"uuid":"fb8d9297-4cd4-2fe4-bca4-663c7a4bdb9d"},{"name":"drain 3","from":[5.5,2,5.5],"to":[10.5,5,10.5],"autouv":0,"color":6,"origin":[7.75,16,7],"faces":{"north":{"uv":[7,2,10,7],"rotation":270,"texture":4},"east":{"uv":[7,2,10,7],"rotation":270,"texture":4},"south":{"uv":[7,2,10,7],"rotation":270,"texture":4},"west":{"uv":[7,2,10,7],"rotation":270,"texture":4},"up":{"uv":[1,3,6,8],"rotation":90,"texture":4},"down":{"uv":[0,0,0,0],"texture":null}},"uuid":"f725e5f1-25eb-7f7a-da81-22f68d165e4b"}],"outliner":["c6880831-d683-f703-04a3-fd39148ebb5c","d93793b9-dd62-5818-2564-da40eed87601","4a787d9b-a04d-eafd-9dc3-ae1b61869b56","50235661-64a5-c971-c6e6-0975baa71d99","f16b6f4f-7c00-62c6-e29b-a9d790a92d84","79d24535-547d-b692-62e2-bcb231a40b02","8e0b92f4-fea1-c76e-eec7-fa197247034b","c6e4de46-37af-8304-d04a-e3a06202a6d1","22157158-613c-9abb-d3b9-2a2d576e1f98","82c9a138-92db-c34a-f8e7-45283db7413d","6965d55e-49aa-ab6d-4568-5de4c1501c57","639134c9-125c-c945-7ece-ee0b946543c7","b27e1c88-26b6-190b-f005-a259810655a1","e06d0f90-92de-1302-190a-fbd10c267e74","8f39075d-3ce3-b4f6-6ef0-6bb131af4333","4af7b711-49e2-96cc-804f-025c079ee52f","ecde023c-1297-0247-44c2-571ac0de9df1","b062f25c-f8f3-548b-2f46-fc6bb96083b3",{"name":"shaft","uuid":"93605e08-38e8-a8a7-4837-dba968998c73","export":true,"isOpen":false,"visibility":true,"autouv":0,"origin":[8,8,8],"children":["e3b9c976-9f92-23c7-9744-b6d5f4bca3b8"]},{"name":"rope_half_magnet","uuid":"4fe97f9a-28c6-d38d-a405-2cdf8eca9b88","export":true,"isOpen":true,"visibility":true,"autouv":0,"origin":[8,8,8],"children":["ffe805a0-fba3-54be-ff6f-ea4d1c3bd848","6bb4086f-6bf3-c374-3149-743ee69bfa01","fb8d9297-4cd4-2fe4-bca4-663c7a4bdb9d","f725e5f1-25eb-7f7a-da81-22f68d165e4b"]},"06ae5406-365f-7935-e0d8-7832b0a3aaf9"],"textures":[{"path":"C:\\Users\\simon\\Desktop\\Forge 15\\Create\\src\\main\\resources\\assets\\create\\textures\\block\\axis.png","name":"axis.png","folder":"block","namespace":"create","id":"0","particle":false,"mode":"bitmap","saved":true,"uuid":"3faf49c5-68db-fed3-b4ca-030214e86e3e","source":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAo0lEQVQ4T6WTIQ4EIQxFO4IRIECAgLshMBwKO+fCggWDZVOSSVbMJjulkpTH/+X3gB/lvZ/WWhhjQO8drus6nlofD7ExhDCFEOsOGcAYA+cc5JzfK4gxTnxdKQW1VhrgPE/QWu8pQAulFEgpvRvit4XWGg2AFjjnQAJgDqSUawYkC3eQUAEJgEEyxiwLpBxsA/AXMERYW0FCCyTAvUxkwL/r/AGRGnYRGJZooQAAAABJRU5ErkJggg=="},{"path":"C:\\Users\\simon\\Desktop\\Forge 15\\Create\\src\\main\\resources\\assets\\create\\textures\\block\\axis_top.png","name":"axis_top.png","folder":"block","namespace":"create","id":"1","particle":false,"mode":"bitmap","saved":true,"uuid":"8065816d-f585-f9e5-bf22-5659e0bd657b","source":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAaklEQVQ4T+2SMQ4AERBFv16h5W5atcohVGrXJBOhmL3A2rBa089L/ssTODxx+I8LwNyBc46VUui9g4iQc371NZXovWdjDFprqLUixrgHCCGwlBJjDJRSkFLaA1hrWWv9f8JqYDekj5BWJT4NbygR50R18wAAAABJRU5ErkJggg=="},{"path":"C:\\Users\\simon\\Desktop\\Forge 15\\Create\\src\\main\\resources\\assets\\create\\textures\\block\\copper_gearbox.png","name":"copper_gearbox.png","folder":"block","namespace":"create","id":"4","particle":false,"mode":"bitmap","saved":true,"uuid":"374c5dbd-5856-5c1a-324e-d8464907f61e","source":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAB/0lEQVQ4T42TQWsTQRTH/7PpbjRxd000TVYaIghWWSjSetBDLdSoICzaDyPevflJ/AA59eihkiiIRCSoBLu6dtNsm6VJU7JJN5GZYbKbhoBzmXnvzfzm/+bNI29flieIjeBsjGRKmnqoTUfcJ4I0Rt483Z7sWGtxBlufDLozvvA4YHbiWpLNnd8+9hpdDth+chOVXRurGYXfphA2B0MuTtiCWD8M2N5Gux8B7C8tFm96gzk1wkHTWEnzSyh8CthaN+D88dnhfj9E08ih5bpQFAWaroMQgkQigVuuh2xOxt2iCudvgF/HpyCvy48nz+8XpoDq0iV28GOthsN2m92WX16GUSiw9YtcBvdWdQawu0EEaHfO0Ng/wR6R8bVex4HrzqRywzBgmiY2pTEDHLUG+O4P5xV8TmmoVCoIw3AGQFOwLAsPcYoHd/JoNjscIKrg/vSZgv8FfPvh8xQEgFbB6Q9RJSpq1erCFMpXwBRQAHvEi4BPS1dx4DjYt+2ZR1zf2MCR52HHUOcBooxUQccb4f35ALIsI5PNQpIkVsbRaATT76GUT8O8nYkU0DJaz0oQH4lCxFAl/mniQ78MrBRjAJoCVfDug43NogY1m4SeTi38jTRA965d16KPVNJ4g/TG0e3Ujiu4GKOd2AvOQV5tPWId05vwtmUHCW/nuG+RpH+o0xp0yccJugAAAABJRU5ErkJggg=="},{"path":"C:\\Users\\simon\\Desktop\\Forge 15\\Create\\src\\main\\resources\\assets\\create\\textures\\block\\hose_pulley_rope.png","name":"hose_pulley_rope.png","folder":"block","namespace":"create","id":"5","particle":false,"mode":"bitmap","saved":true,"uuid":"36d79924-56fb-920d-44b5-79ac193e75bc","source":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAX0lEQVQ4T2M00tP4z8fLwfDp8w+GX7//MLCxsjCQwmfU0VT5r6IgwfDh0xe4IaTwGUddwEB5GLS1tf2Xl5dn0NDQYLhx4wbDw4cPGUjhMy5duvQ/uZpBlo2mgz/DIQwAKD7WmGK5ZIUAAAAASUVORK5CYII="},{"path":"C:\\Users\\simon\\Desktop\\Forge 15\\Create\\src\\main\\resources\\assets\\create\\textures\\block\\hose_pulley_magnet.png","name":"hose_pulley_magnet.png","folder":"block","namespace":"create","id":"6","particle":false,"mode":"bitmap","saved":true,"uuid":"e708a585-d298-4e3f-e1a3-6fe62e93581b","source":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABTElEQVQ4T2NkYGBgSLC2+r/g6DFGdBokhw6M9DT+8/FyMHz6/IPh1+8/DIwHK6L/f/z6jYGfm4uBWZid4e/bnwwwvn3HUkZ0A3Q0Vf6rKEgwfPj0BWwIXgNABl46/oJBVISdIXTWerBhGC7YlBv4/8nTnwwczP8Z2NkYGX7++s/w4y8jg4w0O4OQnCDYABDbbzLEAKwuuHv3HYOyshDcCzA+SAOILSLBATcAwwVHupP+P7zwgkHeQIKBn4OP4f6thwyf3/0E80HhATMMFh54XQALPHQXgFwHM4CkMID5GzkmSIoFbNFI/XQAisYLNz8yLD95CO7SSHM7BgN1fnjII3sBqwsypq/ESLIzMsPhAYcs2dbW9l9eXp5BQ0OD4caNGwyMoGhMbVmEYcDsmjgGm9J5GEl56dKl/2GaHz58CEnKpLgAIxaoEgaU5EYA9eFAmHAG4o8AAAAASUVORK5CYII="},{"path":"C:\\Users\\simon\\Desktop\\Forge 15\\Create\\src\\main\\resources\\assets\\create\\textures\\block\\oxidized\\copper_block_0.png","name":"copper_block_0.png","folder":"block/oxidized","namespace":"create","id":"8","particle":true,"mode":"bitmap","saved":true,"uuid":"7dd1a067-4a71-cdfe-245e-baad08910bcc","source":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAB9ElEQVQ4T22TXUsbURCG31VIaswmTRS/SKqInxRikF4UwQ9sqlAQWuhfKb3vXf+GNyJ4pwiCiFD0SsEWNK0aNDGtaRqzJtss2dQYmTk9m93EuTl75uw8552ZM8rnt7EabGYa93B7WiwP7cnsPnlIZ8qnhfnau6WIncHfhXLR4avemLxv7XDzmk9p2IsXBWD+9QDWt5IYDbjEbS6FV7MixMm9JH77bfK/8WypDkgeZfg88afcpEY6KI1Qu7iE4BZgdrIX6SuNgyd6vA5Au8fJO8wYGA+rSP80cXHzF8rH2Kvamxc9DsDZrYHpaBB6VqhRu57gy1Ee72PPsLxxieionwHJolkHZPMG4pcFTA16OaB6+w9GpcrfQ9Fe6Gkdv841bH8vMCCXKeOHVmlWQACPq9UK7u704vwkZ/kohZdj3Ugk8gIgu3B9prECqgHlTZC+oQC+HuR4T0oItrqTYsDxqSZSkADqQrpUwZjPwwFkJQOOYPLZAVzExwBUxOGnAiRvXttOcREfBcg2koK5SJClcvVDqqOHVMjN3QyejwQ4BauNS4v9kA+JINLUFvFo7OZvA0JhG4BSIAUr+0lMh31Qg274G19PA4T+jXT66gr6fWJA9Pv67ZyCTUHjGU2ibt5B+TA7wxOj18TYcqAixtnua8rlv+MBPoIXdEHcqvMAAAAASUVORK5CYII="},{"path":"C:\\Users\\simon\\Desktop\\Forge 15\\Create\\src\\main\\resources\\assets\\create\\textures\\block\\fluid_pipe.png","name":"fluid_pipe.png","folder":"block","namespace":"create","id":"9","particle":false,"mode":"bitmap","saved":true,"uuid":"e238433b-c06e-b068-b8f7-ba0f778775f1","source":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAE+ElEQVRYR5VX32scVRT+NunubHa7s9lJtj/MtrEGk0o1KkitaCu0WjAPIkKRUuiDoNT+A30pPkgffBdUFAQLoRSxfRAUFPpgHqxvsiBitPRHNk3MZnfNrpNkdpOMfHd6pncn093Z+3KzM3fu+c4533fOSeyjk8ddeysGrnSfq3ZZ8lx+b7VaeK6wE4m0oR4Z3oZsOqX2peqq2pu2g5U1IDvw8C7+Pn/te8+QtmIEUMgaMBKxtosdx7uIiwYbtXX8sWTj8MSQMmztz6l3mxXvDFf/kIHqvRrk28kj4yjenIXsZ6YfAWAsn8RtewM3654HiUTc86TZUvsRM4UD6R34rfSfArD3yRxu/HQHV379uc2b0y8ew/HXH8fCXzUFPmMZKM07KIwYaFQddARw+V4V6fQAjHgcZsZEvVFXlzutFmx7DWf3W5iZq2Pq2bwK+bnPrgajqX5/efGsH4XysoPJl/ag+Msi8sMGTn1xPTwFjMCVhToy6RSq/9bx/NNPobbSwJ25EqxBEw17FVODJorL0QEQDL0XAIzCm5+EALjw2gl3creBbytryvvRwggcp4lBM4M1x8Hd0rwCcHqv6UeA+X/v0uXQCHz+wTtYsb1ULi+uY2zMwq1bVQzvSYYDOHfsFffEwTy+/ruMYSsHI2Egl82oCDhNB47j+ADIgaOTQ4qA3QAwTTQsALi/+vH09hQQwOHdGVyrNNpSsFhexsI/ZT8F7x/KY6ZYUSQ8+Mworn9X7EjCXVZEAEzBRC6Bq4s1xOM7lAKYCiEgldBqbfgkZLQowwPjo6jOl335ZZMmVtbrPgEJ4PfZms+BQ+O58AgQwAtPmPhzycZMxWM+gXDRMNfLAymQqFTB0X2mqgsEQb3rxYiFSGoHv4skQ4lAKKO0h/dbmyhVV3sCEKkQkQPdjOvvC1YKVp8XIZZap+l9vr4ZQ7LfVXt1a0OdiVSKP317yuWHmVyyDQdLLy8L1u/pM1NulF4QVvXCHFW9oC/leSSe0QOurdUNfPjjjW3S6SVi3c7Geo1Atwt7fa8AsE6TzdJWeQkZzVoe1kJ7NdLpfOyrU2+4bMWUjN5iowKQFDJ9TN1j8X7fHjnERY7JEpJKin0AJBaLhzWSx+3Zu0rjUSIQNk+IMdYEUYlOcnlOaSsA/IDNgingUMF+zkUlvPvNDx1JSAAsUoygkuaD6UgakjzjvRxe5DnnA05JoRxg+GmcqxuAIIdoKGyxVEvpJgiJsALAglHYl1Pey4jFThYFACPI8DJ9QeM0ysUewXv194wyndwGgB/wcFQShgHQjYlDNC4NS+73AVCGQkC9o0UhoZ4CURGdkOGUf4vEBQRTIQ4qEjKEeovVc9StDgQBCNFkMqYKgikiOE5LlKRPQk66QhRRgsz3uo51PSuGD3hju3BAQi4eyvlgLZDnbQAk/4o4D5hKEDSga1r/HyIYYrmjNFdTMpNCpH8jd/kR0FWgE0WACFpqnMBk13XPv4XljIIOgPezTujf+XXg0lsn3Yld6TYZ6fIJapqXs1qKtHTDQZaTxFzBXtNWB3QSSiXUjYqkJLdiXD8T1LsY4JjH3iAk1KPnk5AR4L9deimVg+IdWauHWy/XusREftwlxEJUPQWiEFWKCYAoSRIuIZxMPeKpPmzKM5FY2Bm+Y7NhlwxOXG0k7NRO9TBLaw3KSp8F5Z0+UQ3v9Ea9R8nwf4KEhTJhQYO9AAAAAElFTkSuQmCC"}],"display":{"thirdperson_righthand":{"rotation":[75,45,0],"translation":[0,2.5,0],"scale":[0.375,0.375,0.375]},"thirdperson_lefthand":{"rotation":[75,45,0],"translation":[0,2.5,0],"scale":[0.375,0.375,0.375]},"firstperson_righthand":{"rotation":[0,45,0],"scale":[0.4,0.4,0.4]},"firstperson_lefthand":{"rotation":[0,225,0],"scale":[0.4,0.4,0.4]},"ground":{"translation":[0,3,0],"scale":[0.25,0.25,0.25]},"gui":{"rotation":[30,225,0],"scale":[0.625,0.625,0.625]},"fixed":{"scale":[0.5,0.5,0.5]}}} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/hose_pulley/copper_pulley_rope.bbmodel b/src/main/resources/assets/create/models/block/hose_pulley/copper_pulley_rope.bbmodel deleted file mode 100644 index 38a0b1b92..000000000 --- a/src/main/resources/assets/create/models/block/hose_pulley/copper_pulley_rope.bbmodel +++ /dev/null @@ -1 +0,0 @@ -{"meta":{"format_version":"3.2","model_format":"java_block","box_uv":false},"name":"rope","parent":"block/block","ambientocclusion":true,"front_gui_light":false,"resolution":{"width":16,"height":16},"elements":[{"name":"rope","from":[6,0,6],"to":[10,16,10],"autouv":0,"color":6,"locked":false,"origin":[7.75,0,8],"faces":{"north":{"uv":[0,0,4,16],"texture":0},"east":{"uv":[0,0,4,16],"texture":0},"south":{"uv":[0,0,4,16],"texture":0},"west":{"uv":[0,0,4,16],"texture":0},"up":{"uv":[0,0,4,4],"rotation":90,"texture":0},"down":{"uv":[0,0,4,4],"texture":0}},"uuid":"3f245b42-dde8-d34f-9f25-ae6eb2f322ae"}],"outliner":["3f245b42-dde8-d34f-9f25-ae6eb2f322ae"],"textures":[{"path":"C:\\Users\\krypp\\Documents\\Pixel Art\\Create Mod\\Pulley Pump\\copper_pulley_rope.png","name":"copper_pulley_rope.png","folder":"Pulley Pump","namespace":"create","id":"5","particle":true,"mode":"bitmap","saved":true,"uuid":"8ffc2f62-b5b6-1af9-ecc1-e22a9ae075aa","source":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAX0lEQVQ4T2M00tP4z8fLwfDp8w+GX7//MLCxsjCQwmfU0VT5r6IgwfDh0xe4IaTwGUddwEB5GLS1tf2Xl5dn0NDQYLhx4wbDw4cPGUjhMy5duvQ/uZpBlo2mgz/DIQwAKD7WmGK5ZIUAAAAASUVORK5CYII="}]} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/hose_pulley/item.json b/src/main/resources/assets/create/models/block/hose_pulley/item.json index b8c30a0cd..2554a770b 100644 --- a/src/main/resources/assets/create/models/block/hose_pulley/item.json +++ b/src/main/resources/assets/create/models/block/hose_pulley/item.json @@ -7,9 +7,9 @@ "4": "create:block/copper_gearbox", "5": "create:block/hose_pulley_rope", "6": "create:block/hose_pulley_magnet", - "8": "create:block/oxidized/copper_block_0", + "8": "create:block/copper_plating", "9": "create:block/fluid_pipe", - "particle": "create:block/oxidized/copper_block_0" + "particle": "create:block/copper_plating" }, "elements": [ { diff --git a/src/main/resources/assets/create/models/block/spout/block.json b/src/main/resources/assets/create/models/block/spout/block.json index 6244a12c0..66ac7929e 100644 --- a/src/main/resources/assets/create/models/block/spout/block.json +++ b/src/main/resources/assets/create/models/block/spout/block.json @@ -3,7 +3,7 @@ "parent": "block/block", "textures": { "0": "create:block/spout", - "particle": "create:block/oxidized/copper_block_0" + "particle": "create:block/copper_plating" }, "elements": [ { diff --git a/src/main/resources/assets/create/models/block/spout/item.json b/src/main/resources/assets/create/models/block/spout/item.json index 6c147c000..ab0a476b0 100644 --- a/src/main/resources/assets/create/models/block/spout/item.json +++ b/src/main/resources/assets/create/models/block/spout/item.json @@ -3,7 +3,7 @@ "parent": "block/block", "textures": { "0": "create:block/spout", - "particle": "create:block/oxidized/copper_block_0" + "particle": "create:block/copper_plating" }, "elements": [ { diff --git a/src/main/resources/assets/create/textures/block/copper_plating.png b/src/main/resources/assets/create/textures/block/copper_plating.png new file mode 100644 index 0000000000000000000000000000000000000000..ee40eba885e569869a992ae5f5ad5426c7edff63 GIT binary patch literal 552 zcmV+@0@wYCP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0li5?K~y+TT~fLCng?wsVzJvZF$YJr5XO)s9{BaSuNGN8!qEHAFDOa%oW-=L*O}%u#g`a$#=;=mMCz=id{7u zcr@F^!?;Pjv?TPWMAs!{!=Vn$_wm!3&ZPVgQX~@r0WROo@tpGgN@cv^g}y%SYi4Fx zW@@ERzJ4=DCsY;yz{g@i2vU-^1>NjSk6UxVp&p$XST78|Jyd-Okp<9=TqG>psmbBSi8qO;kFA)Lune3?$!MxipZh8i1F!m qgWH;)!$xlgvs5@5L$v)5LVf}3xxf+^O>9U20000