From c8ba7b88cc6e9b8ec4c6055daa90f011a202cdef Mon Sep 17 00:00:00 2001 From: PepperCode1 <44146161+PepperCode1@users.noreply.github.com> Date: Mon, 3 Jan 2022 23:52:36 -0800 Subject: [PATCH] Update to Flywheel 0.5.1 --- gradle.properties | 2 +- .../com/simibubi/create/AllEntityTypes.java | 2 +- .../com/simibubi/create/AllTileEntities.java | 54 +++++++++---------- .../base/BackHalfShaftInstance.java | 2 +- .../contraptions/base/KineticTileEntity.java | 3 +- .../base/KineticTileInstance.java | 10 ++-- .../components/actors/DrillInstance.java | 2 +- .../clock/CuckooClockTileEntity.java | 5 -- .../crafter/MechanicalCrafterTileEntity.java | 5 -- .../components/crank/HandCrankInstance.java | 4 +- .../components/crank/HandCrankTileEntity.java | 5 -- .../components/deployer/DeployerInstance.java | 8 +-- .../deployer/DeployerTileEntity.java | 5 -- .../components/fan/FanInstance.java | 2 +- .../components/flywheel/FlyWheelInstance.java | 8 +-- .../flywheel/engine/EngineInstance.java | 4 +- .../flywheel/engine/EngineTileEntity.java | 3 +- .../millstone/MillStoneCogInstance.java | 2 +- .../components/mixer/MixerInstance.java | 6 +-- .../components/press/PressInstance.java | 4 +- .../components/saw/SawInstance.java | 2 +- .../components/saw/SawTileEntity.java | 5 -- .../bearing/BearingInstance.java | 4 +- .../bearing/ClockworkBearingTileEntity.java | 5 -- .../bearing/MechanicalBearingTileEntity.java | 5 -- .../chassis/StickerInstance.java | 10 ++-- .../chassis/StickerTileEntity.java | 3 +- .../gantry/GantryCarriageInstance.java | 6 +-- .../gantry/GantryCarriageTileEntity.java | 5 -- .../structureMovement/glue/GlueInstance.java | 4 +- .../glue/SuperGlueEntity.java | 3 +- .../pulley/AbstractPulleyInstance.java | 4 +- .../pulley/HosePulleyInstance.java | 2 +- .../pulley/PulleyTileEntity.java | 5 -- .../pulley/RopePulleyInstance.java | 4 +- .../render/ContraptionInstanceManager.java | 4 +- .../render/ContraptionRenderDispatcher.java | 2 +- .../render/FlwContraption.java | 3 +- .../contraptions/fluids/PumpCogInstance.java | 2 +- .../contraptions/fluids/PumpTileEntity.java | 5 -- .../fluids/actors/HosePulleyTileEntity.java | 5 -- .../fluids/pipes/FluidValveInstance.java | 4 +- .../fluids/pipes/FluidValveTileEntity.java | 5 -- .../processing/BasinOperatingTileEntity.java | 5 -- .../advanced/SpeedControllerTileEntity.java | 5 -- .../relays/belt/BeltInstance.java | 8 +-- .../relays/belt/BeltTileEntity.java | 1 - .../BracketedKineticTileInstance.java | 12 ++--- .../relays/encased/EncasedCogInstance.java | 4 +- .../relays/encased/SplitShaftInstance.java | 2 +- .../relays/gauge/GaugeInstance.java | 6 +-- .../relays/gauge/GaugeTileEntity.java | 5 -- .../relays/gearbox/GearboxInstance.java | 6 +-- .../armor/CopperBacktankTileEntity.java | 5 -- .../curiosities/toolbox/ToolBoxInstance.java | 14 ++--- .../toolbox/ToolboxTileEntity.java | 3 +- .../belts/tunnel/BeltTunnelInstance.java | 10 ++-- .../belts/tunnel/BeltTunnelTileEntity.java | 8 +-- .../block/depot/EjectorInstance.java | 4 +- .../block/depot/EjectorTileEntity.java | 5 -- .../block/diodes/BrassDiodeInstance.java | 12 ++--- .../block/diodes/BrassDiodeTileEntity.java | 3 +- .../block/funnel/FunnelInstance.java | 8 +-- .../block/funnel/FunnelTileEntity.java | 8 +-- .../block/mechanicalArm/ArmInstance.java | 10 ++-- .../block/mechanicalArm/ArmTileEntity.java | 5 -- .../block/redstone/AnalogLeverInstance.java | 10 ++-- .../block/redstone/AnalogLeverTileEntity.java | 3 +- .../block/SchematicannonInstance.java | 10 ++-- .../block/SchematicannonTileEntity.java | 8 +-- .../foundation/data/CreateEntityBuilder.java | 30 ++++++++--- .../data/CreateTileEntityBuilder.java | 30 ++++++++--- .../render/RainbowDebugStateProvider.java | 4 +- .../render/TileEntityRenderHelper.java | 4 +- src/main/resources/META-INF/mods.toml | 2 +- 75 files changed, 199 insertions(+), 284 deletions(-) diff --git a/gradle.properties b/gradle.properties index 738fb9ba8..9cb801f80 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,7 +19,7 @@ parchment_version = 2021.12.19 # dependency versions registrate_version = MC1.18-1.0.21 -flywheel_version = 1.18-0.5.0.33 +flywheel_version = 1.18-0.5.1.38 jei_minecraft_version = 1.18 jei_version = 9.0.0.40 diff --git a/src/main/java/com/simibubi/create/AllEntityTypes.java b/src/main/java/com/simibubi/create/AllEntityTypes.java index a79b2682e..85e64ed4e 100644 --- a/src/main/java/com/simibubi/create/AllEntityTypes.java +++ b/src/main/java/com/simibubi/create/AllEntityTypes.java @@ -40,7 +40,7 @@ public class AllEntityTypes { public static final EntityEntry SUPER_GLUE = register("super_glue", SuperGlueEntity::new, () -> SuperGlueRenderer::new, MobCategory.MISC, 10, - Integer.MAX_VALUE, false, true, SuperGlueEntity::build).instance(() -> GlueInstance::new) + Integer.MAX_VALUE, false, true, SuperGlueEntity::build).instance(() -> GlueInstance::new, false) .register(); public static final EntityEntry CRAFTING_BLUEPRINT = diff --git a/src/main/java/com/simibubi/create/AllTileEntities.java b/src/main/java/com/simibubi/create/AllTileEntities.java index 7e8479c86..6bdae2758 100644 --- a/src/main/java/com/simibubi/create/AllTileEntities.java +++ b/src/main/java/com/simibubi/create/AllTileEntities.java @@ -191,56 +191,56 @@ public class AllTileEntities { // Kinetics public static final BlockEntityEntry BRACKETED_KINETIC = Create.registrate() .tileEntity("simple_kinetic", BracketedKineticTileEntity::new) - .instance(() -> BracketedKineticTileInstance::new) + .instance(() -> BracketedKineticTileInstance::new, false) .validBlocks(AllBlocks.SHAFT, AllBlocks.COGWHEEL, AllBlocks.LARGE_COGWHEEL) .renderer(() -> BracketedKineticTileRenderer::new) .register(); public static final BlockEntityEntry MOTOR = Create.registrate() .tileEntity("motor", CreativeMotorTileEntity::new) - .instance(() -> HalfShaftInstance::new) + .instance(() -> HalfShaftInstance::new, false) .validBlocks(AllBlocks.CREATIVE_MOTOR) .renderer(() -> CreativeMotorRenderer::new) .register(); public static final BlockEntityEntry GEARBOX = Create.registrate() .tileEntity("gearbox", GearboxTileEntity::new) - .instance(() -> GearboxInstance::new) + .instance(() -> GearboxInstance::new, false) .validBlocks(AllBlocks.GEARBOX) .renderer(() -> GearboxRenderer::new) .register(); public static final BlockEntityEntry ENCASED_SHAFT = Create.registrate() .tileEntity("encased_shaft", KineticTileEntity::new) - .instance(() -> ShaftInstance::new) + .instance(() -> ShaftInstance::new, false) .validBlocks(AllBlocks.ANDESITE_ENCASED_SHAFT, AllBlocks.BRASS_ENCASED_SHAFT, AllBlocks.ENCASED_CHAIN_DRIVE) .renderer(() -> ShaftRenderer::new) .register(); public static final BlockEntityEntry ENCASED_COGWHEEL = Create.registrate() .tileEntity("encased_cogwheel", SimpleKineticTileEntity::new) - .instance(() -> EncasedCogInstance::small) + .instance(() -> EncasedCogInstance::small, false) .validBlocks(AllBlocks.ANDESITE_ENCASED_COGWHEEL, AllBlocks.BRASS_ENCASED_COGWHEEL) .renderer(() -> EncasedCogRenderer::small) .register(); public static final BlockEntityEntry ENCASED_LARGE_COGWHEEL = Create.registrate() .tileEntity("encased_large_cogwheel", SimpleKineticTileEntity::new) - .instance(() -> EncasedCogInstance::large) + .instance(() -> EncasedCogInstance::large, false) .validBlocks(AllBlocks.ANDESITE_ENCASED_LARGE_COGWHEEL, AllBlocks.BRASS_ENCASED_LARGE_COGWHEEL) .renderer(() -> EncasedCogRenderer::large) .register(); public static final BlockEntityEntry ADJUSTABLE_PULLEY = Create.registrate() .tileEntity("adjustable_pulley", AdjustablePulleyTileEntity::new) - .instance(() -> ShaftInstance::new) + .instance(() -> ShaftInstance::new, false) .validBlocks(AllBlocks.ADJUSTABLE_CHAIN_GEARSHIFT) .renderer(() -> ShaftRenderer::new) .register(); public static final BlockEntityEntry ENCASED_FAN = Create.registrate() .tileEntity("encased_fan", EncasedFanTileEntity::new) - .instance(() -> FanInstance::new) + .instance(() -> FanInstance::new, false) .validBlocks(AllBlocks.ENCASED_FAN) .renderer(() -> EncasedFanRenderer::new) .register(); @@ -253,21 +253,21 @@ public class AllTileEntities { public static final BlockEntityEntry CLUTCH = Create.registrate() .tileEntity("clutch", ClutchTileEntity::new) - .instance(() -> SplitShaftInstance::new) + .instance(() -> SplitShaftInstance::new, false) .validBlocks(AllBlocks.CLUTCH) .renderer(() -> SplitShaftRenderer::new) .register(); public static final BlockEntityEntry GEARSHIFT = Create.registrate() .tileEntity("gearshift", GearshiftTileEntity::new) - .instance(() -> SplitShaftInstance::new) + .instance(() -> SplitShaftInstance::new, false) .validBlocks(AllBlocks.GEARSHIFT) .renderer(() -> SplitShaftRenderer::new) .register(); public static final BlockEntityEntry TURNTABLE = Create.registrate() .tileEntity("turntable", TurntableTileEntity::new) - .instance(() -> SingleRotatingInstance::new) + .instance(() -> SingleRotatingInstance::new, false) .validBlocks(AllBlocks.TURNTABLE) .renderer(() -> KineticTileEntityRenderer::new) .register(); @@ -289,7 +289,7 @@ public class AllTileEntities { public static final BlockEntityEntry GANTRY_SHAFT = Create.registrate() .tileEntity("gantry_shaft", GantryShaftTileEntity::new) - .instance(() -> SingleRotatingInstance::new) + .instance(() -> SingleRotatingInstance::new, false) .validBlocks(AllBlocks.GANTRY_SHAFT) .renderer(() -> KineticTileEntityRenderer::new) .register(); @@ -370,7 +370,7 @@ public class AllTileEntities { public static final BlockEntityEntry BELT = Create.registrate() .tileEntity("belt", BeltTileEntity::new) - .instance(() -> BeltInstance::new) + .instance(() -> BeltInstance::new, BeltTileEntity::shouldRenderNormally) .validBlocks(AllBlocks.BELT) .renderer(() -> BeltRenderer::new) .register(); @@ -415,7 +415,7 @@ public class AllTileEntities { public static final BlockEntityEntry MECHANICAL_PISTON = Create.registrate() .tileEntity("mechanical_piston", MechanicalPistonTileEntity::new) - .instance(() -> ShaftInstance::new) + .instance(() -> ShaftInstance::new, false) .validBlocks(AllBlocks.MECHANICAL_PISTON, AllBlocks.STICKY_MECHANICAL_PISTON) .renderer(() -> MechanicalPistonRenderer::new) .register(); @@ -443,7 +443,7 @@ public class AllTileEntities { public static final BlockEntityEntry ROPE_PULLEY = Create.registrate() .tileEntity("rope_pulley", PulleyTileEntity::new) - .instance(() -> RopePulleyInstance::new) + .instance(() -> RopePulleyInstance::new, false) .validBlocks(AllBlocks.ROPE_PULLEY) .renderer(() -> PulleyRenderer::new) .register(); @@ -456,14 +456,14 @@ public class AllTileEntities { public static final BlockEntityEntry STICKER = Create.registrate() .tileEntity("sticker", StickerTileEntity::new) - .instance(() -> StickerInstance::new) + .instance(() -> StickerInstance::new, false) .validBlocks(AllBlocks.STICKER) .renderer(() -> StickerRenderer::new) .register(); public static final BlockEntityEntry DRILL = Create.registrate() .tileEntity("drill", DrillTileEntity::new) - .instance(() -> DrillInstance::new) + .instance(() -> DrillInstance::new, false) .validBlocks(AllBlocks.MECHANICAL_DRILL) .renderer(() -> DrillRenderer::new) .register(); @@ -496,28 +496,28 @@ public class AllTileEntities { public static final BlockEntityEntry FLYWHEEL = Create.registrate() .tileEntity("flywheel", FlywheelTileEntity::new) - .instance(() -> FlyWheelInstance::new) + .instance(() -> FlyWheelInstance::new, false) .validBlocks(AllBlocks.FLYWHEEL) .renderer(() -> FlywheelRenderer::new) .register(); public static final BlockEntityEntry FURNACE_ENGINE = Create.registrate() .tileEntity("furnace_engine", FurnaceEngineTileEntity::new) - .instance(() -> EngineInstance::new) + .instance(() -> EngineInstance::new, false) .validBlocks(AllBlocks.FURNACE_ENGINE) .renderer(() -> EngineRenderer::new) .register(); public static final BlockEntityEntry MILLSTONE = Create.registrate() .tileEntity("millstone", MillstoneTileEntity::new) - .instance(() -> MillStoneCogInstance::new) + .instance(() -> MillStoneCogInstance::new, false) .validBlocks(AllBlocks.MILLSTONE) .renderer(() -> MillstoneRenderer::new) .register(); public static final BlockEntityEntry CRUSHING_WHEEL = Create.registrate() .tileEntity("crushing_wheel", CrushingWheelTileEntity::new) - .instance(() -> CutoutRotatingInstance::new) + .instance(() -> CutoutRotatingInstance::new, false) .validBlocks(AllBlocks.CRUSHING_WHEEL) .renderer(() -> KineticTileEntityRenderer::new) .register(); @@ -531,7 +531,7 @@ public class AllTileEntities { public static final BlockEntityEntry WATER_WHEEL = Create.registrate() .tileEntity("water_wheel", WaterWheelTileEntity::new) - .instance(() -> CutoutRotatingInstance::new) + .instance(() -> CutoutRotatingInstance::new, false) .validBlocks(AllBlocks.WATER_WHEEL) .renderer(() -> KineticTileEntityRenderer::new) .register(); @@ -578,7 +578,7 @@ public class AllTileEntities { public static final BlockEntityEntry SEQUENCED_GEARSHIFT = Create.registrate() .tileEntity("sequenced_gearshift", SequencedGearshiftTileEntity::new) - .instance(() -> SplitShaftInstance::new) + .instance(() -> SplitShaftInstance::new, false) .validBlocks(AllBlocks.SEQUENCED_GEARSHIFT) .renderer(() -> SplitShaftRenderer::new) .register(); @@ -606,7 +606,7 @@ public class AllTileEntities { public static final BlockEntityEntry ANALOG_LEVER = Create.registrate() .tileEntity("analog_lever", AnalogLeverTileEntity::new) - .instance(() -> AnalogLeverInstance::new) + .instance(() -> AnalogLeverInstance::new, false) .validBlocks(AllBlocks.ANALOG_LEVER) .renderer(() -> AnalogLeverRenderer::new) .register(); @@ -672,7 +672,7 @@ public class AllTileEntities { public static final BlockEntityEntry PULSE_EXTENDER = Create.registrate() .tileEntity("pulse_extender", PulseExtenderTileEntity::new) - .instance(() -> BrassDiodeInstance::new) + .instance(() -> BrassDiodeInstance::new, false) .validBlocks(AllBlocks.PULSE_EXTENDER) .renderer(() -> BrassDiodeRenderer::new) .register(); @@ -680,7 +680,7 @@ public class AllTileEntities { public static final BlockEntityEntry PULSE_REPEATER = Create.registrate() .tileEntity("pulse_repeater", PulseRepeaterTileEntity::new) - .instance(() -> BrassDiodeInstance::new) + .instance(() -> BrassDiodeInstance::new, false) .validBlocks(AllBlocks.PULSE_REPEATER) .renderer(() -> BrassDiodeRenderer::new) .register(); @@ -714,7 +714,7 @@ public class AllTileEntities { public static final BlockEntityEntry TOOLBOX = Create.registrate() .tileEntity("toolbox", ToolboxTileEntity::new) - .instance(() -> ToolBoxInstance::new) + .instance(() -> ToolBoxInstance::new, false) .validBlocks(AllBlocks.TOOLBOXES.toArray()) .renderer(() -> ToolboxRenderer::new) .register(); diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/BackHalfShaftInstance.java b/src/main/java/com/simibubi/create/content/contraptions/base/BackHalfShaftInstance.java index 61d5e9601..de23bb2c9 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/BackHalfShaftInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/BackHalfShaftInstance.java @@ -12,6 +12,6 @@ public class BackHalfShaftInstance extends HalfShaftInstance { @Override protected Direction getShaftDirection() { - return tile.getBlockState().getValue(BlockStateProperties.FACING).getOpposite(); + return blockEntity.getBlockState().getValue(BlockStateProperties.FACING).getOpposite(); } } 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 7fcf00893..1a8c1dfa6 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 @@ -7,7 +7,6 @@ import java.util.List; import javax.annotation.Nullable; -import com.jozufozu.flywheel.api.FlywheelRendered; import com.jozufozu.flywheel.backend.instancing.InstancedRenderDispatcher; import com.simibubi.create.Create; import com.simibubi.create.content.contraptions.KineticNetwork; @@ -49,7 +48,7 @@ import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.fml.DistExecutor; public class KineticTileEntity extends SmartTileEntity - implements IHaveGoggleInformation, IHaveHoveringInformation, FlywheelRendered { + implements IHaveGoggleInformation, IHaveHoveringInformation { public @Nullable Long network; public @Nullable BlockPos source; 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 c9f4b3a5b..a0553a25e 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 @@ -2,7 +2,7 @@ package com.simibubi.create.content.contraptions.base; import com.jozufozu.flywheel.api.Material; import com.jozufozu.flywheel.api.MaterialManager; -import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance; +import com.jozufozu.flywheel.backend.instancing.blockentity.BlockEntityInstance; import com.simibubi.create.AllBlocks; import com.simibubi.create.content.contraptions.base.flwdata.RotatingData; import com.simibubi.create.content.contraptions.relays.elementary.ICogWheel; @@ -12,7 +12,7 @@ import com.simibubi.create.foundation.render.AllMaterialSpecs; import net.minecraft.core.Direction; import net.minecraft.world.level.block.state.BlockState; -public abstract class KineticTileInstance extends TileEntityInstance { +public abstract class KineticTileInstance extends BlockEntityInstance { protected final Direction.Axis axis; @@ -38,7 +38,7 @@ public abstract class KineticTileInstance extends T instance.setRotationAxis(axis) .setRotationOffset(getRotationOffset(axis)) .setRotationalSpeed(speed) - .setColor(tile); + .setColor(blockEntity); } protected final RotatingData setup(RotatingData key) { @@ -57,7 +57,7 @@ public abstract class KineticTileInstance extends T key.setRotationAxis(axis) .setRotationalSpeed(speed) .setRotationOffset(getRotationOffset(axis)) - .setColor(tile) + .setColor(blockEntity) .setPosition(getInstancePosition()); return key; @@ -78,7 +78,7 @@ public abstract class KineticTileInstance extends T } protected float getTileSpeed() { - return tile.getSpeed(); + return blockEntity.getSpeed(); } protected BlockState shaft() { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillInstance.java index 206e8ba30..cf949ebd4 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillInstance.java @@ -19,7 +19,7 @@ public class DrillInstance extends SingleRotatingInstance { @Override protected Instancer getModel() { - BlockState referenceState = tile.getBlockState(); + BlockState referenceState = blockEntity.getBlockState(); Direction facing = referenceState.getValue(BlockStateProperties.FACING); return getRotatingMaterial().getModel(AllBlockPartials.DRILL_HEAD, referenceState, facing); } 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 fd0f6f56d..2efaec4a4 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 @@ -187,9 +187,4 @@ public class CuckooClockTileEntity extends KineticTileEntity { Vec3 vec = VecHelper.getCenterOf(worldPosition); level.playLocalSound(vec.x, vec.y, vec.z, sound, SoundSource.BLOCKS, volume, pitch, false); } - - @Override - public boolean shouldRenderNormally() { - return true; - } } 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 364fbfddb..f759aac8c 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 @@ -523,11 +523,6 @@ public class MechanicalCrafterTileEntity extends KineticTileEntity { return inventory; } - @Override - public boolean shouldRenderNormally() { - return true; - } - public void setScriptedResult(ItemStack scriptedResult) { this.scriptedResult = scriptedResult; } 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 1517cb5be..c3eaeb218 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 @@ -2,7 +2,7 @@ package com.simibubi.create.content.contraptions.components.crank; import com.jozufozu.flywheel.api.Instancer; import com.jozufozu.flywheel.api.MaterialManager; -import com.jozufozu.flywheel.api.instance.IDynamicInstance; +import com.jozufozu.flywheel.api.instance.DynamicInstance; import com.jozufozu.flywheel.core.PartialModel; import com.jozufozu.flywheel.core.materials.model.ModelData; import com.simibubi.create.content.contraptions.base.SingleRotatingInstance; @@ -12,7 +12,7 @@ import net.minecraft.core.Direction; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.properties.BlockStateProperties; -public class HandCrankInstance extends SingleRotatingInstance implements IDynamicInstance { +public class HandCrankInstance extends SingleRotatingInstance implements DynamicInstance { private final HandCrankTileEntity tile; private ModelData crank; 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 716523aa6..4ef31339f 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 @@ -79,11 +79,6 @@ public class HandCrankTileEntity extends GeneratingKineticTileEntity { return AllBlocks.HAND_CRANK.get(); } - @Override - public boolean shouldRenderNormally() { - return true; - } - @Override @OnlyIn(Dist.CLIENT) public void tickAudio() { 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 48dc47c10..eceeebf59 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 @@ -4,8 +4,8 @@ import static com.simibubi.create.content.contraptions.base.DirectionalAxisKinet 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.instance.DynamicInstance; +import com.jozufozu.flywheel.api.instance.TickableInstance; import com.jozufozu.flywheel.core.PartialModel; import com.jozufozu.flywheel.core.materials.oriented.OrientedData; import com.mojang.math.Quaternion; @@ -20,7 +20,7 @@ import net.minecraft.core.Direction; import net.minecraft.core.Vec3i; import net.minecraft.util.Mth; -public class DeployerInstance extends ShaftInstance implements IDynamicInstance, ITickableInstance { +public class DeployerInstance extends ShaftInstance implements DynamicInstance, TickableInstance { final DeployerTileEntity tile; final Direction facing; @@ -39,7 +39,7 @@ public class DeployerInstance extends ShaftInstance implements IDynamicInstance, public DeployerInstance(MaterialManager dispatcher, KineticTileEntity tile) { super(dispatcher, tile); - this.tile = (DeployerTileEntity) super.tile; + this.tile = (DeployerTileEntity) super.blockEntity; facing = blockState.getValue(FACING); boolean rotatePole = blockState.getValue(AXIS_ALONG_FIRST_COORDINATE) ^ facing.getAxis() == Direction.Axis.Z; 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 35d1ef873..4af84f819 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 @@ -424,11 +424,6 @@ public class DeployerTileEntity extends KineticTileEntity { return true; } - @Override - public boolean shouldRenderNormally() { - return true; - } - public float getHandOffset(float partialTicks) { if (isVirtual()) return animatedOffset.getValue(partialTicks); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/fan/FanInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/fan/FanInstance.java index 3bc3f9b6c..9a7dfa93b 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/fan/FanInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/fan/FanInstance.java @@ -36,7 +36,7 @@ public class FanInstance extends KineticTileInstance { } private float getFanSpeed() { - float speed = tile.getSpeed() * 5; + float speed = blockEntity.getSpeed() * 5; if (speed > 0) speed = Mth.clamp(speed, 80, 64 * 20); if (speed < 0) 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 caa0c1232..30e087aae 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 @@ -10,7 +10,7 @@ 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.api.instance.DynamicInstance; import com.jozufozu.flywheel.core.materials.model.ModelData; import com.jozufozu.flywheel.util.transform.TransformStack; import com.mojang.blaze3d.vertex.PoseStack; @@ -25,7 +25,7 @@ import net.minecraft.util.Mth; import net.minecraft.world.level.block.Rotation; import net.minecraft.world.level.block.state.BlockState; -public class FlyWheelInstance extends KineticTileInstance implements IDynamicInstance { +public class FlyWheelInstance extends KineticTileInstance implements DynamicInstance { protected final Direction facing; protected final Direction connection; @@ -90,8 +90,8 @@ public class FlyWheelInstance extends KineticTileInstance im float partialTicks = AnimationTickHolder.getPartialTicks(); - float speed = tile.visualSpeed.get(partialTicks) * 3 / 10f; - float angle = tile.angle + speed * partialTicks; + float speed = blockEntity.visualSpeed.get(partialTicks) * 3 / 10f; + float angle = blockEntity.angle + speed * partialTicks; if (Math.abs(angle - lastAngle) < 0.001) return; 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 5587bbc13..60115d9a9 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.api.MaterialManager; -import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance; +import com.jozufozu.flywheel.backend.instancing.blockentity.BlockEntityInstance; import com.jozufozu.flywheel.core.PartialModel; import com.jozufozu.flywheel.core.materials.model.ModelData; import com.simibubi.create.foundation.utility.AngleHelper; @@ -10,7 +10,7 @@ import net.minecraft.core.Direction; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.properties.BlockStateProperties; -public class EngineInstance extends TileEntityInstance { +public class EngineInstance extends BlockEntityInstance { protected ModelData frame; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineTileEntity.java index d96a4827b..9ecdc12f9 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineTileEntity.java @@ -2,7 +2,6 @@ package com.simibubi.create.content.contraptions.components.flywheel.engine; import java.util.List; -import com.jozufozu.flywheel.api.FlywheelRendered; import com.simibubi.create.AllBlocks; import com.simibubi.create.content.contraptions.components.flywheel.FlywheelBlock; import com.simibubi.create.content.contraptions.components.flywheel.FlywheelTileEntity; @@ -18,7 +17,7 @@ import net.minecraft.world.phys.AABB; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -public class EngineTileEntity extends SmartTileEntity implements FlywheelRendered { +public class EngineTileEntity extends SmartTileEntity { public float appliedCapacity; public float appliedSpeed; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/millstone/MillStoneCogInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/millstone/MillStoneCogInstance.java index 112abe5fb..1e8831261 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/millstone/MillStoneCogInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/millstone/MillStoneCogInstance.java @@ -15,6 +15,6 @@ public class MillStoneCogInstance extends SingleRotatingInstance { @Override protected Instancer getModel() { - return getRotatingMaterial().getModel(AllBlockPartials.MILLSTONE_COG, tile.getBlockState()); + return getRotatingMaterial().getModel(AllBlockPartials.MILLSTONE_COG, blockEntity.getBlockState()); } } 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 9ce98dd3b..8104dd20b 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 @@ -2,7 +2,7 @@ package com.simibubi.create.content.contraptions.components.mixer; import com.jozufozu.flywheel.api.Instancer; import com.jozufozu.flywheel.api.MaterialManager; -import com.jozufozu.flywheel.api.instance.IDynamicInstance; +import com.jozufozu.flywheel.api.instance.DynamicInstance; import com.jozufozu.flywheel.core.materials.oriented.OrientedData; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.base.flwdata.RotatingData; @@ -12,7 +12,7 @@ import com.simibubi.create.foundation.utility.AnimationTickHolder; import net.minecraft.core.Direction; -public class MixerInstance extends EncasedCogInstance implements IDynamicInstance { +public class MixerInstance extends EncasedCogInstance implements DynamicInstance { private final RotatingData mixerHead; private final OrientedData mixerPole; @@ -42,7 +42,7 @@ public class MixerInstance extends EncasedCogInstance implements IDynamicInstanc protected Instancer getCogModel() { return materialManager.defaultSolid() .material(AllMaterialSpecs.ROTATING) - .getModel(AllBlockPartials.SHAFTLESS_COGWHEEL, tile.getBlockState()); + .getModel(AllBlockPartials.SHAFTLESS_COGWHEEL, blockEntity.getBlockState()); } @Override 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 fc3430acc..ff842943e 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.MaterialManager; -import com.jozufozu.flywheel.api.instance.IDynamicInstance; +import com.jozufozu.flywheel.api.instance.DynamicInstance; import com.jozufozu.flywheel.core.Materials; import com.jozufozu.flywheel.core.materials.oriented.OrientedData; import com.mojang.math.Quaternion; @@ -11,7 +11,7 @@ import com.simibubi.create.content.contraptions.relays.encased.ShaftInstance; import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AnimationTickHolder; -public class PressInstance extends ShaftInstance implements IDynamicInstance { +public class PressInstance extends ShaftInstance implements DynamicInstance { private final OrientedData pressHead; private final MechanicalPressTileEntity press; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/saw/SawInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/saw/SawInstance.java index 336977777..bba424cbf 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/saw/SawInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/saw/SawInstance.java @@ -23,7 +23,7 @@ public class SawInstance extends SingleRotatingInstance { if (blockState.getValue(BlockStateProperties.FACING) .getAxis() .isHorizontal()) { - BlockState referenceState = blockState.rotate(tile.getLevel(), tile.getBlockPos(), Rotation.CLOCKWISE_180); + BlockState referenceState = blockState.rotate(blockEntity.getLevel(), blockEntity.getBlockPos(), Rotation.CLOCKWISE_180); Direction facing = referenceState.getValue(BlockStateProperties.FACING); return getRotatingMaterial().getModel(AllBlockPartials.SHAFT_HALF, referenceState, facing); } else { 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 aa2fffc3f..9403c13de 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 @@ -499,9 +499,4 @@ public class SawTileEntity extends BlockBreakingKineticTileEntity { return false; } - @Override - public boolean shouldRenderNormally() { - return true; - } - } 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 8f325b8b9..e4f303402 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.MaterialManager; -import com.jozufozu.flywheel.api.instance.IDynamicInstance; +import com.jozufozu.flywheel.api.instance.DynamicInstance; import com.jozufozu.flywheel.core.PartialModel; import com.jozufozu.flywheel.core.materials.oriented.OrientedData; import com.mojang.math.Quaternion; @@ -15,7 +15,7 @@ import com.simibubi.create.foundation.utility.AnimationTickHolder; import net.minecraft.core.Direction; import net.minecraft.world.level.block.state.properties.BlockStateProperties; -public class BearingInstance extends BackHalfShaftInstance implements IDynamicInstance { +public class BearingInstance extends BackHalfShaftInstance implements DynamicInstance { final B bearing; final OrientedData topInstance; 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 633495afc..bd1ddb2b4 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 @@ -420,11 +420,6 @@ public class ClockworkBearingTileEntity extends KineticTileEntity return worldPosition; } - @Override - public boolean shouldRenderNormally() { - return true; - } - public void setAngle(float forcedAngle) { hourAngle = forcedAngle; } 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 19d35104a..1f659aecd 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 @@ -321,11 +321,6 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity return true; } - @Override - public boolean shouldRenderNormally() { - return true; - } - public void setAngle(float forcedAngle) { angle = forcedAngle; } 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 76df6195b..e94e2b5ce 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.instance.DynamicInstance; +import com.jozufozu.flywheel.backend.instancing.blockentity.BlockEntityInstance; import com.jozufozu.flywheel.core.materials.model.ModelData; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.foundation.utility.AngleHelper; @@ -12,7 +12,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.core.Direction; import net.minecraft.util.Mth; -public class StickerInstance extends TileEntityInstance implements IDynamicInstance { +public class StickerInstance extends BlockEntityInstance implements DynamicInstance { float lastOffset = Float.NaN; final Direction facing; @@ -35,7 +35,7 @@ public class StickerInstance extends TileEntityInstance imple @Override public void beginFrame() { - float offset = tile.piston.getValue(AnimationTickHolder.getPartialTicks()); + float offset = blockEntity.piston.getValue(AnimationTickHolder.getPartialTicks()); if (fakeWorld) offset = this.offset; @@ -51,7 +51,7 @@ public class StickerInstance extends TileEntityInstance imple private void animateHead(float offset) { head.loadIdentity() .translate(getInstancePosition()) - .nudge(tile.hashCode()) + .nudge(blockEntity.hashCode()) .centre() .rotateY(AngleHelper.horizontalAngle(facing)) .rotateX(AngleHelper.verticalAngle(facing) + 90) 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 698a5b77c..697380f14 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 @@ -2,7 +2,6 @@ package com.simibubi.create.content.contraptions.components.structureMovement.ch import java.util.List; -import com.jozufozu.flywheel.api.FlywheelRendered; import com.jozufozu.flywheel.backend.instancing.InstancedRenderDispatcher; import com.simibubi.create.AllBlocks; import com.simibubi.create.AllSoundEvents; @@ -23,7 +22,7 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.fml.DistExecutor; -public class StickerTileEntity extends SmartTileEntity implements FlywheelRendered { +public class StickerTileEntity extends SmartTileEntity { LerpedFloat piston; boolean update; 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 51558e887..f84270b53 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.MaterialManager; -import com.jozufozu.flywheel.api.instance.IDynamicInstance; +import com.jozufozu.flywheel.api.instance.DynamicInstance; import com.jozufozu.flywheel.core.materials.model.ModelData; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.base.KineticTileEntity; @@ -14,7 +14,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.util.Mth; -public class GantryCarriageInstance extends ShaftInstance implements IDynamicInstance { +public class GantryCarriageInstance extends ShaftInstance implements DynamicInstance { private final ModelData gantryCogs; @@ -56,7 +56,7 @@ public class GantryCarriageInstance extends ShaftInstance implements IDynamicIns } private float getCogAngle() { - return GantryCarriageRenderer.getAngleForTe(tile, visualPos, rotationAxis) * rotationMult; + return GantryCarriageRenderer.getAngleForTe(blockEntity, visualPos, rotationAxis) * rotationMult; } private void animateCogs(float cogAngle) { 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 f4a65dfe2..da1ef0c91 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 @@ -171,9 +171,4 @@ public class GantryCarriageTileEntity extends KineticTileEntity implements IDisp BlockEntity te = level.getBlockEntity(worldPosition.relative(facing)); return te instanceof GantryShaftTileEntity && ((GantryShaftTileEntity) te).canAssembleOn(); } - - @Override - public boolean shouldRenderNormally() { - return true; - } } 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 dd7c8c3d1..7282da1e1 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 @@ -3,7 +3,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement.gl import com.jozufozu.flywheel.api.Instancer; import com.jozufozu.flywheel.api.MaterialGroup; import com.jozufozu.flywheel.api.MaterialManager; -import com.jozufozu.flywheel.api.instance.ITickableInstance; +import com.jozufozu.flywheel.api.instance.TickableInstance; import com.jozufozu.flywheel.backend.instancing.entity.EntityInstance; import com.jozufozu.flywheel.core.Materials; import com.jozufozu.flywheel.core.instancing.ConditionalInstance; @@ -21,7 +21,7 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.LightLayer; -public class GlueInstance extends EntityInstance implements ITickableInstance { +public class GlueInstance extends EntityInstance implements TickableInstance { private static final ResourceLocation TEXTURE = Create.asResource("textures/entity/super_glue/slime.png"); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueEntity.java index 8f622be50..767c66f88 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueEntity.java @@ -4,7 +4,6 @@ import javax.annotation.Nullable; import org.apache.commons.lang3.Validate; -import com.jozufozu.flywheel.api.FlywheelRendered; import com.simibubi.create.AllBlocks; import com.simibubi.create.AllEntityTypes; import com.simibubi.create.AllItems; @@ -68,7 +67,7 @@ import net.minecraftforge.network.NetworkHooks; import net.minecraftforge.network.PacketDistributor; public class SuperGlueEntity extends Entity - implements IEntityAdditionalSpawnData, ISpecialEntityItemRequirement, FlywheelRendered { + implements IEntityAdditionalSpawnData, ISpecialEntityItemRequirement { private int validationTimer; protected BlockPos hangingPosition; 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 2cc6fd82f..8e10efb1a 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 @@ -2,7 +2,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement.pu import com.jozufozu.flywheel.api.Instancer; import com.jozufozu.flywheel.api.MaterialManager; -import com.jozufozu.flywheel.api.instance.IDynamicInstance; +import com.jozufozu.flywheel.api.instance.DynamicInstance; import com.jozufozu.flywheel.core.instancing.ConditionalInstance; import com.jozufozu.flywheel.core.instancing.GroupInstance; import com.jozufozu.flywheel.core.instancing.SelectInstance; @@ -22,7 +22,7 @@ import net.minecraft.core.Direction; import net.minecraft.util.Mth; import net.minecraft.world.level.LightLayer; -public abstract class AbstractPulleyInstance extends ShaftInstance implements IDynamicInstance, MovingListener { +public abstract class AbstractPulleyInstance extends ShaftInstance implements DynamicInstance, MovingListener { final OrientedData coil; final SelectInstance magnet; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/HosePulleyInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/HosePulleyInstance.java index 5969610e6..62d7c0e65 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/HosePulleyInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/HosePulleyInstance.java @@ -39,7 +39,7 @@ public class HosePulleyInstance extends AbstractPulleyInstance { } protected float getOffset() { - return ((HosePulleyTileEntity) tile).getInterpolatedOffset(AnimationTickHolder.getPartialTicks()); + return ((HosePulleyTileEntity) blockEntity).getInterpolatedOffset(AnimationTickHolder.getPartialTicks()); } protected boolean isRunning() { 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 265aad167..a441696f8 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 @@ -236,9 +236,4 @@ public class PulleyTileEntity extends LinearActuatorTileEntity { public void animateOffset(float forcedOffset) { offset = forcedOffset; } - - @Override - public boolean shouldRenderNormally() { - return false; - } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/RopePulleyInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/RopePulleyInstance.java index 7bb74f913..5eac17ee0 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/RopePulleyInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/RopePulleyInstance.java @@ -35,10 +35,10 @@ public class RopePulleyInstance extends AbstractPulleyInstance { protected float getOffset() { float partialTicks = AnimationTickHolder.getPartialTicks(); - return PulleyRenderer.getTileOffset(partialTicks, (PulleyTileEntity) tile); + return PulleyRenderer.getTileOffset(partialTicks, (PulleyTileEntity) blockEntity); } protected boolean isRunning() { - return ((PulleyTileEntity) tile).running || tile.isVirtual(); + return ((PulleyTileEntity) blockEntity).running || blockEntity.isVirtual(); } } 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 ce999d473..d1d138bfc 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 @@ -8,7 +8,7 @@ import org.apache.commons.lang3.tuple.Pair; import com.jozufozu.flywheel.api.MaterialManager; import com.jozufozu.flywheel.backend.instancing.TaskEngine; -import com.jozufozu.flywheel.backend.instancing.tile.TileInstanceManager; +import com.jozufozu.flywheel.backend.instancing.blockentity.BlockEntityInstanceManager; import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld; import com.simibubi.create.AllMovementBehaviours; import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour; @@ -18,7 +18,7 @@ import net.minecraft.client.Camera; import net.minecraft.core.BlockPos; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo; -public class ContraptionInstanceManager extends TileInstanceManager { +public class ContraptionInstanceManager extends BlockEntityInstanceManager { protected ArrayList actors = new ArrayList<>(); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionRenderDispatcher.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionRenderDispatcher.java index 906ad3170..1966cd557 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionRenderDispatcher.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionRenderDispatcher.java @@ -108,7 +108,7 @@ public class ContraptionRenderDispatcher { ContraptionWorld contraptionWorld = c.getContraptionWorld(); VirtualRenderWorld renderWorld = new VirtualRenderWorld(world, contraptionWorld.getHeight(), contraptionWorld.getMinBuildHeight()); - renderWorld.setTileEntities(c.presentTileEntities.values()); + renderWorld.setBlockEntities(c.presentTileEntities.values()); for (StructureTemplate.StructureBlockInfo info : c.getBlocks() .values()) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/FlwContraption.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/FlwContraption.java index f02aced9f..cf2a561a7 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/FlwContraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/FlwContraption.java @@ -147,8 +147,7 @@ public class FlwContraption extends ContraptionRenderInfo { Collection tileEntities = contraption.maybeInstancedTileEntities; if (!tileEntities.isEmpty()) { for (BlockEntity te : tileEntities) { - if (InstancedRenderRegistry.getInstance() - .canInstance(te.getType())) { + if (InstancedRenderRegistry.canInstance(te.getType())) { Level world = te.getLevel(); te.setLevel(renderWorld); instanceWorld.tileInstanceManager.add(te); diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpCogInstance.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpCogInstance.java index f76eaa677..d1c253783 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpCogInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpCogInstance.java @@ -19,7 +19,7 @@ public class PumpCogInstance extends SingleRotatingInstance { @Override protected Instancer getModel() { - BlockState referenceState = tile.getBlockState(); + BlockState referenceState = blockEntity.getBlockState(); Direction facing = referenceState.getValue(BlockStateProperties.FACING); return getRotatingMaterial().getModel(AllBlockPartials.MECHANICAL_PUMP_COG, referenceState, facing); } 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 f8df35193..2bf7cbd9a 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 @@ -389,9 +389,4 @@ public class PumpTileEntity extends KineticTileEntity { } } - - @Override - public boolean shouldRenderNormally() { - return true; - } } 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 be066a98e..7e3d47a6c 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 @@ -187,9 +187,4 @@ public class HosePulleyTileEntity extends KineticTileEntity { return this.capability.cast(); return super.getCapability(cap, side); } - - @Override - public boolean shouldRenderNormally() { - return true; - } } 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 834947da9..d8d688604 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.MaterialManager; -import com.jozufozu.flywheel.api.instance.IDynamicInstance; +import com.jozufozu.flywheel.api.instance.DynamicInstance; import com.jozufozu.flywheel.core.Materials; import com.jozufozu.flywheel.core.materials.model.ModelData; import com.simibubi.create.AllBlockPartials; @@ -14,7 +14,7 @@ import com.simibubi.create.foundation.utility.AnimationTickHolder; import net.minecraft.core.Direction; import net.minecraft.util.Mth; -public class FluidValveInstance extends ShaftInstance implements IDynamicInstance { +public class FluidValveInstance extends ShaftInstance implements DynamicInstance { private final FluidValveTileEntity tile; protected ModelData pointer; 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 79490b78d..ccb486b2f 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 @@ -80,11 +80,6 @@ public class FluidValveTileEntity extends KineticTileEntity { behaviours.add(new ValvePipeBehaviour(this)); } - @Override - public boolean shouldRenderNormally() { - return true; - } - class ValvePipeBehaviour extends StraightPipeFluidTransportBehaviour { public ValvePipeBehaviour(SmartTileEntity te) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/processing/BasinOperatingTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/processing/BasinOperatingTileEntity.java index 62d0e2e8b..e03754473 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/processing/BasinOperatingTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/processing/BasinOperatingTileEntity.java @@ -149,9 +149,4 @@ public abstract class BasinOperatingTileEntity extends KineticTileEntity { protected abstract boolean matchStaticFilters(Recipe recipe); protected abstract Object getRecipeCacheKey(); - - @Override - public boolean shouldRenderNormally() { - return true; - } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerTileEntity.java index 9f213cafc..15f1dcb9d 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerTileEntity.java @@ -118,11 +118,6 @@ public class SpeedControllerTileEntity extends KineticTileEntity { && stateAbove.getValue(CogWheelBlock.AXIS).isHorizontal(); } - @Override - public boolean shouldRenderNormally() { - return true; - } - private class ControllerValueBoxTransform extends ValueBoxTransform.Sided { @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltInstance.java b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltInstance.java index 38df5200c..0a518ce6c 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltInstance.java @@ -80,14 +80,14 @@ public class BeltInstance extends KineticTileInstance { @Override public void update() { - DyeColor color = tile.color.orElse(null); + DyeColor color = blockEntity.color.orElse(null); boolean bottom = true; for (BeltData key : keys) { SpriteShiftEntry spriteShiftEntry = BeltRenderer.getSpriteShiftEntry(color, diagonal, bottom); key.setScrollTexture(spriteShiftEntry) - .setColor(tile) + .setColor(blockEntity) .setRotationalSpeed(getScrollSpeed()); bottom = false; } @@ -113,7 +113,7 @@ public class BeltInstance extends KineticTileInstance { } private float getScrollSpeed() { - float speed = tile.getSpeed(); + float speed = blockEntity.getSpeed(); if (((facing.getAxisDirection() == Direction.AxisDirection.NEGATIVE) ^ upward) ^ ((alongX && !diagonal) || (alongZ && diagonal))) { speed = -speed; @@ -168,7 +168,7 @@ public class BeltInstance extends KineticTileInstance { .setRotation(q) .setRotationalSpeed(getScrollSpeed()) .setRotationOffset(bottom ? 0.5f : 0f) - .setColor(tile) + .setColor(blockEntity) .setPosition(getInstancePosition()) .setBlockLight(world.getBrightness(LightLayer.BLOCK, pos)) .setSkyLight(world.getBrightness(LightLayer.SKY, pos)); 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 d540627ad..eaf885e9b 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 @@ -528,7 +528,6 @@ public class BeltTileEntity extends KineticTileEntity implements LightListener { itemHandler.invalidate(); } - @Override public boolean shouldRenderNormally() { if (level == null) return isController(); diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/BracketedKineticTileInstance.java b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/BracketedKineticTileInstance.java index 127addf7f..e6ab3d5ef 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/BracketedKineticTileInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/BracketedKineticTileInstance.java @@ -27,15 +27,15 @@ public class BracketedKineticTileInstance extends SingleRotatingInstance { @Override public void init() { super.init(); - if (!ICogWheel.isLargeCog(tile.getBlockState())) + if (!ICogWheel.isLargeCog(blockEntity.getBlockState())) return; // Large cogs sometimes have to offset their teeth by 11.25 degrees in order to // mesh properly - float speed = tile.getSpeed(); - Axis axis = KineticTileEntityRenderer.getRotationAxisOf(tile); - BlockPos pos = tile.getBlockPos(); + float speed = blockEntity.getSpeed(); + Axis axis = KineticTileEntityRenderer.getRotationAxisOf(blockEntity); + BlockPos pos = blockEntity.getBlockPos(); float offset = BracketedKineticTileRenderer.getShaftAngleOffset(axis, pos); Direction facing = Direction.fromAxisAndDirection(axis, AxisDirection.POSITIVE); Instancer half = getRotatingMaterial().getModel(AllBlockPartials.COGWHEEL_SHAFT, blockState, @@ -47,10 +47,10 @@ public class BracketedKineticTileInstance extends SingleRotatingInstance { @Override protected Instancer getModel() { - if (!ICogWheel.isLargeCog(tile.getBlockState())) + if (!ICogWheel.isLargeCog(blockEntity.getBlockState())) return super.getModel(); - Axis axis = KineticTileEntityRenderer.getRotationAxisOf(tile); + Axis axis = KineticTileEntityRenderer.getRotationAxisOf(blockEntity); Direction facing = Direction.fromAxisAndDirection(axis, AxisDirection.POSITIVE); return getRotatingMaterial().getModel(AllBlockPartials.SHAFTLESS_LARGE_COGWHEEL, blockState, facing, () -> this.rotateToAxis(axis)); diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/encased/EncasedCogInstance.java b/src/main/java/com/simibubi/create/content/contraptions/relays/encased/EncasedCogInstance.java index 552ccc02b..62d6f45bc 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/encased/EncasedCogInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/encased/EncasedCogInstance.java @@ -56,7 +56,7 @@ public class EncasedCogInstance extends KineticTileInstance { rotatingBottomShaft = Optional.empty(); for (Direction d : Iterate.directionsInAxis(axis)) { - if (!def.hasShaftTowards(tile.getLevel(), tile.getBlockPos(), blockState, d)) + if (!def.hasShaftTowards(blockEntity.getLevel(), blockEntity.getBlockPos(), blockState, d)) continue; RotatingData data = setup(getRotatingMaterial().getModel(AllBlockPartials.SHAFT_HALF, blockState, d) .createInstance()); @@ -89,7 +89,7 @@ public class EncasedCogInstance extends KineticTileInstance { } protected Instancer getCogModel() { - BlockState referenceState = tile.getBlockState(); + BlockState referenceState = blockEntity.getBlockState(); Direction facing = Direction.fromAxisAndDirection(referenceState.getValue(BlockStateProperties.AXIS), AxisDirection.POSITIVE); PartialModel partial = large ? AllBlockPartials.SHAFTLESS_LARGE_COGWHEEL : AllBlockPartials.SHAFTLESS_COGWHEEL; diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/encased/SplitShaftInstance.java b/src/main/java/com/simibubi/create/content/contraptions/relays/encased/SplitShaftInstance.java index 7c9c16256..d6ded2749 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/encased/SplitShaftInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/encased/SplitShaftInstance.java @@ -46,7 +46,7 @@ public class SplitShaftInstance extends KineticTileInstance faces; @@ -59,7 +59,7 @@ public abstract class GaugeInstance extends ShaftInstance implements IDynamicIns @Override public void beginFrame() { - GaugeTileEntity gaugeTile = (GaugeTileEntity) tile; + GaugeTileEntity gaugeTile = (GaugeTileEntity) blockEntity; if (Mth.equal(gaugeTile.prevDialState, gaugeTile.dialState)) return; 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 5df103fc8..7ea03b0e0 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 @@ -52,9 +52,4 @@ public class GaugeTileEntity extends KineticTileEntity implements IHaveGoggleInf return true; } - - @Override - public boolean shouldRenderNormally() { - return true; - } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/gearbox/GearboxInstance.java b/src/main/java/com/simibubi/create/content/contraptions/relays/gearbox/GearboxInstance.java index 8871111a8..ae7173155 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/gearbox/GearboxInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/gearbox/GearboxInstance.java @@ -56,7 +56,7 @@ public class GearboxInstance extends KineticTileInstance { } private float getSpeed(Direction direction) { - float speed = tile.getSpeed(); + float speed = blockEntity.getSpeed(); if (speed != 0 && sourceFacing != null) { if (sourceFacing.getAxis() == direction.getAxis()) @@ -68,8 +68,8 @@ public class GearboxInstance extends KineticTileInstance { } protected void updateSourceFacing() { - if (tile.hasSource()) { - BlockPos source = tile.source.subtract(pos); + if (blockEntity.hasSource()) { + BlockPos source = blockEntity.source.subtract(pos); sourceFacing = Direction.getNearest(source.getX(), source.getY(), source.getZ()); } else { sourceFacing = null; 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 d83cd2dcc..c7a99f0b0 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 @@ -128,11 +128,6 @@ public class CopperBacktankTileEntity extends KineticTileEntity implements Namea .getDescriptionId()); } - @Override - public boolean shouldRenderNormally() { - return true; - } - public int getAirLevel() { return airLevel; } 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 1e9f7db99..aac661c5e 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 @@ -2,8 +2,8 @@ package com.simibubi.create.content.curiosities.toolbox; import com.jozufozu.flywheel.api.Instancer; 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.instance.DynamicInstance; +import com.jozufozu.flywheel.backend.instancing.blockentity.BlockEntityInstance; import com.jozufozu.flywheel.core.Materials; import com.jozufozu.flywheel.core.materials.model.ModelData; import com.simibubi.create.AllBlockPartials; @@ -13,7 +13,7 @@ import com.simibubi.create.foundation.utility.Iterate; import net.minecraft.core.Direction; import net.minecraft.world.level.block.state.BlockState; -public class ToolBoxInstance extends TileEntityInstance implements IDynamicInstance { +public class ToolBoxInstance extends BlockEntityInstance implements DynamicInstance { private final Direction facing; private ModelData lid; @@ -28,7 +28,7 @@ public class ToolBoxInstance extends TileEntityInstance imple @Override public void init() { - BlockState blockState = tile.getBlockState(); + BlockState blockState = blockEntity.getBlockState(); Instancer drawerModel = materialManager.defaultSolid() .material(Materials.TRANSFORMED) @@ -37,7 +37,7 @@ public class ToolBoxInstance extends TileEntityInstance imple drawers = new ModelData[]{drawerModel.createInstance(), drawerModel.createInstance()}; lid = materialManager.defaultCutout() .material(Materials.TRANSFORMED) - .getModel(AllBlockPartials.TOOLBOX_LIDS.get(tile.getColor()), blockState) + .getModel(AllBlockPartials.TOOLBOX_LIDS.get(blockEntity.getColor()), blockState) .createInstance(); } @@ -56,8 +56,8 @@ public class ToolBoxInstance extends TileEntityInstance imple float partialTicks = AnimationTickHolder.getPartialTicks(); - float lidAngle = tile.lid.getValue(partialTicks); - float drawerOffset = tile.drawers.getValue(partialTicks); + float lidAngle = blockEntity.lid.getValue(partialTicks); + float drawerOffset = blockEntity.drawers.getValue(partialTicks); lid.loadIdentity() .translate(instancePos) 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 005eb09aa..e80788d53 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 @@ -10,7 +10,6 @@ import java.util.Set; import java.util.UUID; import java.util.WeakHashMap; -import com.jozufozu.flywheel.api.FlywheelRendered; import com.simibubi.create.AllBlocks; import com.simibubi.create.foundation.tileEntity.SmartTileEntity; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; @@ -43,7 +42,7 @@ import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemHandlerHelper; -public class ToolboxTileEntity extends SmartTileEntity implements MenuProvider, Nameable, FlywheelRendered { +public class ToolboxTileEntity extends SmartTileEntity implements MenuProvider, Nameable { public LerpedFloat lid = LerpedFloat.linear() .startWithValue(0); 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 231c6706a..9f0402373 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 @@ -8,8 +8,8 @@ import java.util.Map; import com.jozufozu.flywheel.api.InstanceData; import com.jozufozu.flywheel.api.Instancer; 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.instance.DynamicInstance; +import com.jozufozu.flywheel.backend.instancing.blockentity.BlockEntityInstance; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.logistics.block.flap.FlapData; import com.simibubi.create.foundation.render.AllMaterialSpecs; @@ -19,7 +19,7 @@ import com.simibubi.create.foundation.utility.animation.InterpolatedValue; import net.minecraft.core.Direction; import net.minecraft.world.level.LightLayer; -public class BeltTunnelInstance extends TileEntityInstance implements IDynamicInstance { +public class BeltTunnelInstance extends BlockEntityInstance implements DynamicInstance { private final Map> tunnelFlaps; @@ -70,13 +70,13 @@ public class BeltTunnelInstance extends TileEntityInstance @Override public boolean shouldReset() { - return super.shouldReset() || tunnelFlaps.size() != tile.flaps.size(); + return super.shouldReset() || tunnelFlaps.size() != blockEntity.flaps.size(); } @Override public void beginFrame() { tunnelFlaps.forEach((direction, keys) -> { - InterpolatedValue flapValue = tile.flaps.get(direction); + InterpolatedValue flapValue = blockEntity.flaps.get(direction); if (flapValue == null) { return; } 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 3ff3cb53c..69cdb2cab 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 @@ -9,7 +9,6 @@ import java.util.Set; import org.apache.commons.lang3.tuple.Pair; -import com.jozufozu.flywheel.api.FlywheelRendered; import com.jozufozu.flywheel.backend.instancing.InstancedRenderDispatcher; import com.simibubi.create.AllBlocks; import com.simibubi.create.content.logistics.block.belts.tunnel.BeltTunnelBlock.Shape; @@ -40,7 +39,7 @@ import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; -public class BeltTunnelTileEntity extends SmartTileEntity implements FlywheelRendered { +public class BeltTunnelTileEntity extends SmartTileEntity { public Map flaps; public Set sides; @@ -175,11 +174,6 @@ public class BeltTunnelTileEntity extends SmartTileEntity implements FlywheelRen flapsToSend.clear(); } - @Override - public boolean shouldRenderNormally() { - return true; - } - @Override public void addBehaviours(List behaviours) {} 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 dc484208d..1a37a1141 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.MaterialManager; -import com.jozufozu.flywheel.api.instance.IDynamicInstance; +import com.jozufozu.flywheel.api.instance.DynamicInstance; import com.jozufozu.flywheel.core.materials.model.ModelData; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.relays.encased.ShaftInstance; @@ -9,7 +9,7 @@ import com.simibubi.create.foundation.utility.AnimationTickHolder; import net.minecraft.util.Mth; -public class EjectorInstance extends ShaftInstance implements IDynamicInstance { +public class EjectorInstance extends ShaftInstance implements DynamicInstance { protected final EjectorTileEntity tile; 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 28e027107..7dc137587 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 @@ -576,11 +576,6 @@ public class EjectorTileEntity extends KineticTileEntity { return super.getCapability(cap, side); } - @Override - public boolean shouldRenderNormally() { - return true; - } - public float getLidProgress(float pt) { return lidProgress.getValue(pt); } 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 04ce9ca21..450726b17 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,14 +1,14 @@ 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.instance.TickableInstance; +import com.jozufozu.flywheel.backend.instancing.blockentity.BlockEntityInstance; import com.jozufozu.flywheel.core.Materials; import com.jozufozu.flywheel.core.materials.model.ModelData; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.foundation.utility.Color; -public class BrassDiodeInstance extends TileEntityInstance implements ITickableInstance { +public class BrassDiodeInstance extends BlockEntityInstance implements TickableInstance { protected final ModelData indicator; @@ -30,11 +30,11 @@ public class BrassDiodeInstance extends TileEntityInstance @Override public void tick() { - if (previousState == tile.state) return; + if (previousState == blockEntity.state) return; indicator.setColor(getColor()); - previousState = tile.state; + previousState = blockEntity.state; } @Override @@ -48,6 +48,6 @@ public class BrassDiodeInstance extends TileEntityInstance } protected int getColor() { - return Color.mixColors(0x2c0300, 0xcd0000, tile.getProgress()); + return Color.mixColors(0x2c0300, 0xcd0000, blockEntity.getProgress()); } } 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 2a0e9e811..dfc2da4dc 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 @@ -4,7 +4,6 @@ import static com.simibubi.create.content.logistics.block.diodes.BrassDiodeBlock import java.util.List; -import com.jozufozu.flywheel.api.FlywheelRendered; import com.simibubi.create.foundation.tileEntity.SmartTileEntity; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollValueBehaviour; @@ -19,7 +18,7 @@ import net.minecraft.world.level.block.DiodeBlock; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -public abstract class BrassDiodeTileEntity extends SmartTileEntity implements FlywheelRendered { +public abstract class BrassDiodeTileEntity extends SmartTileEntity { protected int state; ScrollValueBehaviour maxState; 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 83d36c1e6..b5fd82fd1 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 @@ -5,8 +5,8 @@ import java.util.ArrayList; import com.jozufozu.flywheel.api.InstanceData; import com.jozufozu.flywheel.api.Instancer; 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.instance.DynamicInstance; +import com.jozufozu.flywheel.backend.instancing.blockentity.BlockEntityInstance; import com.jozufozu.flywheel.core.PartialModel; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.logistics.block.flap.FlapData; @@ -16,7 +16,7 @@ import com.simibubi.create.foundation.utility.AnimationTickHolder; import net.minecraft.core.Direction; import net.minecraft.world.level.LightLayer; -public class FunnelInstance extends TileEntityInstance implements IDynamicInstance { +public class FunnelInstance extends BlockEntityInstance implements DynamicInstance { private final ArrayList flaps; @@ -65,7 +65,7 @@ public class FunnelInstance extends TileEntityInstance impleme public void beginFrame() { if (flaps == null) return; - float flapness = tile.flap.get(AnimationTickHolder.getPartialTicks()); + float flapness = blockEntity.flap.get(AnimationTickHolder.getPartialTicks()); for (FlapData flap : flaps) { flap.setFlapness(flapness); 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 eadb7173e..dacf89d4f 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 @@ -3,7 +3,6 @@ package com.simibubi.create.content.logistics.block.funnel; import java.lang.ref.WeakReference; import java.util.List; -import com.jozufozu.flywheel.api.FlywheelRendered; import com.jozufozu.flywheel.backend.instancing.InstancedRenderDispatcher; import com.simibubi.create.AllBlocks; import com.simibubi.create.AllSoundEvents; @@ -37,7 +36,7 @@ import net.minecraft.world.phys.Vec3; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.fml.DistExecutor; -public class FunnelTileEntity extends SmartTileEntity implements IHaveHoveringInformation, FlywheelRendered { +public class FunnelTileEntity extends SmartTileEntity implements IHaveHoveringInformation { private FilteringBehaviour filtering; private InvManipulationBehaviour invManipulation; @@ -336,9 +335,4 @@ public class FunnelTileEntity extends SmartTileEntity implements IHaveHoveringIn .onFunnelTransfer(level, worldPosition, stack); } - @Override - public boolean shouldRenderNormally() { - return true; - } - } 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 3d118c46c..2feb23b98 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 @@ -7,7 +7,7 @@ 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.api.instance.DynamicInstance; import com.jozufozu.flywheel.core.materials.model.ModelData; import com.jozufozu.flywheel.util.transform.TransformStack; import com.mojang.blaze3d.vertex.PoseStack; @@ -24,7 +24,7 @@ import net.minecraft.util.Mth; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.ItemStack; -public class ArmInstance extends SingleRotatingInstance implements IDynamicInstance { +public class ArmInstance extends SingleRotatingInstance implements DynamicInstance { final ModelData base; final ModelData lowerBody; @@ -69,7 +69,7 @@ public class ArmInstance extends SingleRotatingInstance implements IDynamicInsta @Override public void beginFrame() { - if (arm.phase == ArmTileEntity.Phase.DANCING && tile.getSpeed() != 0) { + if (arm.phase == ArmTileEntity.Phase.DANCING && blockEntity.getSpeed() != 0) { animateArm(true); firstRender = true; return; @@ -107,7 +107,7 @@ public class ArmInstance extends SingleRotatingInstance implements IDynamicInsta int color; if (rave) { - float renderTick = AnimationTickHolder.getRenderTime(this.arm.getLevel()) + (tile.hashCode() % 64); + float renderTick = AnimationTickHolder.getRenderTime(this.arm.getLevel()) + (blockEntity.hashCode() % 64); baseAngle = (renderTick * 10) % 360; lowerArmAngle = Mth.lerp((Mth.sin(renderTick / 4) + 1) / 2, -45, 15); upperArmAngle = Mth.lerp((Mth.sin(renderTick / 8) + 1) / 4, -45, 95); @@ -172,7 +172,7 @@ public class ArmInstance extends SingleRotatingInstance implements IDynamicInsta @Override protected Instancer getModel() { - return getRotatingMaterial().getModel(AllBlockPartials.ARM_COG, tile.getBlockState()); + return getRotatingMaterial().getModel(AllBlockPartials.ARM_COG, blockEntity.getBlockState()); } @Override 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 e6b97b32b..0d3ff0621 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 @@ -517,11 +517,6 @@ public class ArmTileEntity extends KineticTileEntity implements ITransformableTE return true; } - @Override - public boolean shouldRenderNormally() { - return true; - } - private class SelectionModeValueBox extends CenteredSideValueBoxTransform { public SelectionModeValueBox() { 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 7eb4a61fd..4195b9dde 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 @@ -2,8 +2,8 @@ package com.simibubi.create.content.logistics.block.redstone; 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.api.instance.DynamicInstance; +import com.jozufozu.flywheel.backend.instancing.blockentity.BlockEntityInstance; import com.jozufozu.flywheel.core.materials.model.ModelData; import com.jozufozu.flywheel.util.transform.Rotate; import com.jozufozu.flywheel.util.transform.Translate; @@ -15,7 +15,7 @@ import com.simibubi.create.foundation.utility.Color; import net.minecraft.core.Direction; import net.minecraft.world.level.block.state.properties.AttachFace; -public class AnalogLeverInstance extends TileEntityInstance implements IDynamicInstance { +public class AnalogLeverInstance extends BlockEntityInstance implements DynamicInstance { protected final ModelData handle; protected final ModelData indicator; @@ -42,12 +42,12 @@ public class AnalogLeverInstance extends TileEntityInstance implements IDynamicInstance { +public class SchematicannonInstance extends BlockEntityInstance implements DynamicInstance { private final ModelData connector; private final ModelData pipe; @@ -30,12 +30,12 @@ public class SchematicannonInstance extends TileEntityInstance extends EntityBuilder { @Nullable - private NonNullSupplier> instanceFactory; + private NonNullSupplier>> instanceFactory; + private NonNullPredicate renderNormally; public static EntityBuilder create(AbstractRegistrate owner, P parent, String name, BuilderCallback callback, EntityType.EntityFactory factory, MobCategory classification) { return (new CreateEntityBuilder<>(owner, parent, name, callback, factory, classification)).defaultLang(); @@ -32,23 +37,34 @@ public class CreateEntityBuilder extends EntityBuilder instance(NonNullSupplier> instanceFactory) { + public CreateEntityBuilder instance(NonNullSupplier>> instanceFactory) { + return instance(instanceFactory, true); + } + + public CreateEntityBuilder instance(NonNullSupplier>> instanceFactory, boolean renderNormally) { + return instance(instanceFactory, be -> true); + } + + public CreateEntityBuilder instance(NonNullSupplier>> instanceFactory, NonNullPredicate renderNormally) { if (this.instanceFactory == null) { DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> this::registerInstance); } this.instanceFactory = instanceFactory; + this.renderNormally = renderNormally; return this; } protected void registerInstance() { OneTimeEventReceiver.addModListener(FMLClientSetupEvent.class, $ -> { - NonNullSupplier> instanceFactory = this.instanceFactory; + NonNullSupplier>> instanceFactory = this.instanceFactory; if (instanceFactory != null) { - InstancedRenderRegistry.getInstance() - .entity(getEntry()) - .factory(instanceFactory.get()); + NonNullPredicate renderNormally = this.renderNormally; + InstancedRenderRegistry.configure(getEntry()) + .factory(instanceFactory.get()) + .skipRender(be -> !renderNormally.test(be)) + .apply(); } }); diff --git a/src/main/java/com/simibubi/create/foundation/data/CreateTileEntityBuilder.java b/src/main/java/com/simibubi/create/foundation/data/CreateTileEntityBuilder.java index bcdf77e80..d336936a8 100644 --- a/src/main/java/com/simibubi/create/foundation/data/CreateTileEntityBuilder.java +++ b/src/main/java/com/simibubi/create/foundation/data/CreateTileEntityBuilder.java @@ -1,9 +1,12 @@ package com.simibubi.create.foundation.data; +import java.util.function.BiFunction; + import javax.annotation.Nullable; +import com.jozufozu.flywheel.api.MaterialManager; import com.jozufozu.flywheel.backend.instancing.InstancedRenderRegistry; -import com.jozufozu.flywheel.backend.instancing.tile.ITileInstanceFactory; +import com.jozufozu.flywheel.backend.instancing.blockentity.BlockEntityInstance; import com.tterrag.registrate.AbstractRegistrate; import com.tterrag.registrate.builders.BlockEntityBuilder; import com.tterrag.registrate.builders.BuilderCallback; @@ -12,13 +15,15 @@ import com.tterrag.registrate.util.nullness.NonNullSupplier; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.common.util.NonNullPredicate; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; public class CreateTileEntityBuilder extends BlockEntityBuilder { @Nullable - private NonNullSupplier> instanceFactory; + private NonNullSupplier>> instanceFactory; + private NonNullPredicate renderNormally; public static BlockEntityBuilder create(AbstractRegistrate owner, P parent, String name, BuilderCallback callback, BlockEntityFactory factory) { @@ -30,23 +35,34 @@ public class CreateTileEntityBuilder extends BlockEnti super(owner, parent, name, callback, factory); } - public CreateTileEntityBuilder instance(NonNullSupplier> instanceFactory) { + public CreateTileEntityBuilder instance(NonNullSupplier>> instanceFactory) { + return instance(instanceFactory, true); + } + + public CreateTileEntityBuilder instance(NonNullSupplier>> instanceFactory, boolean renderNormally) { + return instance(instanceFactory, be -> renderNormally); + } + + public CreateTileEntityBuilder instance(NonNullSupplier>> instanceFactory, NonNullPredicate renderNormally) { if (this.instanceFactory == null) { DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> this::registerInstance); } this.instanceFactory = instanceFactory; + this.renderNormally = renderNormally; return this; } protected void registerInstance() { OneTimeEventReceiver.addModListener(FMLClientSetupEvent.class, $ -> { - NonNullSupplier> instanceFactory = this.instanceFactory; + NonNullSupplier>> instanceFactory = this.instanceFactory; if (instanceFactory != null) { - InstancedRenderRegistry.getInstance() - .tile(getEntry()) - .factory(instanceFactory.get()); + NonNullPredicate renderNormally = this.renderNormally; + InstancedRenderRegistry.configure(getEntry()) + .factory(instanceFactory.get()) + .skipRender(be -> !renderNormally.test(be)) + .apply(); } }); } diff --git a/src/main/java/com/simibubi/create/foundation/render/RainbowDebugStateProvider.java b/src/main/java/com/simibubi/create/foundation/render/RainbowDebugStateProvider.java index 9e4fd21cc..7aafc712b 100644 --- a/src/main/java/com/simibubi/create/foundation/render/RainbowDebugStateProvider.java +++ b/src/main/java/com/simibubi/create/foundation/render/RainbowDebugStateProvider.java @@ -1,12 +1,12 @@ package com.simibubi.create.foundation.render; -import com.jozufozu.flywheel.core.shader.spec.IBooleanStateProvider; +import com.jozufozu.flywheel.core.shader.spec.BooleanStateProvider; import com.simibubi.create.Create; import com.simibubi.create.content.contraptions.KineticDebugger; import net.minecraft.resources.ResourceLocation; -public class RainbowDebugStateProvider implements IBooleanStateProvider { +public class RainbowDebugStateProvider implements BooleanStateProvider { public static final RainbowDebugStateProvider INSTANCE = new RainbowDebugStateProvider(); public static final ResourceLocation NAME = Create.asResource("rainbow_debug"); diff --git a/src/main/java/com/simibubi/create/foundation/render/TileEntityRenderHelper.java b/src/main/java/com/simibubi/create/foundation/render/TileEntityRenderHelper.java index 57ccd11b6..c6711962c 100644 --- a/src/main/java/com/simibubi/create/foundation/render/TileEntityRenderHelper.java +++ b/src/main/java/com/simibubi/create/foundation/render/TileEntityRenderHelper.java @@ -48,8 +48,8 @@ public class TileEntityRenderHelper { Iterator iterator = customRenderTEs.iterator(); while (iterator.hasNext()) { BlockEntity tileEntity = iterator.next(); - if (Backend.canUseInstancing(renderWorld) && InstancedRenderRegistry.getInstance() - .shouldSkipRender(tileEntity)) continue; + if (Backend.canUseInstancing(renderWorld) && InstancedRenderRegistry.shouldSkipRender(tileEntity)) + continue; BlockEntityRenderer renderer = Minecraft.getInstance().getBlockEntityRenderDispatcher().getRenderer(tileEntity); if (renderer == null) { diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index bd4ff898d..31637418c 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -32,6 +32,6 @@ Technology that empowers the player.''' [[dependencies.create]] modId="flywheel" mandatory=true - versionRange="[1.18-0.5.0,1.18-0.5.1)" + versionRange="[1.18-0.5.1,1.18-0.5.2)" ordering="AFTER" side="BOTH"