From 080b048b2f2f801e62b89d009301b429c60d220c Mon Sep 17 00:00:00 2001 From: PepperBell <44146161+PepperCode1@users.noreply.github.com> Date: Fri, 10 Dec 2021 16:58:05 -0800 Subject: [PATCH] SmarterTileEntity - Clean up SyncedTileEntity and SmartTileEntity - Allow schematicannons to be rotated based on placement angle - Fix DirectionalExtenderScrollOptionSlot rotation - Remove deprecated usage of JsonReader and LazyLoadedValue - Move ToolSelectionScreen to content.schematics.client - Organize imports - Update to 1.18.1 --- build.gradle | 4 +- gradle.properties | 7 +- gradle/wrapper/gradle-wrapper.properties | 2 +- .../api/event/TileEntityBehaviourEvent.java | 10 +- .../contraptions/base/KineticTileEntity.java | 6 +- .../base/KineticTileInstance.java | 2 +- .../contraptions/base/flwdata/BeltType.java | 6 +- .../base/flwdata/RotatingType.java | 6 +- .../base/flwdata/UnsafeBeltWriter.java | 2 +- .../base/flwdata/UnsafeRotatingWriter.java | 2 +- .../BlockBreakingKineticTileEntity.java | 4 +- .../actors/DrillMovementBehaviour.java | 2 +- .../actors/HarvesterMovementBehaviour.java | 2 +- .../PortableStorageInterfaceTileEntity.java | 4 +- .../components/actors/flwdata/ActorType.java | 6 +- .../actors/flwdata/UnsafeActorWriter.java | 2 +- .../clock/CuckooClockTileEntity.java | 4 +- .../crafter/MechanicalCrafterTileEntity.java | 4 +- .../components/crank/HandCrankInstance.java | 2 +- .../components/crank/HandCrankTileEntity.java | 4 +- .../CrushingWheelControllerTileEntity.java | 4 +- .../components/deployer/DeployerInstance.java | 2 +- .../deployer/DeployerMovementBehaviour.java | 2 +- .../deployer/DeployerTileEntity.java | 4 +- .../components/fan/EncasedFanTileEntity.java | 4 +- .../components/fan/NozzleTileEntity.java | 4 +- .../components/flywheel/FlyWheelInstance.java | 2 +- .../flywheel/FlywheelTileEntity.java | 4 +- .../flywheel/engine/EngineInstance.java | 2 +- .../millstone/MillstoneTileEntity.java | 4 +- .../mixer/MechanicalMixerTileEntity.java | 4 +- .../components/mixer/MixerInstance.java | 2 +- .../press/MechanicalPressTileEntity.java | 4 +- .../components/press/PressInstance.java | 2 +- .../components/saw/SawTileEntity.java | 11 +- .../structureMovement/ContraptionLighter.java | 2 +- .../DirectionalExtenderScrollOptionSlot.java | 2 +- .../NonStationaryLighter.java | 2 +- .../bearing/BearingInstance.java | 2 +- .../bearing/ClockworkBearingTileEntity.java | 4 +- .../bearing/MechanicalBearingTileEntity.java | 6 +- .../StabilizedBearingMovementBehaviour.java | 2 +- .../bearing/WindmillBearingTileEntity.java | 4 +- .../chassis/StickerInstance.java | 2 +- .../chassis/StickerTileEntity.java | 4 +- .../gantry/GantryCarriageInstance.java | 2 +- .../gantry/GantryCarriageTileEntity.java | 4 +- .../structureMovement/glue/GlueInstance.java | 6 +- .../mounted/CartAssemblerTileEntity.java | 4 +- .../piston/LinearActuatorTileEntity.java | 4 +- .../piston/MechanicalPistonTileEntity.java | 4 +- .../pulley/AbstractPulleyInstance.java | 4 +- .../pulley/PulleyTileEntity.java | 4 +- .../render/ContraptionInstanceManager.java | 2 +- .../render/FlwContraptionManager.java | 2 +- .../waterwheel/WaterWheelTileEntity.java | 4 +- .../contraptions/fluids/PumpTileEntity.java | 4 +- .../fluids/actors/HosePulleyTileEntity.java | 4 +- .../fluids/actors/ItemDrainTileEntity.java | 4 +- .../fluids/actors/SpoutTileEntity.java | 4 +- .../fluids/pipes/FluidValveInstance.java | 2 +- .../fluids/pipes/FluidValveTileEntity.java | 4 +- .../fluids/tank/FluidTankTileEntity.java | 4 +- .../goggles/GoggleOverlayRenderer.java | 34 +-- .../processing/BasinTileEntity.java | 4 +- .../processing/ProcessingOutput.java | 2 +- .../burner/BlazeBurnerTileEntity.java | 4 +- .../SequencedGearshiftTileEntity.java | 4 +- .../relays/belt/BeltTileEntity.java | 6 +- .../encased/AdjustablePulleyTileEntity.java | 4 +- .../relays/gauge/GaugeInstance.java | 2 +- .../relays/gauge/GaugeTileEntity.java | 4 +- .../curiosities/armor/AllArmorMaterials.java | 6 +- .../armor/CopperBacktankTileEntity.java | 4 +- .../bell/HauntedBellTileEntity.java | 9 +- .../curiosities/toolbox/ToolBoxInstance.java | 4 +- .../curiosities/toolbox/ToolboxContainer.java | 2 +- .../toolbox/ToolboxDisposeAllPacket.java | 2 +- .../toolbox/ToolboxEquipPacket.java | 2 +- .../toolbox/ToolboxTileEntity.java | 4 +- .../curiosities/tools/ExtendoGripItem.java | 17 +- .../content/curiosities/zapper/ZapperLog.java | 2 +- .../belts/tunnel/BeltTunnelInstance.java | 4 +- .../belts/tunnel/BeltTunnelTileEntity.java | 4 +- .../belts/tunnel/BrassTunnelTileEntity.java | 4 +- .../block/chute/ChuteTileEntity.java | 4 +- .../block/depot/EjectorInstance.java | 2 +- .../block/depot/EjectorTileEntity.java | 4 +- .../block/diodes/BrassDiodeInstance.java | 2 +- .../block/diodes/BrassDiodeTileEntity.java | 4 +- .../logistics/block/flap/FlapType.java | 6 +- .../block/flap/UnsafeFlapWriter.java | 2 +- .../block/funnel/FunnelInstance.java | 4 +- .../block/funnel/FunnelTileEntity.java | 4 +- .../block/mechanicalArm/ArmInstance.java | 2 +- .../block/mechanicalArm/ArmTileEntity.java | 4 +- .../block/redstone/AnalogLeverInstance.java | 4 +- .../block/redstone/AnalogLeverTileEntity.java | 4 +- .../redstone/ContentObserverTileEntity.java | 4 +- .../block/redstone/NixieTubeTileEntity.java | 6 +- .../redstone/RedstoneLinkTileEntity.java | 4 +- .../redstone/StockpileSwitchTileEntity.java | 4 +- .../block/vault/ItemVaultTileEntity.java | 4 +- .../item/LecternControllerTileEntity.java | 4 +- .../item/LinkedControllerClientHandler.java | 9 +- .../logistics/item/LinkedControllerItem.java | 2 +- .../logistics/item/filter/FilterItem.java | 2 +- .../content/schematics/ItemRequirement.java | 4 +- .../block/SchematicTableContainer.java | 2 +- .../block/SchematicTableTileEntity.java | 4 +- .../schematics/block/SchematicannonBlock.java | 32 +-- .../block/SchematicannonContainer.java | 2 +- .../block/SchematicannonInstance.java | 8 +- .../block/SchematicannonRenderer.java | 37 ++-- .../block/SchematicannonTileEntity.java | 27 ++- .../schematics/client/SchematicHandler.java | 1 - .../client}/ToolSelectionScreen.java | 3 +- .../config/ui/ConfigScreenList.java | 1 - .../foundation/fluid/FluidIngredient.java | 2 +- .../foundation/gui/RemovedGuiUtils.java | 1 - .../create/foundation/gui/UIRenderHelper.java | 26 +-- .../create/foundation/ponder/PonderWorld.java | 6 +- .../TileEntityDataInstruction.java | 2 +- .../foundation/render/CreateContexts.java | 2 +- .../tileEntity/SmartTileEntity.java | 198 ++++++++---------- .../tileEntity/SyncedTileEntity.java | 77 ++++--- .../belt/BeltProcessingBehaviour.java | 2 +- .../inventory/InvManipulationBehaviour.java | 2 +- .../foundation/utility/FilesHelper.java | 4 +- .../worldWrappers/WrappedClientWorld.java | 5 - 130 files changed, 428 insertions(+), 465 deletions(-) rename src/main/java/com/simibubi/create/{foundation/gui => content/schematics/client}/ToolSelectionScreen.java (97%) diff --git a/build.gradle b/build.gradle index e3ebfe5c4..6dd68b80d 100644 --- a/build.gradle +++ b/build.gradle @@ -168,8 +168,8 @@ dependencies { implementation fg.deobf("com.jozufozu.flywheel:Flywheel-Forge:${flywheel_version}") } - compileOnly fg.deobf("mezz.jei:jei-${minecraft_version}:${jei_version}:api") - runtimeOnly fg.deobf("mezz.jei:jei-${minecraft_version}:${jei_version}") + compileOnly fg.deobf("mezz.jei:jei-${jei_minecraft_version}:${jei_version}:api") + runtimeOnly fg.deobf("mezz.jei:jei-${jei_minecraft_version}:${jei_version}") // implementation fg.deobf("curse.maven:druidcraft-340991:3101903") // implementation fg.deobf("com.ferreusveritas.dynamictrees:DynamicTrees-1.16.5:0.10.0-Beta25") diff --git a/gradle.properties b/gradle.properties index dd0cb9ff4..0c53850db 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,8 +5,8 @@ org.gradle.daemon = false # mod version info mod_version = 0.4 -minecraft_version = 1.18 -forge_version = 38.0.15 +minecraft_version = 1.18.1 +forge_version = 39.0.0 # build dependency versions forgegradle_version = 5.1.+ @@ -19,7 +19,8 @@ parchment_version = 2021.10.31 # dependency versions registrate_version = MC1.18-1.0.21 -flywheel_version = 1.18-0.4.0.11 +flywheel_version = 1.18-0.4.0.15 +jei_minecraft_version = 1.18 jei_version = 9.0.0.40 # curseforge information diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e750102e0..84d1f85fd 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/com/simibubi/create/api/event/TileEntityBehaviourEvent.java b/src/main/java/com/simibubi/create/api/event/TileEntityBehaviourEvent.java index bc5345d79..657d21065 100644 --- a/src/main/java/com/simibubi/create/api/event/TileEntityBehaviourEvent.java +++ b/src/main/java/com/simibubi/create/api/event/TileEntityBehaviourEvent.java @@ -11,18 +11,18 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.eventbus.api.GenericEvent; /** - * Event that is fired just before a SmartTileEntity is being deserealized
+ * Event that is fired just before a SmartTileEntity is being deserialized
* Also if a new one is placed
* Use it to attach a new {@link TileEntityBehaviour} or replace existing ones - * (with caution)
+ * (with caution)
*
* Actual setup of the behaviours internal workings and data should be done in * TileEntityBehaviour#read() and TileEntityBehaviour#initialize() * respectively.
*
- * Because of the earlyness of this event, the added behaviours will have access - * to the initial nbt read (unless the TE was placed, not loaded), thereby - * allowing tiles to store and retrieve data for injected behaviours + * Because of the earliness of this event, the added behaviours will have access + * to the initial NBT read (unless the TE was placed, not loaded), thereby + * allowing tiles to store and retrieve data for injected behaviours. */ public class TileEntityBehaviourEvent extends GenericEvent { 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 d172276bc..5c274fc60 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 @@ -226,13 +226,13 @@ public class KineticTileEntity extends SmartTileEntity } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { + protected void read(CompoundTag compound, boolean clientPacket) { boolean overStressedBefore = overStressed; clearKineticInformation(); // DO NOT READ kinetic information when placed after movement if (wasMoved) { - super.fromTag(compound, clientPacket); + super.read(compound, clientPacket); return; } @@ -252,7 +252,7 @@ public class KineticTileEntity extends SmartTileEntity overStressed = capacity < stress && StressImpact.isEnabled(); } - super.fromTag(compound, clientPacket); + super.read(compound, clientPacket); if (clientPacket && overStressedBefore != overStressed && speed != 0) effects.triggerOverStressedEffect(); diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileInstance.java b/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileInstance.java index 717326de9..c9f4b3a5b 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileInstance.java @@ -1,8 +1,8 @@ package com.simibubi.create.content.contraptions.base; -import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance; import com.jozufozu.flywheel.api.Material; import com.jozufozu.flywheel.api.MaterialManager; +import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance; import com.simibubi.create.AllBlocks; import com.simibubi.create.content.contraptions.base.flwdata.RotatingData; import com.simibubi.create.content.contraptions.relays.elementary.ICogWheel; diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/BeltType.java b/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/BeltType.java index eaea40bac..1c72568d5 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/BeltType.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/BeltType.java @@ -1,11 +1,11 @@ package com.simibubi.create.content.contraptions.base.flwdata; -import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat; -import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer; import com.jozufozu.flywheel.api.struct.Batched; import com.jozufozu.flywheel.api.struct.BatchingTransformer; -import com.jozufozu.flywheel.api.struct.StructWriter; import com.jozufozu.flywheel.api.struct.Instanced; +import com.jozufozu.flywheel.api.struct.StructWriter; +import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat; +import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer; import com.jozufozu.flywheel.core.model.Model; import com.simibubi.create.foundation.render.AllInstanceFormats; import com.simibubi.create.foundation.render.AllProgramSpecs; diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/RotatingType.java b/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/RotatingType.java index 487bfe837..94e05590f 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/RotatingType.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/RotatingType.java @@ -1,11 +1,11 @@ package com.simibubi.create.content.contraptions.base.flwdata; -import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat; -import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer; import com.jozufozu.flywheel.api.struct.Batched; import com.jozufozu.flywheel.api.struct.BatchingTransformer; -import com.jozufozu.flywheel.api.struct.StructWriter; import com.jozufozu.flywheel.api.struct.Instanced; +import com.jozufozu.flywheel.api.struct.StructWriter; +import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat; +import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer; import com.jozufozu.flywheel.core.model.Model; import com.simibubi.create.foundation.render.AllInstanceFormats; import com.simibubi.create.foundation.render.AllProgramSpecs; diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/UnsafeBeltWriter.java b/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/UnsafeBeltWriter.java index 97010fb06..1bd4e3ac5 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/UnsafeBeltWriter.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/UnsafeBeltWriter.java @@ -2,8 +2,8 @@ package com.simibubi.create.content.contraptions.base.flwdata; import org.lwjgl.system.MemoryUtil; -import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer; import com.jozufozu.flywheel.api.struct.StructType; +import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer; import com.jozufozu.flywheel.backend.struct.UnsafeBufferWriter; public class UnsafeBeltWriter extends UnsafeBufferWriter { diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/UnsafeRotatingWriter.java b/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/UnsafeRotatingWriter.java index f3fc54066..8b0f13835 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/UnsafeRotatingWriter.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/UnsafeRotatingWriter.java @@ -2,8 +2,8 @@ package com.simibubi.create.content.contraptions.base.flwdata; import org.lwjgl.system.MemoryUtil; -import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer; import com.jozufozu.flywheel.api.struct.StructType; +import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer; import com.jozufozu.flywheel.backend.struct.UnsafeBufferWriter; public class UnsafeRotatingWriter extends UnsafeBufferWriter { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/BlockBreakingKineticTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/BlockBreakingKineticTileEntity.java index 18953d7b5..dee22e4ba 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/BlockBreakingKineticTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/BlockBreakingKineticTileEntity.java @@ -68,12 +68,12 @@ public abstract class BlockBreakingKineticTileEntity extends KineticTileEntity { } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { + protected void read(CompoundTag compound, boolean clientPacket) { destroyProgress = compound.getInt("Progress"); ticksUntilNextProgress = compound.getInt("NextTick"); if (compound.contains("Breaking")) breakingPos = NbtUtils.readBlockPos(compound.getCompound("Breaking")); - super.fromTag(compound, clientPacket); + super.read(compound, clientPacket); } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillMovementBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillMovementBehaviour.java index b86a8e00b..9690f4eba 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillMovementBehaviour.java @@ -2,8 +2,8 @@ package com.simibubi.create.content.contraptions.components.actors; import javax.annotation.Nullable; -import com.jozufozu.flywheel.backend.Backend; import com.jozufozu.flywheel.api.MaterialManager; +import com.jozufozu.flywheel.backend.Backend; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance; import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionMatrices; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterMovementBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterMovementBehaviour.java index 759a8fa4a..a2c3716ca 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterMovementBehaviour.java @@ -4,8 +4,8 @@ import javax.annotation.Nullable; import org.apache.commons.lang3.mutable.MutableBoolean; -import com.jozufozu.flywheel.backend.Backend; import com.jozufozu.flywheel.api.MaterialManager; +import com.jozufozu.flywheel.backend.Backend; import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/PortableStorageInterfaceTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/PortableStorageInterfaceTileEntity.java index 6a5c1852e..d9c56fbd5 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/PortableStorageInterfaceTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/PortableStorageInterfaceTileEntity.java @@ -86,8 +86,8 @@ public abstract class PortableStorageInterfaceTileEntity extends SmartTileEntity } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { - super.fromTag(compound, clientPacket); + protected void read(CompoundTag compound, boolean clientPacket) { + super.read(compound, clientPacket); transferTimer = compound.getInt("Timer"); distance = compound.getFloat("Distance"); powered = compound.getBoolean("Powered"); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/flwdata/ActorType.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/flwdata/ActorType.java index 92124a615..f664a6698 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/flwdata/ActorType.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/flwdata/ActorType.java @@ -1,11 +1,11 @@ package com.simibubi.create.content.contraptions.components.actors.flwdata; -import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat; -import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer; import com.jozufozu.flywheel.api.struct.Batched; import com.jozufozu.flywheel.api.struct.BatchingTransformer; -import com.jozufozu.flywheel.api.struct.StructWriter; import com.jozufozu.flywheel.api.struct.Instanced; +import com.jozufozu.flywheel.api.struct.StructWriter; +import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat; +import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer; import com.jozufozu.flywheel.core.model.Model; import com.simibubi.create.foundation.render.AllInstanceFormats; import com.simibubi.create.foundation.render.AllProgramSpecs; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/flwdata/UnsafeActorWriter.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/flwdata/UnsafeActorWriter.java index 62457ba1a..0a7184910 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/flwdata/UnsafeActorWriter.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/flwdata/UnsafeActorWriter.java @@ -2,8 +2,8 @@ package com.simibubi.create.content.contraptions.components.actors.flwdata; import org.lwjgl.system.MemoryUtil; -import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer; import com.jozufozu.flywheel.api.struct.StructType; +import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer; import com.jozufozu.flywheel.backend.struct.UnsafeBufferWriter; public class UnsafeActorWriter extends UnsafeBufferWriter { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/clock/CuckooClockTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/clock/CuckooClockTileEntity.java index 9ccffd952..fd0f6f56d 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/clock/CuckooClockTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/clock/CuckooClockTileEntity.java @@ -44,8 +44,8 @@ public class CuckooClockTileEntity extends KineticTileEntity { } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { - super.fromTag(compound, clientPacket); + protected void read(CompoundTag compound, boolean clientPacket) { + super.read(compound, clientPacket); if (clientPacket && compound.contains("Animation")) { animationType = NBTHelper.readEnum(compound, "Animation", Animation.class); animationProgress.lastValue = 0; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterTileEntity.java index 74c6f9337..364fbfddb 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterTileEntity.java @@ -168,7 +168,7 @@ public class MechanicalCrafterTileEntity extends KineticTileEntity { } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { + protected void read(CompoundTag compound, boolean clientPacket) { Phase phaseBefore = phase; GroupedItems before = this.groupedItems; @@ -183,7 +183,7 @@ public class MechanicalCrafterTileEntity extends KineticTileEntity { this.phase = phase; countDown = compound.getInt("CountDown"); covered = compound.getBoolean("Cover"); - super.fromTag(compound, clientPacket); + super.read(compound, clientPacket); if (!clientPacket) return; if (compound.contains("Redraw")) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/crank/HandCrankInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/crank/HandCrankInstance.java index 34d578625..1517cb5be 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/crank/HandCrankInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/crank/HandCrankInstance.java @@ -1,8 +1,8 @@ package com.simibubi.create.content.contraptions.components.crank; -import com.jozufozu.flywheel.api.instance.IDynamicInstance; import com.jozufozu.flywheel.api.Instancer; import com.jozufozu.flywheel.api.MaterialManager; +import com.jozufozu.flywheel.api.instance.IDynamicInstance; import com.jozufozu.flywheel.core.PartialModel; import com.jozufozu.flywheel.core.materials.model.ModelData; import com.simibubi.create.content.contraptions.base.SingleRotatingInstance; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/crank/HandCrankTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/crank/HandCrankTileEntity.java index bb8dab393..716523aa6 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/crank/HandCrankTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/crank/HandCrankTileEntity.java @@ -53,9 +53,9 @@ public class HandCrankTileEntity extends GeneratingKineticTileEntity { } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { + protected void read(CompoundTag compound, boolean clientPacket) { inUse = compound.getInt("InUse"); - super.fromTag(compound, clientPacket); + super.read(compound, clientPacket); } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelControllerTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelControllerTileEntity.java index b3943bead..0101832f3 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelControllerTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelControllerTileEntity.java @@ -331,8 +331,8 @@ public class CrushingWheelControllerTileEntity extends SmartTileEntity { } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { - super.fromTag(compound, clientPacket); + protected void read(CompoundTag compound, boolean clientPacket) { + super.read(compound, clientPacket); if (compound.contains("Entity") && !isOccupied()) { entityUUID = NbtUtils.loadUUID(NBTHelper.getINBT(compound, "Entity")); this.searchForEntity = true; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerInstance.java index 9a066698e..48dc47c10 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerInstance.java @@ -3,9 +3,9 @@ package com.simibubi.create.content.contraptions.components.deployer; import static com.simibubi.create.content.contraptions.base.DirectionalAxisKineticBlock.AXIS_ALONG_FIRST_COORDINATE; import static com.simibubi.create.content.contraptions.base.DirectionalKineticBlock.FACING; +import com.jozufozu.flywheel.api.MaterialManager; import com.jozufozu.flywheel.api.instance.IDynamicInstance; import com.jozufozu.flywheel.api.instance.ITickableInstance; -import com.jozufozu.flywheel.api.MaterialManager; import com.jozufozu.flywheel.core.PartialModel; import com.jozufozu.flywheel.core.materials.oriented.OrientedData; import com.mojang.math.Quaternion; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerMovementBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerMovementBehaviour.java index 392a61fd4..b9b308812 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerMovementBehaviour.java @@ -7,8 +7,8 @@ import javax.annotation.Nullable; import org.apache.commons.lang3.tuple.Pair; -import com.jozufozu.flywheel.backend.Backend; import com.jozufozu.flywheel.api.MaterialManager; +import com.jozufozu.flywheel.backend.Backend; import com.simibubi.create.AllBlocks; import com.simibubi.create.AllItems; import com.simibubi.create.AllTags.AllBlockTags; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerTileEntity.java index a82e8188c..35d1ef873 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerTileEntity.java @@ -309,7 +309,7 @@ public class DeployerTileEntity extends KineticTileEntity { } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { + protected void read(CompoundTag compound, boolean clientPacket) { state = NBTHelper.readEnum(compound, "State", State.class); mode = NBTHelper.readEnum(compound, "Mode", Mode.class); timer = compound.getInt("Timer"); @@ -319,7 +319,7 @@ public class DeployerTileEntity extends KineticTileEntity { overflowItems = NBTHelper.readItemList(compound.getList("Overflow", Tag.TAG_COMPOUND)); if (compound.contains("HeldItem")) heldItem = ItemStack.of(compound.getCompound("HeldItem")); - super.fromTag(compound, clientPacket); + super.read(compound, clientPacket); if (!clientPacket) return; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/fan/EncasedFanTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/fan/EncasedFanTileEntity.java index 6d5fb8047..670ecdbac 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/fan/EncasedFanTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/fan/EncasedFanTileEntity.java @@ -38,8 +38,8 @@ public class EncasedFanTileEntity extends GeneratingKineticTileEntity implements } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { - super.fromTag(compound, clientPacket); + protected void read(CompoundTag compound, boolean clientPacket) { + super.read(compound, clientPacket); if (!wasMoved) isGenerator = compound.getBoolean("Generating"); if (clientPacket) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/fan/NozzleTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/fan/NozzleTileEntity.java index 9d924dfb6..963f9fc56 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/fan/NozzleTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/fan/NozzleTileEntity.java @@ -51,8 +51,8 @@ public class NozzleTileEntity extends SmartTileEntity { } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { - super.fromTag(compound, clientPacket); + protected void read(CompoundTag compound, boolean clientPacket) { + super.read(compound, clientPacket); if (!clientPacket) return; range = compound.getFloat("Range"); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlyWheelInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlyWheelInstance.java index a663e1737..caa0c1232 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlyWheelInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlyWheelInstance.java @@ -6,11 +6,11 @@ import java.util.Collections; import java.util.List; import com.google.common.collect.Lists; -import com.jozufozu.flywheel.api.instance.IDynamicInstance; import com.jozufozu.flywheel.api.InstanceData; import com.jozufozu.flywheel.api.Instancer; import com.jozufozu.flywheel.api.Material; import com.jozufozu.flywheel.api.MaterialManager; +import com.jozufozu.flywheel.api.instance.IDynamicInstance; import com.jozufozu.flywheel.core.materials.model.ModelData; import com.jozufozu.flywheel.util.transform.TransformStack; import com.mojang.blaze3d.vertex.PoseStack; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlywheelTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlywheelTileEntity.java index 2a27d7ee8..78a48627a 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlywheelTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlywheelTileEntity.java @@ -63,11 +63,11 @@ public class FlywheelTileEntity extends GeneratingKineticTileEntity { } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { + protected void read(CompoundTag compound, boolean clientPacket) { generatedSpeed = compound.getFloat("GeneratedSpeed"); generatedCapacity = compound.getFloat("GeneratedCapacity"); stoppingCooldown = compound.getInt("Cooldown"); - super.fromTag(compound, clientPacket); + super.read(compound, clientPacket); if (clientPacket) visualSpeed.withSpeed(1 / 32f) .target(getGeneratedSpeed()); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineInstance.java index 018e87f7c..5587bbc13 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineInstance.java @@ -1,7 +1,7 @@ package com.simibubi.create.content.contraptions.components.flywheel.engine; -import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance; import com.jozufozu.flywheel.api.MaterialManager; +import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance; import com.jozufozu.flywheel.core.PartialModel; import com.jozufozu.flywheel.core.materials.model.ModelData; import com.simibubi.create.foundation.utility.AngleHelper; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/millstone/MillstoneTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/millstone/MillstoneTileEntity.java index 8ec4f8c98..318b572bb 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/millstone/MillstoneTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/millstone/MillstoneTileEntity.java @@ -163,11 +163,11 @@ public class MillstoneTileEntity extends KineticTileEntity { } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { + protected void read(CompoundTag compound, boolean clientPacket) { timer = compound.getInt("Timer"); inputInv.deserializeNBT(compound.getCompound("InputInventory")); outputInv.deserializeNBT(compound.getCompound("OutputInventory")); - super.fromTag(compound, clientPacket); + super.read(compound, clientPacket); } public int getProcessingSpeed() { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MechanicalMixerTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MechanicalMixerTileEntity.java index 9d9674a6a..53587571f 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MechanicalMixerTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MechanicalMixerTileEntity.java @@ -96,10 +96,10 @@ public class MechanicalMixerTileEntity extends BasinOperatingTileEntity { } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { + protected void read(CompoundTag compound, boolean clientPacket) { running = compound.getBoolean("Running"); runningTicks = compound.getInt("Ticks"); - super.fromTag(compound, clientPacket); + super.read(compound, clientPacket); if (clientPacket && hasLevel()) getBasin().ifPresent(bte -> bte.setAreFluidsMoving(running && runningTicks <= 20)); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MixerInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MixerInstance.java index 19619434a..9ce98dd3b 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MixerInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MixerInstance.java @@ -1,8 +1,8 @@ package com.simibubi.create.content.contraptions.components.mixer; -import com.jozufozu.flywheel.api.instance.IDynamicInstance; import com.jozufozu.flywheel.api.Instancer; import com.jozufozu.flywheel.api.MaterialManager; +import com.jozufozu.flywheel.api.instance.IDynamicInstance; import com.jozufozu.flywheel.core.materials.oriented.OrientedData; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.base.flwdata.RotatingData; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/press/MechanicalPressTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/press/MechanicalPressTileEntity.java index b17c56f8e..66c0d14b3 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/press/MechanicalPressTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/press/MechanicalPressTileEntity.java @@ -82,12 +82,12 @@ public class MechanicalPressTileEntity extends BasinOperatingTileEntity { } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { + protected void read(CompoundTag compound, boolean clientPacket) { running = compound.getBoolean("Running"); mode = Mode.values()[compound.getInt("Mode")]; finished = compound.getBoolean("Finished"); prevRunningTicks = runningTicks = compound.getInt("Ticks"); - super.fromTag(compound, clientPacket); + super.read(compound, clientPacket); if (clientPacket) { NBTHelper.iterateCompoundList(compound.getList("ParticleItems", Tag.TAG_COMPOUND), diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/press/PressInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/press/PressInstance.java index a21ff8fbf..fc3430acc 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/press/PressInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/press/PressInstance.java @@ -1,7 +1,7 @@ package com.simibubi.create.content.contraptions.components.press; -import com.jozufozu.flywheel.api.instance.IDynamicInstance; import com.jozufozu.flywheel.api.MaterialManager; +import com.jozufozu.flywheel.api.instance.IDynamicInstance; import com.jozufozu.flywheel.core.Materials; import com.jozufozu.flywheel.core.materials.oriented.OrientedData; import com.mojang.math.Quaternion; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/saw/SawTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/saw/SawTileEntity.java index dc7367d1b..aa2fffc3f 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/saw/SawTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/saw/SawTileEntity.java @@ -6,10 +6,12 @@ import java.util.List; import java.util.Optional; import java.util.Random; import java.util.function.Predicate; +import java.util.function.Supplier; import java.util.stream.Collectors; import javax.annotation.ParametersAreNonnullByDefault; +import com.google.common.base.Suppliers; import com.google.common.collect.ImmutableList; import com.simibubi.create.AllRecipeTypes; import com.simibubi.create.AllSoundEvents; @@ -39,7 +41,6 @@ import net.minecraft.core.particles.ParticleTypes; import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.BlockTags; -import net.minecraft.util.LazyLoadedValue; import net.minecraft.util.Mth; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.item.BlockItem; @@ -75,8 +76,8 @@ public class SawTileEntity extends BlockBreakingKineticTileEntity { private static final AABB RENDER_BOX = new AABB(0, 0, 0, 1, 1, 1); private static final Object cuttingRecipesKey = new Object(); - public static final LazyLoadedValue> woodcuttingRecipeType = - new LazyLoadedValue<>(() -> Registry.RECIPE_TYPE.get(new ResourceLocation("druidcraft", "woodcutting"))); + public static final Supplier> woodcuttingRecipeType = + Suppliers.memoize(() -> Registry.RECIPE_TYPE.get(new ResourceLocation("druidcraft", "woodcutting"))); public ProcessingInventory inventory; private int recipeIndex; @@ -115,8 +116,8 @@ public class SawTileEntity extends BlockBreakingKineticTileEntity { } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { - super.fromTag(compound, clientPacket); + protected void read(CompoundTag compound, boolean clientPacket) { + super.read(compound, clientPacket); inventory.deserializeNBT(compound.getCompound("Inventory")); recipeIndex = compound.getInt("RecipeIndex"); if (compound.contains("PlayEvent")) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionLighter.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionLighter.java index 20047a97a..95ea67501 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionLighter.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionLighter.java @@ -2,8 +2,8 @@ package com.simibubi.create.content.contraptions.components.structureMovement; import com.jozufozu.flywheel.light.GPULightVolume; import com.jozufozu.flywheel.light.GridAlignedBB; -import com.jozufozu.flywheel.light.LightListener; import com.jozufozu.flywheel.light.ImmutableBox; +import com.jozufozu.flywheel.light.LightListener; import com.jozufozu.flywheel.light.LightProvider; import com.jozufozu.flywheel.light.LightUpdater; import com.jozufozu.flywheel.light.ListenerStatus; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/DirectionalExtenderScrollOptionSlot.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/DirectionalExtenderScrollOptionSlot.java index 66df467d5..0a04654c9 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/DirectionalExtenderScrollOptionSlot.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/DirectionalExtenderScrollOptionSlot.java @@ -28,7 +28,7 @@ public class DirectionalExtenderScrollOptionSlot extends CenteredSideValueBoxTra protected void rotate(BlockState state, PoseStack ms) { if (!getSide().getAxis().isHorizontal()) TransformStack.cast(ms) - .rotateY(AngleHelper.horizontalAngle(state.getValue(BlockStateProperties.FACING)) - 90); + .rotateY(AngleHelper.horizontalAngle(state.getValue(BlockStateProperties.FACING)) + 180); super.rotate(state, ms); } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/NonStationaryLighter.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/NonStationaryLighter.java index 3ed3f4368..363cd4afa 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/NonStationaryLighter.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/NonStationaryLighter.java @@ -1,9 +1,9 @@ package com.simibubi.create.content.contraptions.components.structureMovement; import com.jozufozu.flywheel.light.GridAlignedBB; -import com.jozufozu.flywheel.light.MovingListener; import com.jozufozu.flywheel.light.ImmutableBox; import com.jozufozu.flywheel.light.LightProvider; +import com.jozufozu.flywheel.light.MovingListener; import com.simibubi.create.foundation.config.AllConfigs; public class NonStationaryLighter extends ContraptionLighter implements MovingListener { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/BearingInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/BearingInstance.java index 871187f99..8f325b8b9 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/BearingInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/BearingInstance.java @@ -1,7 +1,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement.bearing; -import com.jozufozu.flywheel.api.instance.IDynamicInstance; import com.jozufozu.flywheel.api.MaterialManager; +import com.jozufozu.flywheel.api.instance.IDynamicInstance; import com.jozufozu.flywheel.core.PartialModel; import com.jozufozu.flywheel.core.materials.oriented.OrientedData; import com.mojang.math.Quaternion; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/ClockworkBearingTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/ClockworkBearingTileEntity.java index fdefd03d9..2ff025ffa 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/ClockworkBearingTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/ClockworkBearingTileEntity.java @@ -310,7 +310,7 @@ public class ClockworkBearingTileEntity extends KineticTileEntity } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { + protected void read(CompoundTag compound, boolean clientPacket) { float hourAngleBefore = hourAngle; float minuteAngleBefore = minuteAngle; @@ -318,7 +318,7 @@ public class ClockworkBearingTileEntity extends KineticTileEntity hourAngle = compound.getFloat("HourAngle"); minuteAngle = compound.getFloat("MinuteAngle"); lastException = AssemblyException.read(compound); - super.fromTag(compound, clientPacket); + super.read(compound, clientPacket); if (!clientPacket) return; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/MechanicalBearingTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/MechanicalBearingTileEntity.java index 2245c6ad5..efe0f72d9 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/MechanicalBearingTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/MechanicalBearingTileEntity.java @@ -73,9 +73,9 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { + protected void read(CompoundTag compound, boolean clientPacket) { if (wasMoved) { - super.fromTag(compound, clientPacket); + super.read(compound, clientPacket); return; } @@ -83,7 +83,7 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity running = compound.getBoolean("Running"); angle = compound.getFloat("Angle"); lastException = AssemblyException.read(compound); - super.fromTag(compound, clientPacket); + super.read(compound, clientPacket); if (!clientPacket) return; if (running) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/StabilizedBearingMovementBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/StabilizedBearingMovementBehaviour.java index f8a6fb01b..f00e600f3 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/StabilizedBearingMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/StabilizedBearingMovementBehaviour.java @@ -2,8 +2,8 @@ package com.simibubi.create.content.contraptions.components.structureMovement.be import javax.annotation.Nullable; -import com.jozufozu.flywheel.backend.Backend; import com.jozufozu.flywheel.api.MaterialManager; +import com.jozufozu.flywheel.backend.Backend; import com.jozufozu.flywheel.core.PartialModel; import com.mojang.math.Quaternion; import com.simibubi.create.AllBlockPartials; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/WindmillBearingTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/WindmillBearingTileEntity.java index e9302311c..33122a00d 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/WindmillBearingTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/WindmillBearingTileEntity.java @@ -65,10 +65,10 @@ public class WindmillBearingTileEntity extends MechanicalBearingTileEntity { } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { + protected void read(CompoundTag compound, boolean clientPacket) { if (!wasMoved) lastGeneratedSpeed = compound.getFloat("LastGenerated"); - super.fromTag(compound, clientPacket); + super.read(compound, clientPacket); } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/StickerInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/StickerInstance.java index 8cfcee50e..76df6195b 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/StickerInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/StickerInstance.java @@ -1,8 +1,8 @@ package com.simibubi.create.content.contraptions.components.structureMovement.chassis; +import com.jozufozu.flywheel.api.MaterialManager; import com.jozufozu.flywheel.api.instance.IDynamicInstance; import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance; -import com.jozufozu.flywheel.api.MaterialManager; import com.jozufozu.flywheel.core.materials.model.ModelData; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.foundation.utility.AngleHelper; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/StickerTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/StickerTileEntity.java index f81a01c1c..698a5b77c 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/StickerTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/StickerTileEntity.java @@ -83,8 +83,8 @@ public class StickerTileEntity extends SmartTileEntity implements FlywheelRender } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { - super.fromTag(compound, clientPacket); + protected void read(CompoundTag compound, boolean clientPacket) { + super.read(compound, clientPacket); if (clientPacket) update = true; } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryCarriageInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryCarriageInstance.java index c6b287569..51558e887 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryCarriageInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryCarriageInstance.java @@ -1,7 +1,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement.gantry; -import com.jozufozu.flywheel.api.instance.IDynamicInstance; import com.jozufozu.flywheel.api.MaterialManager; +import com.jozufozu.flywheel.api.instance.IDynamicInstance; import com.jozufozu.flywheel.core.materials.model.ModelData; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.base.KineticTileEntity; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryCarriageTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryCarriageTileEntity.java index b17779889..f4a65dfe2 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryCarriageTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryCarriageTileEntity.java @@ -117,9 +117,9 @@ public class GantryCarriageTileEntity extends KineticTileEntity implements IDisp } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { + protected void read(CompoundTag compound, boolean clientPacket) { lastException = AssemblyException.read(compound); - super.fromTag(compound, clientPacket); + super.read(compound, clientPacket); } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/GlueInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/GlueInstance.java index 3da75e87d..bd464c94c 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/GlueInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/GlueInstance.java @@ -1,11 +1,11 @@ package com.simibubi.create.content.contraptions.components.structureMovement.glue; -import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat; -import com.jozufozu.flywheel.api.instance.ITickableInstance; import com.jozufozu.flywheel.api.Instancer; -import com.jozufozu.flywheel.backend.instancing.entity.EntityInstance; import com.jozufozu.flywheel.api.MaterialGroup; import com.jozufozu.flywheel.api.MaterialManager; +import com.jozufozu.flywheel.api.instance.ITickableInstance; +import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat; +import com.jozufozu.flywheel.backend.instancing.entity.EntityInstance; import com.jozufozu.flywheel.core.Formats; import com.jozufozu.flywheel.core.Materials; import com.jozufozu.flywheel.core.instancing.ConditionalInstance; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/CartAssemblerTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/CartAssemblerTileEntity.java index 33b62c6e5..29f90ea2d 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/CartAssemblerTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/CartAssemblerTileEntity.java @@ -242,9 +242,9 @@ public class CartAssemblerTileEntity extends SmartTileEntity implements IDisplay } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { + protected void read(CompoundTag compound, boolean clientPacket) { lastException = AssemblyException.read(compound); - super.fromTag(compound, clientPacket); + super.read(compound, clientPacket); } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/LinearActuatorTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/LinearActuatorTileEntity.java index 2a8789677..e02fd3faf 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/LinearActuatorTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/LinearActuatorTileEntity.java @@ -194,7 +194,7 @@ public abstract class LinearActuatorTileEntity extends KineticTileEntity } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { + protected void read(CompoundTag compound, boolean clientPacket) { boolean forceMovement = compound.contains("ForceMovement"); float offsetBefore = offset; @@ -202,7 +202,7 @@ public abstract class LinearActuatorTileEntity extends KineticTileEntity waitingForSpeedChange = compound.getBoolean("Waiting"); offset = compound.getFloat("Offset"); lastException = AssemblyException.read(compound); - super.fromTag(compound, clientPacket); + super.read(compound, clientPacket); if (!clientPacket) return; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/MechanicalPistonTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/MechanicalPistonTileEntity.java index 760d491d7..85674c3b4 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/MechanicalPistonTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/MechanicalPistonTileEntity.java @@ -32,9 +32,9 @@ public class MechanicalPistonTileEntity extends LinearActuatorTileEntity { } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { + protected void read(CompoundTag compound, boolean clientPacket) { extensionLength = compound.getInt("ExtensionLength"); - super.fromTag(compound, clientPacket); + super.read(compound, clientPacket); } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/AbstractPulleyInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/AbstractPulleyInstance.java index 299f29146..8906a5ab0 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/AbstractPulleyInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/AbstractPulleyInstance.java @@ -1,19 +1,19 @@ package com.simibubi.create.content.contraptions.components.structureMovement.pulley; -import com.jozufozu.flywheel.api.instance.IDynamicInstance; import com.jozufozu.flywheel.api.Instancer; import com.jozufozu.flywheel.api.MaterialManager; +import com.jozufozu.flywheel.api.instance.IDynamicInstance; import com.jozufozu.flywheel.core.instancing.ConditionalInstance; import com.jozufozu.flywheel.core.instancing.GroupInstance; import com.jozufozu.flywheel.core.instancing.SelectInstance; import com.jozufozu.flywheel.core.materials.oriented.OrientedData; import com.jozufozu.flywheel.light.GridAlignedBB; -import com.jozufozu.flywheel.light.MovingListener; import com.jozufozu.flywheel.light.ImmutableBox; import com.jozufozu.flywheel.light.LightPacking; import com.jozufozu.flywheel.light.LightProvider; import com.jozufozu.flywheel.light.LightUpdater; import com.jozufozu.flywheel.light.LightVolume; +import com.jozufozu.flywheel.light.MovingListener; import com.mojang.math.Vector3f; import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.relays.encased.ShaftInstance; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyTileEntity.java index d9ceebbfe..b8b50ca0a 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyTileEntity.java @@ -193,10 +193,10 @@ public class PulleyTileEntity extends LinearActuatorTileEntity { } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { + protected void read(CompoundTag compound, boolean clientPacket) { initialOffset = compound.getInt("InitialOffset"); needsContraption = compound.getBoolean("NeedsContraption"); - super.fromTag(compound, clientPacket); + super.read(compound, clientPacket); } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionInstanceManager.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionInstanceManager.java index a10a0d6c1..94bfa5183 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionInstanceManager.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionInstanceManager.java @@ -7,8 +7,8 @@ import javax.annotation.Nullable; import org.apache.commons.lang3.tuple.Pair; -import com.jozufozu.flywheel.backend.instancing.tile.TileInstanceManager; import com.jozufozu.flywheel.api.MaterialManager; +import com.jozufozu.flywheel.backend.instancing.tile.TileInstanceManager; import com.simibubi.create.AllMovementBehaviours; import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/FlwContraptionManager.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/FlwContraptionManager.java index 50f99598f..f4794fa75 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/FlwContraptionManager.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/FlwContraptionManager.java @@ -4,9 +4,9 @@ import static org.lwjgl.opengl.GL11.glBindTexture; import static org.lwjgl.opengl.GL12.GL_TEXTURE_3D; import com.jozufozu.flywheel.backend.Backend; +import com.jozufozu.flywheel.backend.RenderLayer; import com.jozufozu.flywheel.backend.gl.GlTextureUnit; import com.jozufozu.flywheel.backend.gl.GlVertexArray; -import com.jozufozu.flywheel.backend.RenderLayer; import com.jozufozu.flywheel.event.RenderLayerEvent; import com.jozufozu.flywheel.util.TextureBinder; import com.simibubi.create.content.contraptions.components.structureMovement.Contraption; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/WaterWheelTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/WaterWheelTileEntity.java index f9d941673..2f4aede14 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/WaterWheelTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/WaterWheelTileEntity.java @@ -28,8 +28,8 @@ public class WaterWheelTileEntity extends GeneratingKineticTileEntity { } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { - super.fromTag(compound, clientPacket); + protected void read(CompoundTag compound, boolean clientPacket) { + super.read(compound, clientPacket); if (compound.contains("Flows")) { for (Direction d : Iterate.directions) setFlow(d, compound.getCompound("Flows") diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpTileEntity.java index b484e01ee..f8df35193 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpTileEntity.java @@ -311,9 +311,9 @@ public class PumpTileEntity extends KineticTileEntity { } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { + protected void read(CompoundTag compound, boolean clientPacket) { reversed = compound.getBoolean("Reversed"); - super.fromTag(compound, clientPacket); + super.read(compound, clientPacket); } public void updatePipesOnSide(Direction side) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/HosePulleyTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/HosePulleyTileEntity.java index 67234bda8..be066a98e 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/HosePulleyTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/HosePulleyTileEntity.java @@ -155,10 +155,10 @@ public class HosePulleyTileEntity extends KineticTileEntity { } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { + protected void read(CompoundTag compound, boolean clientPacket) { offset.readNBT(compound.getCompound("Offset"), clientPacket); internalTank.readFromNBT(compound.getCompound("Tank")); - super.fromTag(compound, clientPacket); + super.read(compound, clientPacket); if (clientPacket) infinite = compound.getBoolean("Infinite"); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/ItemDrainTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/ItemDrainTileEntity.java index d0b9b09be..d85ad6bb6 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/ItemDrainTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/ItemDrainTileEntity.java @@ -270,12 +270,12 @@ public class ItemDrainTileEntity extends SmartTileEntity implements IHaveGoggleI } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { + protected void read(CompoundTag compound, boolean clientPacket) { heldItem = null; processingTicks = compound.getInt("ProcessingTicks"); if (compound.contains("HeldItem")) heldItem = TransportedItemStack.read(compound.getCompound("HeldItem")); - super.fromTag(compound, clientPacket); + super.read(compound, clientPacket); } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/SpoutTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/SpoutTileEntity.java index 0985a8281..10c2447da 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/SpoutTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/SpoutTileEntity.java @@ -151,8 +151,8 @@ public class SpoutTileEntity extends SmartTileEntity implements IHaveGoggleInfor } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { - super.fromTag(compound, clientPacket); + protected void read(CompoundTag compound, boolean clientPacket) { + super.read(compound, clientPacket); processingTicks = compound.getInt("ProcessingTicks"); if (!clientPacket) return; diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidValveInstance.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidValveInstance.java index 6d6866c8a..834947da9 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidValveInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidValveInstance.java @@ -1,7 +1,7 @@ package com.simibubi.create.content.contraptions.fluids.pipes; -import com.jozufozu.flywheel.api.instance.IDynamicInstance; import com.jozufozu.flywheel.api.MaterialManager; +import com.jozufozu.flywheel.api.instance.IDynamicInstance; import com.jozufozu.flywheel.core.Materials; import com.jozufozu.flywheel.core.materials.model.ModelData; import com.simibubi.create.AllBlockPartials; diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidValveTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidValveTileEntity.java index 31276bca2..79490b78d 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidValveTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidValveTileEntity.java @@ -70,8 +70,8 @@ public class FluidValveTileEntity extends KineticTileEntity { } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { - super.fromTag(compound, clientPacket); + protected void read(CompoundTag compound, boolean clientPacket) { + super.read(compound, clientPacket); pointer.readNBT(compound.getCompound("Pointer"), clientPacket); } 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 48b75f0b2..c43d2aca0 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 @@ -338,8 +338,8 @@ public class FluidTankTileEntity extends SmartTileEntity implements IHaveGoggleI } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { - super.fromTag(compound, clientPacket); + protected void read(CompoundTag compound, boolean clientPacket) { + super.read(compound, clientPacket); BlockPos controllerBefore = controller; int prevSize = width; 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 ea4c78eef..118c292ec 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 @@ -26,7 +26,6 @@ import com.simibubi.create.foundation.utility.outliner.Outline; import com.simibubi.create.foundation.utility.outliner.Outliner.OutlineEntry; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -151,10 +150,7 @@ public class GoggleOverlayRenderer { return; poseStack.pushPose(); - Screen tooltipScreen = new TooltipScreen(new TextComponent("")); - tooltipScreen.init(mc, width, height); - int titleLinesCount = 1; int tooltipTextWidth = 0; for (FormattedText textLine : tooltip) { int textLineWidth = mc.font.width(textLine); @@ -164,17 +160,16 @@ public class GoggleOverlayRenderer { int tooltipHeight = 8; if (tooltip.size() > 1) { + tooltipHeight += 2; // gap between title lines and next lines tooltipHeight += (tooltip.size() - 1) * 10; - if (tooltip.size() > titleLinesCount) - tooltipHeight += 2; // gap between title lines and next lines } CClient cfg = AllConfigs.CLIENT; - int posX = tooltipScreen.width / 2 + cfg.overlayOffsetX.get(); - int posY = tooltipScreen.height / 2 + cfg.overlayOffsetY.get(); + int posX = width / 2 + cfg.overlayOffsetX.get(); + int posY = height / 2 + cfg.overlayOffsetY.get(); - posX = Math.min(posX, tooltipScreen.width - tooltipTextWidth - 20); - posY = Math.min(posY, tooltipScreen.height - tooltipHeight - 20); + posX = Math.min(posX, width - tooltipTextWidth - 20); + posY = Math.min(posY, height - tooltipHeight - 20); float fade = Mth.clamp((hoverTicks + partialTicks) / 12f, 0, 1); Boolean useCustom = cfg.overlayCustomColor.get(); @@ -195,7 +190,7 @@ public class GoggleOverlayRenderer { colorBorderBot.scaleAlpha(fade); } - RemovedGuiUtils.drawHoveringText(poseStack, tooltip, posX, posY, tooltipScreen.width, tooltipScreen.height, -1, + RemovedGuiUtils.drawHoveringText(poseStack, tooltip, posX, posY, width, height, -1, colorBackground.getRGB(), colorBorderTop.getRGB(), colorBorderBot.getRGB(), mc.font); ItemStack item = AllItems.GOGGLES.asStack(); @@ -206,26 +201,11 @@ public class GoggleOverlayRenderer { } /** - * Use this method to add custom entry points to the goggle overay, e.g. custom + * Use this method to add custom entry points to the goggles overlay, e.g. custom * armor, handheld alternatives, etc. */ public static void registerCustomGoggleCondition(Supplier condition) { customGogglePredicates.add(condition); } - public static final class TooltipScreen extends Screen { - public TooltipScreen(Component p_i51108_1_) { - super(p_i51108_1_); - } - -// @Override -// public void init(Minecraft mc, int width, int height) { -// this.minecraft = mc; -// this.itemRenderer = mc.getItemRenderer(); -// this.font = mc.font; -// this.width = width; -// this.height = height; -// } - } - } diff --git a/src/main/java/com/simibubi/create/content/contraptions/processing/BasinTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/processing/BasinTileEntity.java index 0f39bcda5..98c6f46ca 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/processing/BasinTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/processing/BasinTileEntity.java @@ -140,8 +140,8 @@ public class BasinTileEntity extends SmartTileEntity implements IHaveGoggleInfor } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { - super.fromTag(compound, clientPacket); + protected void read(CompoundTag compound, boolean clientPacket) { + super.read(compound, clientPacket); inputInventory.deserializeNBT(compound.getCompound("InputItems")); outputInventory.deserializeNBT(compound.getCompound("OutputItems")); diff --git a/src/main/java/com/simibubi/create/content/contraptions/processing/ProcessingOutput.java b/src/main/java/com/simibubi/create/content/contraptions/processing/ProcessingOutput.java index 60186bcd9..0d280b60d 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/processing/ProcessingOutput.java +++ b/src/main/java/com/simibubi/create/content/contraptions/processing/ProcessingOutput.java @@ -67,7 +67,7 @@ public class ProcessingOutput { if (count != 1) json.addProperty("count", count); if (stack.hasTag()) - json.add("nbt", new JsonParser().parse(stack.getTag() + json.add("nbt", JsonParser.parseString(stack.getTag() .toString())); if (chance != 1) json.addProperty("chance", chance); diff --git a/src/main/java/com/simibubi/create/content/contraptions/processing/burner/BlazeBurnerTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/processing/burner/BlazeBurnerTileEntity.java index a32c3e0b2..934dc3504 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/processing/burner/BlazeBurnerTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/processing/burner/BlazeBurnerTileEntity.java @@ -135,11 +135,11 @@ public class BlazeBurnerTileEntity extends SmartTileEntity { } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { + protected void read(CompoundTag compound, boolean clientPacket) { activeFuel = FuelType.values()[compound.getInt("fuelLevel")]; remainingBurnTime = compound.getInt("burnTimeRemaining"); isCreative = compound.getBoolean("isCreative"); - super.fromTag(compound, clientPacket); + super.read(compound, clientPacket); } public BlazeBurnerBlock.HeatLevel getHeatLevelFromBlock() { diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/sequencer/SequencedGearshiftTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/sequencer/SequencedGearshiftTileEntity.java index 9d2580d82..9c595af72 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/sequencer/SequencedGearshiftTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/sequencer/SequencedGearshiftTileEntity.java @@ -146,14 +146,14 @@ public class SequencedGearshiftTileEntity extends SplitShaftTileEntity { } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { + protected void read(CompoundTag compound, boolean clientPacket) { currentInstruction = compound.getInt("InstructionIndex"); currentInstructionDuration = compound.getInt("InstructionDuration"); currentInstructionProgress = compound.getFloat("InstructionProgress"); poweredPreviously = compound.getBoolean("PrevPowered"); timer = compound.getInt("Timer"); instructions = Instruction.deserializeAll(compound.getList("Instructions", Tag.TAG_COMPOUND)); - super.fromTag(compound, clientPacket); + super.read(compound, clientPacket); } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltTileEntity.java index 1058e4c44..33cbbd251 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltTileEntity.java @@ -14,8 +14,8 @@ import java.util.function.Function; import com.jozufozu.flywheel.backend.instancing.InstancedRenderDispatcher; import com.jozufozu.flywheel.light.GridAlignedBB; -import com.jozufozu.flywheel.light.LightListener; import com.jozufozu.flywheel.light.ImmutableBox; +import com.jozufozu.flywheel.light.LightListener; import com.jozufozu.flywheel.light.LightProvider; import com.jozufozu.flywheel.light.LightUpdater; import com.jozufozu.flywheel.light.ListenerStatus; @@ -214,9 +214,9 @@ public class BeltTileEntity extends KineticTileEntity implements LightListener { } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { + protected void read(CompoundTag compound, boolean clientPacket) { int prevBeltLength = beltLength; - super.fromTag(compound, clientPacket); + super.read(compound, clientPacket); if (compound.getBoolean("IsController")) controller = worldPosition; diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/encased/AdjustablePulleyTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/relays/encased/AdjustablePulleyTileEntity.java index 7cea51a90..886456a31 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/encased/AdjustablePulleyTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/encased/AdjustablePulleyTileEntity.java @@ -25,9 +25,9 @@ public class AdjustablePulleyTileEntity extends KineticTileEntity { } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { + protected void read(CompoundTag compound, boolean clientPacket) { signal = compound.getInt("Signal"); - super.fromTag(compound, clientPacket); + super.read(compound, clientPacket); } public float getModifier() { diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeInstance.java b/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeInstance.java index 89e89b51b..6843111cb 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeInstance.java @@ -2,9 +2,9 @@ package com.simibubi.create.content.contraptions.relays.gauge; import java.util.ArrayList; -import com.jozufozu.flywheel.api.instance.IDynamicInstance; import com.jozufozu.flywheel.api.Instancer; import com.jozufozu.flywheel.api.MaterialManager; +import com.jozufozu.flywheel.api.instance.IDynamicInstance; import com.jozufozu.flywheel.core.materials.model.ModelData; import com.jozufozu.flywheel.util.transform.TransformStack; import com.mojang.blaze3d.vertex.PoseStack; diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeTileEntity.java index f481f546e..5df103fc8 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeTileEntity.java @@ -31,10 +31,10 @@ public class GaugeTileEntity extends KineticTileEntity implements IHaveGoggleInf } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { + protected void read(CompoundTag compound, boolean clientPacket) { dialTarget = compound.getFloat("Value"); color = compound.getInt("Color"); - super.fromTag(compound, clientPacket); + super.read(compound, clientPacket); } @Override diff --git a/src/main/java/com/simibubi/create/content/curiosities/armor/AllArmorMaterials.java b/src/main/java/com/simibubi/create/content/curiosities/armor/AllArmorMaterials.java index db63cb334..24b2f4c77 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/armor/AllArmorMaterials.java +++ b/src/main/java/com/simibubi/create/content/curiosities/armor/AllArmorMaterials.java @@ -2,10 +2,10 @@ package com.simibubi.create.content.curiosities.armor; import java.util.function.Supplier; +import com.google.common.base.Suppliers; import com.simibubi.create.AllSoundEvents; import net.minecraft.sounds.SoundEvent; -import net.minecraft.util.LazyLoadedValue; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.item.ArmorMaterial; import net.minecraft.world.item.Items; @@ -28,7 +28,7 @@ public enum AllArmorMaterials implements ArmorMaterial { private final SoundEvent soundEvent; private final float toughness; private final float knockbackResistance; - private final LazyLoadedValue repairMaterial; + private final Supplier repairMaterial; private AllArmorMaterials(String p_i231593_3_, int p_i231593_4_, int[] p_i231593_5_, int p_i231593_6_, SoundEvent p_i231593_7_, float p_i231593_8_, float p_i231593_9_, Supplier p_i231593_10_) { @@ -39,7 +39,7 @@ public enum AllArmorMaterials implements ArmorMaterial { this.soundEvent = p_i231593_7_; this.toughness = p_i231593_8_; this.knockbackResistance = p_i231593_9_; - this.repairMaterial = new LazyLoadedValue<>(p_i231593_10_); + this.repairMaterial = Suppliers.memoize(p_i231593_10_::get); } public int getDurabilityForSlot(EquipmentSlot p_200896_1_) { diff --git a/src/main/java/com/simibubi/create/content/curiosities/armor/CopperBacktankTileEntity.java b/src/main/java/com/simibubi/create/content/curiosities/armor/CopperBacktankTileEntity.java index 7ee64de74..d83cd2dcc 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/armor/CopperBacktankTileEntity.java +++ b/src/main/java/com/simibubi/create/content/curiosities/armor/CopperBacktankTileEntity.java @@ -95,8 +95,8 @@ public class CopperBacktankTileEntity extends KineticTileEntity implements Namea } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { - super.fromTag(compound, clientPacket); + protected void read(CompoundTag compound, boolean clientPacket) { + super.read(compound, clientPacket); int prev = airLevel; capacityEnchantLevel = compound.getInt("CapacityEnchantment"); airLevel = compound.getInt("Air"); diff --git a/src/main/java/com/simibubi/create/content/curiosities/bell/HauntedBellTileEntity.java b/src/main/java/com/simibubi/create/content/curiosities/bell/HauntedBellTileEntity.java index aa96c46a5..d794c5d2b 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/bell/HauntedBellTileEntity.java +++ b/src/main/java/com/simibubi/create/content/curiosities/bell/HauntedBellTileEntity.java @@ -1,11 +1,9 @@ package com.simibubi.create.content.curiosities.bell; -import java.util.List; import java.util.Random; import com.jozufozu.flywheel.core.PartialModel; import com.simibubi.create.AllBlockPartials; -import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -29,9 +27,6 @@ public class HauntedBellTileEntity extends AbstractBellTileEntity { super(type, pos, state); } - @Override - public void addBehaviours(List behaviours) { } - @Override public PartialModel getBellModel() { return AllBlockPartials.HAUNTED_BELL; @@ -65,8 +60,8 @@ public class HauntedBellTileEntity extends AbstractBellTileEntity { } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { - super.fromTag(compound, clientPacket); + protected void read(CompoundTag compound, boolean clientPacket) { + super.read(compound, clientPacket); effectTicks = compound.getInt("EffectTicks"); } diff --git a/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolBoxInstance.java b/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolBoxInstance.java index d8d13908c..1e9f7db99 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolBoxInstance.java +++ b/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolBoxInstance.java @@ -1,9 +1,9 @@ package com.simibubi.create.content.curiosities.toolbox; -import com.jozufozu.flywheel.api.instance.IDynamicInstance; import com.jozufozu.flywheel.api.Instancer; -import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance; import com.jozufozu.flywheel.api.MaterialManager; +import com.jozufozu.flywheel.api.instance.IDynamicInstance; +import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance; import com.jozufozu.flywheel.core.Materials; import com.jozufozu.flywheel.core.materials.model.ModelData; import com.simibubi.create.AllBlockPartials; diff --git a/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxContainer.java b/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxContainer.java index e6c1ec786..c7b5ddfe6 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxContainer.java +++ b/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxContainer.java @@ -43,7 +43,7 @@ public class ToolboxContainer extends ContainerBase { BlockEntity tileEntity = world.getBlockEntity(readBlockPos); if (tileEntity instanceof ToolboxTileEntity) { ToolboxTileEntity toolbox = (ToolboxTileEntity) tileEntity; - toolbox.handleUpdateTag(readNbt); + toolbox.readClient(readNbt); return toolbox; } diff --git a/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxDisposeAllPacket.java b/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxDisposeAllPacket.java index ebe74043e..920ab41db 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxDisposeAllPacket.java +++ b/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxDisposeAllPacket.java @@ -14,8 +14,8 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraftforge.network.NetworkEvent.Context; import net.minecraftforge.items.ItemHandlerHelper; +import net.minecraftforge.network.NetworkEvent.Context; public class ToolboxDisposeAllPacket extends SimplePacketBase { diff --git a/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxEquipPacket.java b/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxEquipPacket.java index 4311c215e..55538921e 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxEquipPacket.java +++ b/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxEquipPacket.java @@ -12,8 +12,8 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraftforge.network.NetworkEvent.Context; import net.minecraftforge.items.ItemHandlerHelper; +import net.minecraftforge.network.NetworkEvent.Context; public class ToolboxEquipPacket extends SimplePacketBase { diff --git a/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxTileEntity.java b/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxTileEntity.java index 0c6983ff5..005eb09aa 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxTileEntity.java +++ b/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxTileEntity.java @@ -283,9 +283,9 @@ public class ToolboxTileEntity extends SmartTileEntity implements MenuProvider, } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { + protected void read(CompoundTag compound, boolean clientPacket) { inventory.deserializeNBT(compound.getCompound("Inventory")); - super.fromTag(compound, clientPacket); + super.read(compound, clientPacket); if (compound.contains("UniqueId", 11)) this.uniqueId = compound.getUUID("UniqueId"); if (compound.contains("CustomName", 8)) diff --git a/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripItem.java b/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripItem.java index 434e3aefc..239c17b32 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripItem.java +++ b/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripItem.java @@ -2,7 +2,9 @@ package com.simibubi.create.content.curiosities.tools; import java.util.UUID; import java.util.function.Consumer; +import java.util.function.Supplier; +import com.google.common.base.Suppliers; import com.google.common.collect.ImmutableMultimap; import com.google.common.collect.Multimap; import com.simibubi.create.AllItems; @@ -17,7 +19,6 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.player.LocalPlayer; import net.minecraft.nbt.CompoundTag; import net.minecraft.server.level.ServerPlayer; -import net.minecraft.util.LazyLoadedValue; import net.minecraft.world.InteractionHand; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; @@ -65,13 +66,15 @@ public class ExtendoGripItem extends Item { new AttributeModifier(UUID.fromString("8f7dbdb2-0d0d-458a-aa40-ac7633691f66"), "Range modifier", 5, AttributeModifier.Operation.ADDITION); - static LazyLoadedValue> rangeModifier = new LazyLoadedValue<>(() -> - // Holding an ExtendoGrip - ImmutableMultimap.of(ForgeMod.REACH_DISTANCE.get(), singleRangeAttributeModifier)); + static Supplier> rangeModifier = Suppliers.memoize(() -> + // Holding an ExtendoGrip + ImmutableMultimap.of(ForgeMod.REACH_DISTANCE.get(), singleRangeAttributeModifier) + ); - static LazyLoadedValue> doubleRangeModifier = new LazyLoadedValue<>(() -> - // Holding two ExtendoGrips o.O - ImmutableMultimap.of(ForgeMod.REACH_DISTANCE.get(), doubleRangeAttributeModifier)); + static Supplier> doubleRangeModifier = Suppliers.memoize(() -> + // Holding two ExtendoGrips o.O + ImmutableMultimap.of(ForgeMod.REACH_DISTANCE.get(), doubleRangeAttributeModifier) + ); public ExtendoGripItem(Properties properties) { super(properties.stacksTo(1) diff --git a/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperLog.java b/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperLog.java index 76c091d30..ac17c5c19 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperLog.java +++ b/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperLog.java @@ -36,7 +36,7 @@ public class ZapperLog { List blocks = positions.stream().map(pos -> { BlockEntity tileEntity = world.getBlockEntity(pos); - return new StructureBlockInfo(pos, world.getBlockState(pos), tileEntity == null ? null : tileEntity.serializeNBT()); + return new StructureBlockInfo(pos, world.getBlockState(pos), tileEntity == null ? null : tileEntity.saveWithFullMetadata()); }).collect(Collectors.toList()); log.add(0, blocks); diff --git a/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BeltTunnelInstance.java b/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BeltTunnelInstance.java index 3b442c194..231c6706a 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BeltTunnelInstance.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BeltTunnelInstance.java @@ -5,11 +5,11 @@ import java.util.Collection; import java.util.EnumMap; import java.util.Map; -import com.jozufozu.flywheel.api.instance.IDynamicInstance; import com.jozufozu.flywheel.api.InstanceData; import com.jozufozu.flywheel.api.Instancer; -import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance; import com.jozufozu.flywheel.api.MaterialManager; +import com.jozufozu.flywheel.api.instance.IDynamicInstance; +import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.logistics.block.flap.FlapData; import com.simibubi.create.foundation.render.AllMaterialSpecs; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BeltTunnelTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BeltTunnelTileEntity.java index 725701f8f..3ff3cb53c 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BeltTunnelTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BeltTunnelTileEntity.java @@ -77,7 +77,7 @@ public class BeltTunnelTileEntity extends SmartTileEntity implements FlywheelRen } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { + protected void read(CompoundTag compound, boolean clientPacket) { Set newFlaps = new HashSet<>(6); ListTag flapsNBT = compound.getList("Flaps", Tag.TAG_INT); for (Tag inbt : flapsNBT) @@ -101,7 +101,7 @@ public class BeltTunnelTileEntity extends SmartTileEntity implements FlywheelRen // Backwards compat if (!compound.contains("Sides") && compound.contains("Flaps")) sides.addAll(flaps.keySet()); - super.fromTag(compound, clientPacket); + super.read(compound, clientPacket); if (clientPacket) DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> InstancedRenderDispatcher.enqueueUpdate(this)); } diff --git a/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BrassTunnelTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BrassTunnelTileEntity.java index 3081c5fd9..e0892c0f2 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BrassTunnelTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BrassTunnelTileEntity.java @@ -581,7 +581,7 @@ public class BrassTunnelTileEntity extends BeltTunnelTileEntity implements IHave } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { + protected void read(CompoundTag compound, boolean clientPacket) { boolean wasConnectedLeft = connectedLeft; boolean wasConnectedRight = connectedRight; @@ -603,7 +603,7 @@ public class BrassTunnelTileEntity extends BeltTunnelTileEntity implements IHave })); } - super.fromTag(compound, clientPacket); + super.read(compound, clientPacket); if (!clientPacket) return; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/chute/ChuteTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/chute/ChuteTileEntity.java index c72b26ff8..804ce563d 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/chute/ChuteTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/chute/ChuteTileEntity.java @@ -520,14 +520,14 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { + protected void read(CompoundTag compound, boolean clientPacket) { ItemStack previousItem = item; item = ItemStack.of(compound.getCompound("Item")); itemPosition.lastValue = itemPosition.value = compound.getFloat("ItemPosition"); pull = compound.getFloat("Pull"); push = compound.getFloat("Push"); bottomPullDistance = compound.getFloat("BottomAirFlowDistance"); - super.fromTag(compound, clientPacket); + super.read(compound, clientPacket); // if (clientPacket) // airCurrent.rebuild(); diff --git a/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorInstance.java b/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorInstance.java index 6e53494a1..dc484208d 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorInstance.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorInstance.java @@ -1,7 +1,7 @@ package com.simibubi.create.content.logistics.block.depot; -import com.jozufozu.flywheel.api.instance.IDynamicInstance; import com.jozufozu.flywheel.api.MaterialManager; +import com.jozufozu.flywheel.api.instance.IDynamicInstance; import com.jozufozu.flywheel.core.materials.model.ModelData; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.relays.encased.ShaftInstance; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorTileEntity.java index aad776901..28e027107 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorTileEntity.java @@ -518,8 +518,8 @@ public class EjectorTileEntity extends KineticTileEntity { } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { - super.fromTag(compound, clientPacket); + protected void read(CompoundTag compound, boolean clientPacket) { + super.read(compound, clientPacket); int horizontalDistance = compound.getInt("HorizontalDistance"); int verticalDistance = compound.getInt("VerticalDistance"); diff --git a/src/main/java/com/simibubi/create/content/logistics/block/diodes/BrassDiodeInstance.java b/src/main/java/com/simibubi/create/content/logistics/block/diodes/BrassDiodeInstance.java index 530288476..04ce9ca21 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/diodes/BrassDiodeInstance.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/diodes/BrassDiodeInstance.java @@ -1,8 +1,8 @@ package com.simibubi.create.content.logistics.block.diodes; +import com.jozufozu.flywheel.api.MaterialManager; import com.jozufozu.flywheel.api.instance.ITickableInstance; import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance; -import com.jozufozu.flywheel.api.MaterialManager; import com.jozufozu.flywheel.core.Materials; import com.jozufozu.flywheel.core.materials.model.ModelData; import com.simibubi.create.AllBlockPartials; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/diodes/BrassDiodeTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/diodes/BrassDiodeTileEntity.java index 88dde14e9..2a0e9e811 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/diodes/BrassDiodeTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/diodes/BrassDiodeTileEntity.java @@ -66,9 +66,9 @@ public abstract class BrassDiodeTileEntity extends SmartTileEntity implements Fl } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { + protected void read(CompoundTag compound, boolean clientPacket) { state = compound.getInt("State"); - super.fromTag(compound, clientPacket); + super.read(compound, clientPacket); } @Override diff --git a/src/main/java/com/simibubi/create/content/logistics/block/flap/FlapType.java b/src/main/java/com/simibubi/create/content/logistics/block/flap/FlapType.java index 398edcc20..9838d5708 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/flap/FlapType.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/flap/FlapType.java @@ -1,11 +1,11 @@ package com.simibubi.create.content.logistics.block.flap; -import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat; -import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer; import com.jozufozu.flywheel.api.struct.Batched; import com.jozufozu.flywheel.api.struct.BatchingTransformer; -import com.jozufozu.flywheel.api.struct.StructWriter; import com.jozufozu.flywheel.api.struct.Instanced; +import com.jozufozu.flywheel.api.struct.StructWriter; +import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat; +import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer; import com.jozufozu.flywheel.core.model.Model; import com.simibubi.create.foundation.render.AllInstanceFormats; import com.simibubi.create.foundation.render.AllProgramSpecs; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/flap/UnsafeFlapWriter.java b/src/main/java/com/simibubi/create/content/logistics/block/flap/UnsafeFlapWriter.java index 258d5323e..f0ace42cc 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/flap/UnsafeFlapWriter.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/flap/UnsafeFlapWriter.java @@ -2,8 +2,8 @@ package com.simibubi.create.content.logistics.block.flap; import org.lwjgl.system.MemoryUtil; -import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer; import com.jozufozu.flywheel.api.struct.StructType; +import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer; import com.jozufozu.flywheel.backend.struct.UnsafeBufferWriter; public class UnsafeFlapWriter extends UnsafeBufferWriter { diff --git a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelInstance.java b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelInstance.java index 3c9f74f12..83d36c1e6 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelInstance.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelInstance.java @@ -2,11 +2,11 @@ package com.simibubi.create.content.logistics.block.funnel; import java.util.ArrayList; -import com.jozufozu.flywheel.api.instance.IDynamicInstance; import com.jozufozu.flywheel.api.InstanceData; import com.jozufozu.flywheel.api.Instancer; -import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance; import com.jozufozu.flywheel.api.MaterialManager; +import com.jozufozu.flywheel.api.instance.IDynamicInstance; +import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance; import com.jozufozu.flywheel.core.PartialModel; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.logistics.block.flap.FlapData; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelTileEntity.java index 3e4d0b691..eadb7173e 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelTileEntity.java @@ -323,8 +323,8 @@ public class FunnelTileEntity extends SmartTileEntity implements IHaveHoveringIn } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { - super.fromTag(compound, clientPacket); + protected void read(CompoundTag compound, boolean clientPacket) { + super.read(compound, clientPacket); extractionCooldown = compound.getInt("TransferCooldown"); if (clientPacket) diff --git a/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmInstance.java b/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmInstance.java index dec838e9d..3d118c46c 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmInstance.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmInstance.java @@ -3,11 +3,11 @@ package com.simibubi.create.content.logistics.block.mechanicalArm; import java.util.ArrayList; import com.google.common.collect.Lists; -import com.jozufozu.flywheel.api.instance.IDynamicInstance; import com.jozufozu.flywheel.api.InstanceData; import com.jozufozu.flywheel.api.Instancer; import com.jozufozu.flywheel.api.Material; import com.jozufozu.flywheel.api.MaterialManager; +import com.jozufozu.flywheel.api.instance.IDynamicInstance; import com.jozufozu.flywheel.core.materials.model.ModelData; import com.jozufozu.flywheel.util.transform.TransformStack; import com.mojang.blaze3d.vertex.PoseStack; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmTileEntity.java index 4a4165885..8bc3af564 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmTileEntity.java @@ -467,12 +467,12 @@ public class ArmTileEntity extends KineticTileEntity implements ITransformableTE } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { + protected void read(CompoundTag compound, boolean clientPacket) { int previousIndex = chasedPointIndex; Phase previousPhase = phase; ListTag interactionPointTagBefore = interactionPointTag; - super.fromTag(compound, clientPacket); + super.read(compound, clientPacket); heldItem = ItemStack.of(compound.getCompound("HeldItem")); phase = NBTHelper.readEnum(compound, "Phase", Phase.class); chasedPointIndex = compound.getInt("TargetPointIndex"); diff --git a/src/main/java/com/simibubi/create/content/logistics/block/redstone/AnalogLeverInstance.java b/src/main/java/com/simibubi/create/content/logistics/block/redstone/AnalogLeverInstance.java index c4c74119b..7eb4a61fd 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/redstone/AnalogLeverInstance.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/redstone/AnalogLeverInstance.java @@ -1,9 +1,9 @@ package com.simibubi.create.content.logistics.block.redstone; -import com.jozufozu.flywheel.api.instance.IDynamicInstance; -import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance; import com.jozufozu.flywheel.api.Material; import com.jozufozu.flywheel.api.MaterialManager; +import com.jozufozu.flywheel.api.instance.IDynamicInstance; +import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance; import com.jozufozu.flywheel.core.materials.model.ModelData; import com.jozufozu.flywheel.util.transform.Rotate; import com.jozufozu.flywheel.util.transform.Translate; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/redstone/AnalogLeverTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/redstone/AnalogLeverTileEntity.java index 0a39f70c3..b272c0829 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/redstone/AnalogLeverTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/redstone/AnalogLeverTileEntity.java @@ -34,11 +34,11 @@ public class AnalogLeverTileEntity extends SmartTileEntity implements IHaveGoggl } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { + protected void read(CompoundTag compound, boolean clientPacket) { state = compound.getInt("State"); lastChange = compound.getInt("ChangeTimer"); clientState.target(state); - super.fromTag(compound, clientPacket); + super.read(compound, clientPacket); } @Override diff --git a/src/main/java/com/simibubi/create/content/logistics/block/redstone/ContentObserverTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/redstone/ContentObserverTileEntity.java index a6a60058d..7d2dc71a2 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/redstone/ContentObserverTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/redstone/ContentObserverTileEntity.java @@ -128,8 +128,8 @@ public class ContentObserverTileEntity extends SmartTileEntity { } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { - super.fromTag(compound, clientPacket); + protected void read(CompoundTag compound, boolean clientPacket) { + super.read(compound, clientPacket); turnOffTicks = compound.getInt("TurnOff"); } diff --git a/src/main/java/com/simibubi/create/content/logistics/block/redstone/NixieTubeTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/redstone/NixieTubeTileEntity.java index ffa7d05d7..b796461ca 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/redstone/NixieTubeTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/redstone/NixieTubeTileEntity.java @@ -114,8 +114,8 @@ public class NixieTubeTileEntity extends SmartTileEntity { // @Override - protected void fromTag(CompoundTag nbt, boolean clientPacket) { - super.fromTag(nbt, clientPacket); + protected void read(CompoundTag nbt, boolean clientPacket) { + super.read(nbt, clientPacket); if (nbt.contains("RawCustomText", Tag.TAG_STRING)) { rawCustomText = getJsonFromString(nbt.getString("RawCustomText")); @@ -164,7 +164,7 @@ public class NixieTubeTileEntity extends SmartTileEntity { private JsonElement getJsonFromString(String string) { try { - return new JsonParser().parse(string); + return JsonParser.parseString(string); } catch (JsonParseException e) { return null; } diff --git a/src/main/java/com/simibubi/create/content/logistics/block/redstone/RedstoneLinkTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/redstone/RedstoneLinkTileEntity.java index ba3a2e5a8..408436d68 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/redstone/RedstoneLinkTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/redstone/RedstoneLinkTileEntity.java @@ -70,9 +70,9 @@ public class RedstoneLinkTileEntity extends SmartTileEntity { } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { + protected void read(CompoundTag compound, boolean clientPacket) { transmitter = compound.getBoolean("Transmitter"); - super.fromTag(compound, clientPacket); + super.read(compound, clientPacket); receivedSignal = compound.getInt("Receive"); receivedSignalChanged = compound.getBoolean("ReceivedChanged"); diff --git a/src/main/java/com/simibubi/create/content/logistics/block/redstone/StockpileSwitchTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/redstone/StockpileSwitchTileEntity.java index 4d8d1a23e..9f678da7a 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/redstone/StockpileSwitchTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/redstone/StockpileSwitchTileEntity.java @@ -47,14 +47,14 @@ public class StockpileSwitchTileEntity extends SmartTileEntity { } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { + protected void read(CompoundTag compound, boolean clientPacket) { onWhenAbove = compound.getFloat("OnAbove"); offWhenBelow = compound.getFloat("OffBelow"); currentLevel = compound.getFloat("Current"); redstoneState = compound.getBoolean("Powered"); inverted = compound.getBoolean("Inverted"); poweredAfterDelay = compound.getBoolean("PoweredAfterDelay"); - super.fromTag(compound, clientPacket); + super.read(compound, clientPacket); } @Override diff --git a/src/main/java/com/simibubi/create/content/logistics/block/vault/ItemVaultTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/vault/ItemVaultTileEntity.java index 7465bd214..18f767029 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/vault/ItemVaultTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/vault/ItemVaultTileEntity.java @@ -157,8 +157,8 @@ public class ItemVaultTileEntity extends SmartTileEntity implements IMultiTileCo } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { - super.fromTag(compound, clientPacket); + protected void read(CompoundTag compound, boolean clientPacket) { + super.read(compound, clientPacket); BlockPos controllerBefore = controller; int prevSize = radius; diff --git a/src/main/java/com/simibubi/create/content/logistics/item/LecternControllerTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/item/LecternControllerTileEntity.java index 150a406ed..0be2f6bbd 100644 --- a/src/main/java/com/simibubi/create/content/logistics/item/LecternControllerTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/item/LecternControllerTileEntity.java @@ -55,8 +55,8 @@ public class LecternControllerTileEntity extends SmartTileEntity { } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { - super.fromTag(compound, clientPacket); + protected void read(CompoundTag compound, boolean clientPacket) { + super.read(compound, clientPacket); controller = ItemStack.of(compound.getCompound("Controller")); user = compound.hasUUID("User") ? compound.getUUID("User") : null; } diff --git a/src/main/java/com/simibubi/create/content/logistics/item/LinkedControllerClientHandler.java b/src/main/java/com/simibubi/create/content/logistics/item/LinkedControllerClientHandler.java index 194e385c2..1c3452d7f 100644 --- a/src/main/java/com/simibubi/create/content/logistics/item/LinkedControllerClientHandler.java +++ b/src/main/java/com/simibubi/create/content/logistics/item/LinkedControllerClientHandler.java @@ -14,7 +14,6 @@ import com.simibubi.create.AllBlocks; import com.simibubi.create.AllItems; import com.simibubi.create.AllSoundEvents; import com.simibubi.create.CreateClient; -import com.simibubi.create.content.contraptions.goggles.GoggleOverlayRenderer.TooltipScreen; import com.simibubi.create.foundation.item.TooltipHelper; import com.simibubi.create.foundation.networking.AllPackets; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; @@ -29,6 +28,7 @@ import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.player.LocalPlayer; import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; import net.minecraft.world.item.ItemStack; import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraftforge.client.gui.ForgeIngameGui; @@ -236,7 +236,7 @@ public class LinkedControllerClientHandler { Minecraft mc = Minecraft.getInstance(); poseStack.pushPose(); - Screen tooltipScreen = new TooltipScreen(null); + Screen tooltipScreen = new Screen(TextComponent.EMPTY) {}; tooltipScreen.init(mc, width1, height1); Object[] keys = new Object[6]; @@ -258,9 +258,10 @@ public class LinkedControllerClientHandler { int height = list.size() * mc.font.lineHeight; for (Component iTextComponent : list) width = Math.max(width, mc.font.width(iTextComponent)); - int x = (tooltipScreen.width / 3) - width / 2; - int y = tooltipScreen.height - height; + int x = (width1 / 3) - width / 2; + int y = height1 - height; + // TODO tooltipScreen.renderComponentTooltip(poseStack, list, x, y); poseStack.popPose(); diff --git a/src/main/java/com/simibubi/create/content/logistics/item/LinkedControllerItem.java b/src/main/java/com/simibubi/create/content/logistics/item/LinkedControllerItem.java index a53911a73..97d506f0f 100644 --- a/src/main/java/com/simibubi/create/content/logistics/item/LinkedControllerItem.java +++ b/src/main/java/com/simibubi/create/content/logistics/item/LinkedControllerItem.java @@ -32,8 +32,8 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.client.IItemRenderProperties; import net.minecraftforge.fml.DistExecutor; -import net.minecraftforge.network.NetworkHooks; import net.minecraftforge.items.ItemStackHandler; +import net.minecraftforge.network.NetworkHooks; public class LinkedControllerItem extends Item implements MenuProvider { diff --git a/src/main/java/com/simibubi/create/content/logistics/item/filter/FilterItem.java b/src/main/java/com/simibubi/create/content/logistics/item/filter/FilterItem.java index 36393fa45..197e3ec66 100644 --- a/src/main/java/com/simibubi/create/content/logistics/item/filter/FilterItem.java +++ b/src/main/java/com/simibubi/create/content/logistics/item/filter/FilterItem.java @@ -36,9 +36,9 @@ import net.minecraft.world.level.Level; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.network.NetworkHooks; import net.minecraftforge.items.ItemHandlerHelper; import net.minecraftforge.items.ItemStackHandler; +import net.minecraftforge.network.NetworkHooks; public class FilterItem extends Item implements MenuProvider { diff --git a/src/main/java/com/simibubi/create/content/schematics/ItemRequirement.java b/src/main/java/com/simibubi/create/content/schematics/ItemRequirement.java index 8b5f87d18..d4fce9dde 100644 --- a/src/main/java/com/simibubi/create/content/schematics/ItemRequirement.java +++ b/src/main/java/com/simibubi/create/content/schematics/ItemRequirement.java @@ -48,8 +48,8 @@ public class ItemRequirement { List requiredItems; - public static ItemRequirement INVALID = new ItemRequirement(); - public static ItemRequirement NONE = new ItemRequirement(); + public static final ItemRequirement INVALID = new ItemRequirement(); + public static final ItemRequirement NONE = new ItemRequirement(); private ItemRequirement() { } diff --git a/src/main/java/com/simibubi/create/content/schematics/block/SchematicTableContainer.java b/src/main/java/com/simibubi/create/content/schematics/block/SchematicTableContainer.java index fa63ebf63..36d9eb85b 100644 --- a/src/main/java/com/simibubi/create/content/schematics/block/SchematicTableContainer.java +++ b/src/main/java/com/simibubi/create/content/schematics/block/SchematicTableContainer.java @@ -56,7 +56,7 @@ public class SchematicTableContainer extends ContainerBase { + be.defaultYaw = (-Mth.floor((entity.getYRot() + (entity.isShiftKeyDown() ? 180.0F : 0.0F)) * 16.0F / 360.0F + 0.5F) & 15) * 360.0F / 16.0F; + }); + } } @Override @@ -47,6 +55,12 @@ public class SchematicannonBlock extends Block implements ITE te.neighbourCheckCooldown = 0); + } + @Override public void onRemove(BlockState state, Level worldIn, BlockPos pos, BlockState newState, boolean isMoving) { if (!state.hasBlockEntity() || state.getBlock() == newState.getBlock()) @@ -60,16 +74,10 @@ public class SchematicannonBlock extends Block implements ITE getTileEntityClass() { return SchematicannonTileEntity.class; } - + @Override public BlockEntityType getTileEntityType() { return AllTileEntities.SCHEMATICANNON.get(); } - @Override - public void neighborChanged(BlockState state, Level worldIn, BlockPos pos, Block blockIn, BlockPos fromPos, - boolean isMoving) { - withTileEntityDo(worldIn, pos, te -> te.neighbourCheckCooldown = 0); - } - } diff --git a/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonContainer.java b/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonContainer.java index 62f66221e..6d83bb020 100644 --- a/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonContainer.java +++ b/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonContainer.java @@ -33,7 +33,7 @@ public class SchematicannonContainer extends ContainerBase type, BlockPos pos, BlockState state) { super(type, pos, state); @@ -151,7 +143,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements MenuPro } @Override - protected void fromTag(CompoundTag compound, boolean clientPacket) { + protected void read(CompoundTag compound, boolean clientPacket) { if (!clientPacket) { inventory.deserializeNBT(compound.getCompound("Inventory")); } @@ -181,7 +173,9 @@ public class SchematicannonTileEntity extends SmartTileEntity implements MenuPro if (compound.contains("FlyingBlocks")) readFlyingBlocks(compound); - super.fromTag(compound, clientPacket); + defaultYaw = compound.getFloat("DefaultYaw"); + + super.read(compound, clientPacket); } protected void readFlyingBlocks(CompoundTag compound) { @@ -257,6 +251,8 @@ public class SchematicannonTileEntity extends SmartTileEntity implements MenuPro tagFlyingBlocks.add(b.serializeNBT()); compound.put("FlyingBlocks", tagFlyingBlocks); + compound.putFloat("DefaultYaw", defaultYaw); + super.write(compound, clientPacket); } @@ -816,9 +812,18 @@ public class SchematicannonTileEntity extends SmartTileEntity implements MenuPro findInventories(); } + @Override + public AABB getRenderBoundingBox() { + return INFINITE_EXTENT_AABB; + } + @Override public boolean shouldRenderNormally() { return true; } + public enum State { + STOPPED, PAUSED, RUNNING; + } + } diff --git a/src/main/java/com/simibubi/create/content/schematics/client/SchematicHandler.java b/src/main/java/com/simibubi/create/content/schematics/client/SchematicHandler.java index 6ad9758c7..fb4e2a8ab 100644 --- a/src/main/java/com/simibubi/create/content/schematics/client/SchematicHandler.java +++ b/src/main/java/com/simibubi/create/content/schematics/client/SchematicHandler.java @@ -14,7 +14,6 @@ import com.simibubi.create.content.schematics.filtering.SchematicInstances; import com.simibubi.create.content.schematics.item.SchematicItem; import com.simibubi.create.content.schematics.packet.SchematicPlacePacket; import com.simibubi.create.content.schematics.packet.SchematicSyncPacket; -import com.simibubi.create.foundation.gui.ToolSelectionScreen; import com.simibubi.create.foundation.networking.AllPackets; import com.simibubi.create.foundation.render.SuperRenderTypeBuffer; import com.simibubi.create.foundation.utility.AnimationTickHolder; diff --git a/src/main/java/com/simibubi/create/foundation/gui/ToolSelectionScreen.java b/src/main/java/com/simibubi/create/content/schematics/client/ToolSelectionScreen.java similarity index 97% rename from src/main/java/com/simibubi/create/foundation/gui/ToolSelectionScreen.java rename to src/main/java/com/simibubi/create/content/schematics/client/ToolSelectionScreen.java index f2930002b..5f11c3a75 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/ToolSelectionScreen.java +++ b/src/main/java/com/simibubi/create/content/schematics/client/ToolSelectionScreen.java @@ -1,4 +1,4 @@ -package com.simibubi.create.foundation.gui; +package com.simibubi.create.content.schematics.client; import java.util.List; import java.util.function.Consumer; @@ -8,6 +8,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; import com.simibubi.create.AllKeys; import com.simibubi.create.content.schematics.client.tools.Tools; +import com.simibubi.create.foundation.gui.AllGuiTextures; import com.simibubi.create.foundation.utility.Lang; import net.minecraft.client.Minecraft; diff --git a/src/main/java/com/simibubi/create/foundation/config/ui/ConfigScreenList.java b/src/main/java/com/simibubi/create/foundation/config/ui/ConfigScreenList.java index fa79152bb..f014b5424 100644 --- a/src/main/java/com/simibubi/create/foundation/config/ui/ConfigScreenList.java +++ b/src/main/java/com/simibubi/create/foundation/config/ui/ConfigScreenList.java @@ -29,7 +29,6 @@ import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.chat.TextComponent; -import net.minecraftforge.client.gui.GuiUtils; public class ConfigScreenList extends ObjectSelectionList implements TickableGuiEventListener { diff --git a/src/main/java/com/simibubi/create/foundation/fluid/FluidIngredient.java b/src/main/java/com/simibubi/create/foundation/fluid/FluidIngredient.java index c106775c2..5695d738c 100644 --- a/src/main/java/com/simibubi/create/foundation/fluid/FluidIngredient.java +++ b/src/main/java/com/simibubi/create/foundation/fluid/FluidIngredient.java @@ -185,7 +185,7 @@ public abstract class FluidIngredient implements Predicate { protected void writeInternal(JsonObject json) { json.addProperty("fluid", fluid.getRegistryName() .toString()); - json.add("nbt", new JsonParser().parse(tagToMatch.toString())); + json.add("nbt", JsonParser.parseString(tagToMatch.toString())); } @Override diff --git a/src/main/java/com/simibubi/create/foundation/gui/RemovedGuiUtils.java b/src/main/java/com/simibubi/create/foundation/gui/RemovedGuiUtils.java index 22406cf12..371f08cef 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/RemovedGuiUtils.java +++ b/src/main/java/com/simibubi/create/foundation/gui/RemovedGuiUtils.java @@ -13,7 +13,6 @@ import com.mojang.math.Matrix4f; import net.minecraft.client.gui.Font; import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent; import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.locale.Language; import net.minecraft.network.chat.FormattedText; import net.minecraft.network.chat.Style; import net.minecraft.world.item.ItemStack; diff --git a/src/main/java/com/simibubi/create/foundation/gui/UIRenderHelper.java b/src/main/java/com/simibubi/create/foundation/gui/UIRenderHelper.java index 58cf31de7..aa4143094 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/UIRenderHelper.java +++ b/src/main/java/com/simibubi/create/foundation/gui/UIRenderHelper.java @@ -48,6 +48,17 @@ public class UIRenderHelper { framebuffer.renderWithAlpha(alpha); } + /** + * Switch from src to dst, after copying the contents of src to dst. + */ + public static void swapAndBlitColor(RenderTarget src, RenderTarget dst) { + GlStateManager._glBindFramebuffer(GL30.GL_READ_FRAMEBUFFER, src.frameBufferId); + GlStateManager._glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, dst.frameBufferId); + GlStateManager._glBlitFrameBuffer(0, 0, src.viewWidth, src.viewHeight, 0, 0, dst.viewWidth, dst.viewHeight, GL30.GL_COLOR_BUFFER_BIT, GL20.GL_LINEAR); + + GlStateManager._glBindFramebuffer(GlConst.GL_FRAMEBUFFER, dst.frameBufferId); + } + public static void streak(PoseStack ms, float angle, int x, int y, int breadth, int length) { streak(ms, angle, x, y, breadth, length, Theme.i(Theme.Key.STREAK)); } @@ -257,21 +268,10 @@ public class UIRenderHelper { poseStack.mulPoseMatrix(Matrix4f.createScaleMatrix(1, -1, 1)); } - /** - * Switch from src to dst, after copying the contents of src to dst. - */ - public static void swapAndBlitColor(RenderTarget src, RenderTarget dst) { - GlStateManager._glBindFramebuffer(GL30.GL_READ_FRAMEBUFFER, src.frameBufferId); - GlStateManager._glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, dst.frameBufferId); - GlStateManager._glBlitFrameBuffer(0, 0, src.viewWidth, src.viewHeight, 0, 0, dst.viewWidth, dst.viewHeight, GL30.GL_COLOR_BUFFER_BIT, GL20.GL_LINEAR); - - GlStateManager._glBindFramebuffer(GlConst.GL_FRAMEBUFFER, dst.frameBufferId); - } - public static class CustomRenderTarget extends RenderTarget { - public CustomRenderTarget(boolean pUseDepth) { - super(pUseDepth); + public CustomRenderTarget(boolean useDepth) { + super(useDepth); } public static CustomRenderTarget create(Window mainWindow) { diff --git a/src/main/java/com/simibubi/create/foundation/ponder/PonderWorld.java b/src/main/java/com/simibubi/create/foundation/ponder/PonderWorld.java index 358810e58..666440ea3 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/PonderWorld.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/PonderWorld.java @@ -5,9 +5,11 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.function.Supplier; import javax.annotation.Nullable; +import com.google.common.base.Suppliers; import com.mojang.blaze3d.vertex.PoseStack; import com.simibubi.create.content.contraptions.relays.belt.BeltBlock; import com.simibubi.create.content.contraptions.relays.belt.BeltTileEntity; @@ -31,9 +33,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.particles.BlockParticleOption; import net.minecraft.core.particles.ParticleOptions; import net.minecraft.core.particles.ParticleTypes; -import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.LazyLoadedValue; import net.minecraft.util.Mth; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; @@ -58,7 +58,7 @@ public class PonderWorld extends SchematicWorld { protected Map originalTileEntities; protected Map blockBreakingProgressions; protected List originalEntities; - private LazyLoadedValue asClientWorld = new LazyLoadedValue<>(() -> WrappedClientWorld.of(this)); + private Supplier asClientWorld = Suppliers.memoize(() -> WrappedClientWorld.of(this)); protected PonderWorldParticles particles; private final Map> particleFactories; diff --git a/src/main/java/com/simibubi/create/foundation/ponder/instruction/TileEntityDataInstruction.java b/src/main/java/com/simibubi/create/foundation/ponder/instruction/TileEntityDataInstruction.java index 84bcb6c0b..e42ef5ddf 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/instruction/TileEntityDataInstruction.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/instruction/TileEntityDataInstruction.java @@ -36,7 +36,7 @@ public class TileEntityDataInstruction extends WorldModifyInstruction { return; CompoundTag apply = data.apply(tileEntity.saveWithFullMetadata()); if (tileEntity instanceof SyncedTileEntity) - ((SyncedTileEntity) tileEntity).readClientUpdate(apply); + ((SyncedTileEntity) tileEntity).readClient(apply); tileEntity.load(apply); }); } diff --git a/src/main/java/com/simibubi/create/foundation/render/CreateContexts.java b/src/main/java/com/simibubi/create/foundation/render/CreateContexts.java index 72d9de933..1819ed431 100644 --- a/src/main/java/com/simibubi/create/foundation/render/CreateContexts.java +++ b/src/main/java/com/simibubi/create/foundation/render/CreateContexts.java @@ -4,9 +4,9 @@ import java.util.stream.Stream; import com.jozufozu.flywheel.backend.Backend; import com.jozufozu.flywheel.backend.GameStateRegistry; -import com.jozufozu.flywheel.backend.pipeline.ShaderPipeline; import com.jozufozu.flywheel.backend.pipeline.InstancingTemplate; import com.jozufozu.flywheel.backend.pipeline.OneShotTemplate; +import com.jozufozu.flywheel.backend.pipeline.ShaderPipeline; import com.jozufozu.flywheel.backend.pipeline.WorldShaderPipeline; import com.jozufozu.flywheel.backend.source.FileResolution; import com.jozufozu.flywheel.backend.source.Resolver; diff --git a/src/main/java/com/simibubi/create/foundation/tileEntity/SmartTileEntity.java b/src/main/java/com/simibubi/create/foundation/tileEntity/SmartTileEntity.java index fea1685d9..5f4d0f718 100644 --- a/src/main/java/com/simibubi/create/foundation/tileEntity/SmartTileEntity.java +++ b/src/main/java/com/simibubi/create/foundation/tileEntity/SmartTileEntity.java @@ -16,7 +16,6 @@ import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.common.MinecraftForge; @@ -26,31 +25,23 @@ import net.minecraftforge.items.CapabilityItemHandler; public abstract class SmartTileEntity extends SyncedTileEntity implements IPartialSafeNBT, IInteractionChecker { - private final Map, TileEntityBehaviour> behaviours; - // Internally maintained to be identical to behaviorMap.values() in order to - // improve iteration performance. - private final List behaviourList; - private boolean initialized; - private boolean firstNbtRead; + private final Map, TileEntityBehaviour> behaviours = new HashMap<>(); + private boolean initialized = false; + private boolean firstNbtRead = true; private int lazyTickRate; private int lazyTickCounter; // Used for simulating this TE in a client-only setting private boolean virtualMode; - public SmartTileEntity(BlockEntityType tileEntityTypeIn, BlockPos pos, BlockState state) { - super(tileEntityTypeIn, pos, state); - behaviours = new HashMap<>(); - initialized = false; - firstNbtRead = true; + public SmartTileEntity(BlockEntityType type, BlockPos pos, BlockState state) { + super(type, pos, state); + setLazyTickRate(10); ArrayList list = new ArrayList<>(); addBehaviours(list); list.forEach(b -> behaviours.put(b.getType(), b)); - - behaviourList = new ArrayList<>(list.size()); - updateBehaviorList(); } public abstract void addBehaviours(List behaviours); @@ -61,6 +52,16 @@ public abstract class SmartTileEntity extends SyncedTileEntity implements IParti */ public void addBehavioursDeferred(List behaviours) {} + public void initialize() { + if (firstNbtRead) { + firstNbtRead = false; + MinecraftForge.EVENT_BUS.post(new TileEntityBehaviourEvent<>(this, behaviours)); + } + + forEachBehaviour(TileEntityBehaviour::initialize); + lazyTick(); + } + public void tick() { if (!initialized && hasLevel()) { initialize(); @@ -72,77 +73,89 @@ public abstract class SmartTileEntity extends SyncedTileEntity implements IParti lazyTick(); } - behaviourList.forEach(TileEntityBehaviour::tick); + forEachBehaviour(TileEntityBehaviour::tick); } - public void initialize() { - if (firstNbtRead) { - firstNbtRead = false; - MinecraftForge.EVENT_BUS.post(new TileEntityBehaviourEvent<>(this, behaviours)); - updateBehaviorList(); - } - - behaviourList.forEach(TileEntityBehaviour::initialize); - lazyTick(); - } - - @Override - public final void saveAdditional(CompoundTag compound) { - write(compound, false); - } - - @Override - public final CompoundTag writeToClient(CompoundTag compound) { - write(compound, true); - return compound; - } - - @Override - public final void readClientUpdate(CompoundTag tag) { - fromTag(tag, true); - } - - @Override - public final void load(CompoundTag tag) { - fromTag(tag, false); + public void lazyTick() { } /** * Hook only these in future subclasses of STE */ - protected void fromTag(CompoundTag compound, boolean clientPacket) { + protected void write(CompoundTag tag, boolean clientPacket) { + super.saveAdditional(tag); + forEachBehaviour(tb -> tb.write(tag, clientPacket)); + } + + @Override + public void writeSafe(CompoundTag tag, boolean clientPacket) { + super.saveAdditional(tag); + forEachBehaviour(tb -> { + if (tb.isSafeNBT()) + tb.write(tag, clientPacket); + }); + } + + /** + * Hook only these in future subclasses of STE + */ + protected void read(CompoundTag tag, boolean clientPacket) { if (firstNbtRead) { firstNbtRead = false; ArrayList list = new ArrayList<>(); addBehavioursDeferred(list); list.forEach(b -> behaviours.put(b.getType(), b)); MinecraftForge.EVENT_BUS.post(new TileEntityBehaviourEvent<>(this, behaviours)); - updateBehaviorList(); } - super.load(compound); - behaviourList.forEach(tb -> tb.read(compound, clientPacket)); - } - - /** - * Hook only these in future subclasses of STE - */ - protected void write(CompoundTag compound, boolean clientPacket) { - super.saveAdditional(compound); - behaviourList.forEach(tb -> tb.write(compound, clientPacket)); + super.load(tag); + forEachBehaviour(tb -> tb.read(tag, clientPacket)); } @Override - public void writeSafe(CompoundTag compound, boolean clientPacket) { - super.saveAdditional(compound); - behaviourList.forEach(tb -> { - if (tb.isSafeNBT()) - tb.write(compound, clientPacket); - }); + public final void load(CompoundTag tag) { + read(tag, false); + } + + @Override + public final void saveAdditional(CompoundTag tag) { + write(tag, false); + } + + @Override + public final void readClient(CompoundTag tag) { + read(tag, true); + } + + @Override + public final CompoundTag writeClient(CompoundTag tag) { + write(tag, true); + return tag; + } + + @SuppressWarnings("unchecked") + public T getBehaviour(BehaviourType type) { + return (T) behaviours.get(type); + } + + protected void forEachBehaviour(Consumer action) { + behaviours.values().forEach(action); + } + + protected void attachBehaviourLate(TileEntityBehaviour behaviour) { + behaviours.put(behaviour.getType(), behaviour); + behaviour.initialize(); } public ItemRequirement getRequiredItems() { - return behaviourList.stream() - .reduce(ItemRequirement.NONE, (a, b) -> a.with(b.getRequiredItems()), (a, b) -> a.with(b)); + return behaviours.values().stream() + .reduce(ItemRequirement.NONE, (r, b) -> r.with(b.getRequiredItems()), (r, r1) -> r.with(r1)); + } + + protected void removeBehaviour(BehaviourType type) { + TileEntityBehaviour remove = behaviours.remove(type); + if (remove != null) { + remove.remove(); + } } @Override @@ -156,51 +169,6 @@ public abstract class SmartTileEntity extends SyncedTileEntity implements IParti this.lazyTickCounter = slowTickRate; } - public void lazyTick() { - - } - - protected void forEachBehaviour(Consumer action) { - behaviourList.forEach(action); - } - - protected void attachBehaviourLate(TileEntityBehaviour behaviour) { - behaviours.put(behaviour.getType(), behaviour); - behaviour.initialize(); - - updateBehaviorList(); - } - - protected void removeBehaviour(BehaviourType type) { - TileEntityBehaviour remove = behaviours.remove(type); - if (remove != null) { - remove.remove(); - updateBehaviorList(); - } - } - - // We don't trust the input to the API will be sane, so we - // update all the contents whenever something changes. It's - // simpler than trying to manipulate the list one element at - // a time. - private void updateBehaviorList() { - behaviourList.clear(); - behaviourList.addAll(behaviours.values()); - } - - @SuppressWarnings("unchecked") - public T getBehaviour(BehaviourType type) { - return (T) behaviours.get(type); - } - - protected boolean isItemHandlerCap(Capability cap) { - return cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY; - } - - protected boolean isFluidHandlerCap(Capability cap) { - return cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY; - } - public void markVirtual() { virtualMode = true; } @@ -226,4 +194,12 @@ public abstract class SmartTileEntity extends SyncedTileEntity implements IParti public void refreshBlockState() { setBlockState(getLevel().getBlockState(getBlockPos())); } + + protected boolean isItemHandlerCap(Capability cap) { + return cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY; + } + + protected boolean isFluidHandlerCap(Capability cap) { + return cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY; + } } diff --git a/src/main/java/com/simibubi/create/foundation/tileEntity/SyncedTileEntity.java b/src/main/java/com/simibubi/create/foundation/tileEntity/SyncedTileEntity.java index 5399eacb7..bdf1718ce 100644 --- a/src/main/java/com/simibubi/create/foundation/tileEntity/SyncedTileEntity.java +++ b/src/main/java/com/simibubi/create/foundation/tileEntity/SyncedTileEntity.java @@ -4,7 +4,6 @@ import javax.annotation.ParametersAreNonnullByDefault; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; -import net.minecraft.core.SectionPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.Connection; import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; @@ -18,24 +17,48 @@ import net.minecraftforge.network.PacketDistributor; @ParametersAreNonnullByDefault public abstract class SyncedTileEntity extends BlockEntity { - public SyncedTileEntity(BlockEntityType tileEntityTypeIn, BlockPos pos, BlockState state) { - super(tileEntityTypeIn, pos, state); - } - - @Override - public CompoundTag getTileData() { - return super.getTileData(); - } - - @Override - public CompoundTag getUpdateTag() { - return save(new CompoundTag()); + public SyncedTileEntity(BlockEntityType type, BlockPos pos, BlockState state) { + super(type, pos, state); } @Override public CompoundTag save(CompoundTag tag) { + super.save(tag); saveAdditional(tag); - return super.save(tag); + return tag; + } + + @Override + public CompoundTag getUpdateTag() { + return writeClient(new CompoundTag()); + } + + @Override + public ClientboundBlockEntityDataPacket getUpdatePacket() { + return ClientboundBlockEntityDataPacket.create(this); + } + + @Override + public void handleUpdateTag(CompoundTag tag) { + readClient(tag); + } + + @Override + public void onDataPacket(Connection connection, ClientboundBlockEntityDataPacket packet) { + CompoundTag tag = packet.getTag(); + if (tag != null) { + readClient(tag); + } + } + + // Special handling for client update packets + public void readClient(CompoundTag tag) { + load(tag); + } + + // Special handling for client update packets + public CompoundTag writeClient(CompoundTag tag) { + return save(tag); } public void sendData() { @@ -48,29 +71,6 @@ public abstract class SyncedTileEntity extends BlockEntity { level.sendBlockUpdated(getBlockPos(), getBlockState(), getBlockState(), 1); } - @Override - public ClientboundBlockEntityDataPacket getUpdatePacket() { - return ClientboundBlockEntityDataPacket.create(this, - te -> ((SyncedTileEntity) te).writeToClient(new CompoundTag())); - } - - @Override - public void onDataPacket(Connection net, ClientboundBlockEntityDataPacket pkt) { - if (pkt.getTag() == null) - return; - readClientUpdate(pkt.getTag()); - } - - // Special handling for client update packets - public void readClientUpdate(CompoundTag tag) { - load(tag); - } - - // Special handling for client update packets - public CompoundTag writeToClient(CompoundTag tag) { - return save(tag); - } - public void notifyUpdate() { setChanged(); sendData(); @@ -81,7 +81,6 @@ public abstract class SyncedTileEntity extends BlockEntity { } public LevelChunk containedChunk() { - SectionPos sectionPos = SectionPos.of(worldPosition); - return level.getChunk(sectionPos.x(), sectionPos.z()); + return level.getChunkAt(worldPosition); } } diff --git a/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/belt/BeltProcessingBehaviour.java b/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/belt/BeltProcessingBehaviour.java index e142a7aac..d5a9520a1 100644 --- a/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/belt/BeltProcessingBehaviour.java +++ b/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/belt/BeltProcessingBehaviour.java @@ -17,7 +17,7 @@ import net.minecraft.world.level.block.state.BlockState; */ public class BeltProcessingBehaviour extends TileEntityBehaviour { - public static BehaviourType TYPE = new BehaviourType<>(); + public static final BehaviourType TYPE = new BehaviourType<>(); public static enum ProcessingResult { PASS, HOLD, REMOVE; diff --git a/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/inventory/InvManipulationBehaviour.java b/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/inventory/InvManipulationBehaviour.java index 4dbee20dd..9fa544f11 100644 --- a/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/inventory/InvManipulationBehaviour.java +++ b/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/inventory/InvManipulationBehaviour.java @@ -18,7 +18,7 @@ import net.minecraftforge.items.ItemHandlerHelper; public class InvManipulationBehaviour extends CapManipulationBehaviourBase { // Extra types available for multibehaviour - public static BehaviourType + public static final BehaviourType TYPE = new BehaviourType<>(), EXTRACT = new BehaviourType<>(), INSERT = new BehaviourType<>(); diff --git a/src/main/java/com/simibubi/create/foundation/utility/FilesHelper.java b/src/main/java/com/simibubi/create/foundation/utility/FilesHelper.java index 24802a6ae..a4b3c8b78 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/FilesHelper.java +++ b/src/main/java/com/simibubi/create/foundation/utility/FilesHelper.java @@ -49,7 +49,7 @@ public class FilesHelper { Files.deleteIfExists(Paths.get(path)); JsonWriter writer = new JsonWriter(Files.newBufferedWriter(Paths.get(path), StandardOpenOption.CREATE)); writer.setIndent(" "); - Streams.write(new JsonParser().parse(compound.toString()), writer); + Streams.write(JsonParser.parseString(compound.toString()), writer); writer.close(); return true; } catch (IOException e) { @@ -62,7 +62,7 @@ public class FilesHelper { try { Files.deleteIfExists(Paths.get(path)); JsonWriter writer = new JsonWriter(Files.newBufferedWriter(Paths.get(path), StandardOpenOption.CREATE)); - Streams.write(new JsonParser().parse(compound.toString()), writer); + Streams.write(JsonParser.parseString(compound.toString()), writer); writer.close(); return true; } catch (IOException e) { diff --git a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedClientWorld.java b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedClientWorld.java index 3483ff287..ea5e0fb16 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedClientWorld.java +++ b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedClientWorld.java @@ -1,8 +1,6 @@ package com.simibubi.create.foundation.utility.worldWrappers; import java.util.List; -import java.util.function.BiPredicate; -import java.util.stream.Stream; import javax.annotation.Nullable; import javax.annotation.ParametersAreNonnullByDefault; @@ -14,7 +12,6 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.particles.ParticleOptions; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundSource; -import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.ai.targeting.TargetingConditions; import net.minecraft.world.entity.player.Player; @@ -24,8 +21,6 @@ import net.minecraft.world.level.LightLayer; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.FluidState; -import net.minecraft.world.phys.AABB; -import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn;