From cd60fd4d592247f982d48ba7a645ccff0016ede2 Mon Sep 17 00:00:00 2001 From: Zelophed Date: Fri, 21 Aug 2020 12:59:30 +0200 Subject: [PATCH] refactor AllTileEntities to match Registrate workflow --- .../com/simibubi/create/AllTileEntities.java | 584 +++++++++++------- .../com/simibubi/create/CreateClient.java | 2 +- 2 files changed, 363 insertions(+), 223 deletions(-) diff --git a/src/main/java/com/simibubi/create/AllTileEntities.java b/src/main/java/com/simibubi/create/AllTileEntities.java index fde940f3d..0225deada 100644 --- a/src/main/java/com/simibubi/create/AllTileEntities.java +++ b/src/main/java/com/simibubi/create/AllTileEntities.java @@ -1,7 +1,5 @@ package com.simibubi.create; -import java.util.function.Function; - import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer; import com.simibubi.create.content.contraptions.components.actors.DrillRenderer; import com.simibubi.create.content.contraptions.components.actors.DrillTileEntity; @@ -49,7 +47,8 @@ import com.simibubi.create.content.contraptions.fluids.FluidTankRenderer; import com.simibubi.create.content.contraptions.fluids.FluidTankTileEntity; import com.simibubi.create.content.contraptions.fluids.PumpRenderer; import com.simibubi.create.content.contraptions.fluids.PumpTileEntity; -import com.simibubi.create.content.contraptions.processing.*; +import com.simibubi.create.content.contraptions.processing.BasinRenderer; +import com.simibubi.create.content.contraptions.processing.BasinTileEntity; import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerRenderer; import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerTileEntity; import com.simibubi.create.content.contraptions.relays.advanced.SpeedControllerRenderer; @@ -58,11 +57,7 @@ import com.simibubi.create.content.contraptions.relays.advanced.sequencer.Sequen import com.simibubi.create.content.contraptions.relays.belt.BeltRenderer; import com.simibubi.create.content.contraptions.relays.belt.BeltTileEntity; import com.simibubi.create.content.contraptions.relays.elementary.SimpleKineticTileEntity; -import com.simibubi.create.content.contraptions.relays.encased.AdjustablePulleyTileEntity; -import com.simibubi.create.content.contraptions.relays.encased.ClutchTileEntity; -import com.simibubi.create.content.contraptions.relays.encased.EncasedShaftRenderer; -import com.simibubi.create.content.contraptions.relays.encased.EncasedShaftTileEntity; -import com.simibubi.create.content.contraptions.relays.encased.SplitShaftRenderer; +import com.simibubi.create.content.contraptions.relays.encased.*; import com.simibubi.create.content.contraptions.relays.gauge.GaugeRenderer; import com.simibubi.create.content.contraptions.relays.gauge.SpeedGaugeTileEntity; import com.simibubi.create.content.contraptions.relays.gauge.StressGaugeTileEntity; @@ -91,12 +86,7 @@ import com.simibubi.create.content.logistics.block.mechanicalArm.ArmRenderer; import com.simibubi.create.content.logistics.block.mechanicalArm.ArmTileEntity; import com.simibubi.create.content.logistics.block.packager.PackagerRenderer; import com.simibubi.create.content.logistics.block.packager.PackagerTileEntity; -import com.simibubi.create.content.logistics.block.redstone.AnalogLeverRenderer; -import com.simibubi.create.content.logistics.block.redstone.AnalogLeverTileEntity; -import com.simibubi.create.content.logistics.block.redstone.NixieTubeRenderer; -import com.simibubi.create.content.logistics.block.redstone.NixieTubeTileEntity; -import com.simibubi.create.content.logistics.block.redstone.RedstoneLinkTileEntity; -import com.simibubi.create.content.logistics.block.redstone.StockpileSwitchTileEntity; +import com.simibubi.create.content.logistics.block.redstone.*; import com.simibubi.create.content.logistics.block.transposer.LinkedTransposerTileEntity; import com.simibubi.create.content.logistics.block.transposer.TransposerTileEntity; import com.simibubi.create.content.schematics.block.SchematicTableTileEntity; @@ -105,234 +95,384 @@ import com.simibubi.create.content.schematics.block.SchematicannonTileEntity; import com.simibubi.create.foundation.tileEntity.renderer.SmartTileEntityRenderer; import com.tterrag.registrate.util.entry.TileEntityEntry; import com.tterrag.registrate.util.nullness.NonNullFunction; -import com.tterrag.registrate.util.nullness.NonNullSupplier; - -import net.minecraft.block.Block; -import net.minecraft.client.renderer.tileentity.TileEntityRenderer; -import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; -import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityType; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.fml.client.registry.ClientRegistry; public class AllTileEntities { // Schematics - public static final TileEntityEntry SCHEMATICANNON = - register("schematicannon", SchematicannonTileEntity::new, AllBlocks.SCHEMATICANNON); - public static final TileEntityEntry SCHEMATIC_TABLE = - register("schematic_table", SchematicTableTileEntity::new, AllBlocks.SCHEMATIC_TABLE); + public static final TileEntityEntry SCHEMATICANNON = Create.registrate() + .tileEntity("schematicannon", (NonNullFunction, ? extends SchematicannonTileEntity>) SchematicannonTileEntity::new) + .validBlocks(AllBlocks.SCHEMATICANNON) + .renderer(() -> SchematicannonRenderer::new) + .register(); + + public static final TileEntityEntry SCHEMATIC_TABLE = Create.registrate() + .tileEntity("schematic_table", (NonNullFunction, ? extends SchematicTableTileEntity>) SchematicTableTileEntity::new) + .validBlocks(AllBlocks.SCHEMATIC_TABLE) + //.renderer(() -> renderer) + .register(); // Kinetics - public static final TileEntityEntry SIMPLE_KINETIC = - register("simple_kinetic", SimpleKineticTileEntity::new, AllBlocks.SHAFT, AllBlocks.COGWHEEL, - AllBlocks.LARGE_COGWHEEL, AllBlocks.ENCASED_SHAFT); - public static final TileEntityEntry MOTOR = - register("motor", CreativeMotorTileEntity::new, AllBlocks.CREATIVE_MOTOR); - public static final TileEntityEntry GEARBOX = - register("gearbox", GearboxTileEntity::new, AllBlocks.GEARBOX); - public static final TileEntityEntry ENCASED_SHAFT = - register("encased_shaft", EncasedShaftTileEntity::new, AllBlocks.ENCASED_SHAFT, AllBlocks.ENCASED_BELT); - public static final TileEntityEntry ADJUSTABLE_PULLEY = - register("adjustable_pulley", AdjustablePulleyTileEntity::new, AllBlocks.ADJUSTABLE_PULLEY); - public static final TileEntityEntry ENCASED_FAN = - register("encased_fan", EncasedFanTileEntity::new, AllBlocks.ENCASED_FAN); - public static final TileEntityEntry NOZZLE = - register("nozzle", NozzleTileEntity::new, AllBlocks.NOZZLE); - public static final TileEntityEntry CLUTCH = - register("clutch", ClutchTileEntity::new, AllBlocks.CLUTCH); - public static final TileEntityEntry GEARSHIFT = - register("gearshift", GearshiftTileEntity::new, AllBlocks.GEARSHIFT); - public static final TileEntityEntry TURNTABLE = - register("turntable", TurntableTileEntity::new, AllBlocks.TURNTABLE); - public static final TileEntityEntry HAND_CRANK = - register("hand_crank", HandCrankTileEntity::new, AllBlocks.HAND_CRANK); - public static final TileEntityEntry CUCKOO_CLOCK = - register("cuckoo_clock", CuckooClockTileEntity::new, AllBlocks.CUCKOO_CLOCK, AllBlocks.MYSTERIOUS_CUCKOO_CLOCK); + public static final TileEntityEntry SIMPLE_KINETIC = Create.registrate() + .tileEntity("simple_kinetic", (NonNullFunction, ? extends SimpleKineticTileEntity>) SimpleKineticTileEntity::new) + .validBlocks(AllBlocks.SHAFT, AllBlocks.COGWHEEL, AllBlocks.LARGE_COGWHEEL, AllBlocks.ENCASED_SHAFT) + .renderer(() -> KineticTileEntityRenderer::new) + .register(); - public static final TileEntityEntry MECHANICAL_PUMP = - register("mechanical_pump", PumpTileEntity::new, AllBlocks.MECHANICAL_PUMP); - public static final TileEntityEntry FLUID_TANK = - register("fluid_tank", FluidTankTileEntity::new, AllBlocks.FLUID_TANK); + public static final TileEntityEntry MOTOR = Create.registrate() + .tileEntity("motor", (NonNullFunction, ? extends CreativeMotorTileEntity>) CreativeMotorTileEntity::new) + .validBlocks(AllBlocks.CREATIVE_MOTOR) + .renderer(() -> CreativeMotorRenderer::new) + .register(); - public static final TileEntityEntry BELT = register("belt", BeltTileEntity::new, AllBlocks.BELT); - public static final TileEntityEntry CHUTE = - register("chute", ChuteTileEntity::new, AllBlocks.CHUTE); - public static final TileEntityEntry ANDESITE_TUNNEL = - register("andesite_tunnel", BeltTunnelTileEntity::new, AllBlocks.ANDESITE_TUNNEL); - public static final TileEntityEntry BRASS_TUNNEL = - register("brass_tunnel", BrassTunnelTileEntity::new, AllBlocks.BRASS_TUNNEL); - public static final TileEntityEntry MECHANICAL_ARM = - register("mechanical_arm", ArmTileEntity::new, AllBlocks.MECHANICAL_ARM); - public static final TileEntityEntry MECHANICAL_PISTON = register("mechanical_piston", - MechanicalPistonTileEntity::new, AllBlocks.MECHANICAL_PISTON, AllBlocks.STICKY_MECHANICAL_PISTON); - public static final TileEntityEntry MECHANICAL_BEARING = - register("mechanical_bearing", MechanicalBearingTileEntity::new, AllBlocks.MECHANICAL_BEARING); - public static final TileEntityEntry CLOCKWORK_BEARING = - register("clockwork_bearing", ClockworkBearingTileEntity::new, AllBlocks.CLOCKWORK_BEARING); - public static final TileEntityEntry ROPE_PULLEY = - register("rope_pulley", PulleyTileEntity::new, AllBlocks.ROPE_PULLEY); - public static final TileEntityEntry CHASSIS = register("chassis", ChassisTileEntity::new, - AllBlocks.RADIAL_CHASSIS, AllBlocks.LINEAR_CHASSIS, AllBlocks.SECONDARY_LINEAR_CHASSIS); - public static final TileEntityEntry DRILL = - register("drill", DrillTileEntity::new, AllBlocks.MECHANICAL_DRILL); - public static final TileEntityEntry SAW = - register("saw", SawTileEntity::new, AllBlocks.MECHANICAL_SAW); - public static final TileEntityEntry HARVESTER = - register("harvester", HarvesterTileEntity::new, AllBlocks.MECHANICAL_HARVESTER); - public static final TileEntityEntry FLYWHEEL = - register("flywheel", FlywheelTileEntity::new, AllBlocks.FLYWHEEL); - public static final TileEntityEntry FURNACE_ENGINE = - register("furnace_engine", FurnaceEngineTileEntity::new, AllBlocks.FURNACE_ENGINE); + public static final TileEntityEntry GEARBOX = Create.registrate() + .tileEntity("gearbox", (NonNullFunction, ? extends GearboxTileEntity>) GearboxTileEntity::new) + .validBlocks(AllBlocks.GEARBOX) + .renderer(() -> GearboxRenderer::new) + .register(); - public static final TileEntityEntry MILLSTONE = - register("millstone", MillstoneTileEntity::new, AllBlocks.MILLSTONE); - public static final TileEntityEntry CRUSHING_WHEEL = - register("crushing_wheel", CrushingWheelTileEntity::new, AllBlocks.CRUSHING_WHEEL); - public static final TileEntityEntry CRUSHING_WHEEL_CONTROLLER = register( - "crushing_wheel_controller", CrushingWheelControllerTileEntity::new, AllBlocks.CRUSHING_WHEEL_CONTROLLER); - public static final TileEntityEntry WATER_WHEEL = - register("water_wheel", WaterWheelTileEntity::new, AllBlocks.WATER_WHEEL); - public static final TileEntityEntry MECHANICAL_PRESS = - register("mechanical_press", MechanicalPressTileEntity::new, AllBlocks.MECHANICAL_PRESS); - public static final TileEntityEntry MECHANICAL_MIXER = - register("mechanical_mixer", MechanicalMixerTileEntity::new, AllBlocks.MECHANICAL_MIXER); - public static final TileEntityEntry DEPLOYER = - register("deployer", DeployerTileEntity::new, AllBlocks.DEPLOYER); - public static final TileEntityEntry BASIN = - register("basin", BasinTileEntity::new, AllBlocks.BASIN); - public static final TileEntityEntry HEATER = - register("blaze_heater", BlazeBurnerTileEntity::new, AllBlocks.BLAZE_BURNER); - public static final TileEntityEntry MECHANICAL_CRAFTER = - register("mechanical_crafter", MechanicalCrafterTileEntity::new, AllBlocks.MECHANICAL_CRAFTER); - public static final TileEntityEntry SEQUENCED_GEARSHIFT = - register("sequenced_gearshift", SequencedGearshiftTileEntity::new, AllBlocks.SEQUENCED_GEARSHIFT); - public static final TileEntityEntry ROTATION_SPEED_CONTROLLER = - register("rotation_speed_controller", SpeedControllerTileEntity::new, AllBlocks.ROTATION_SPEED_CONTROLLER); - public static final TileEntityEntry SPEEDOMETER = - register("speedometer", SpeedGaugeTileEntity::new, AllBlocks.SPEEDOMETER); - public static final TileEntityEntry STRESSOMETER = - register("stressometer", StressGaugeTileEntity::new, AllBlocks.STRESSOMETER); - public static final TileEntityEntry ANALOG_LEVER = - register("analog_lever", AnalogLeverTileEntity::new, AllBlocks.ANALOG_LEVER); - public static final TileEntityEntry CART_ASSEMBLER = - register("cart_assembler", CartAssemblerTileEntity::new, AllBlocks.CART_ASSEMBLER); + public static final TileEntityEntry ENCASED_SHAFT = Create.registrate() + .tileEntity("encased_shaft", (NonNullFunction, ? extends EncasedShaftTileEntity>) EncasedShaftTileEntity::new) + .validBlocks(AllBlocks.ENCASED_SHAFT, AllBlocks.ENCASED_BELT) + .renderer(() -> EncasedShaftRenderer::new) + .register(); + + public static final TileEntityEntry ADJUSTABLE_PULLEY = Create.registrate() + .tileEntity("adjustable_pulley", (NonNullFunction, ? extends AdjustablePulleyTileEntity>) AdjustablePulleyTileEntity::new) + .validBlocks(AllBlocks.ADJUSTABLE_PULLEY) + .renderer(() -> EncasedShaftRenderer::new) + .register(); + + public static final TileEntityEntry ENCASED_FAN = Create.registrate() + .tileEntity("encased_fan", (NonNullFunction, ? extends EncasedFanTileEntity>) EncasedFanTileEntity::new) + .validBlocks(AllBlocks.ENCASED_FAN) + .renderer(() -> EncasedFanRenderer::new) + .register(); + + public static final TileEntityEntry NOZZLE = Create.registrate() + .tileEntity("nozzle", (NonNullFunction, ? extends NozzleTileEntity>) NozzleTileEntity::new) + .validBlocks(AllBlocks.NOZZLE) + //.renderer(() -> renderer) + .register(); + + public static final TileEntityEntry CLUTCH = Create.registrate() + .tileEntity("clutch", (NonNullFunction, ? extends ClutchTileEntity>) ClutchTileEntity::new) + .validBlocks(AllBlocks.CLUTCH) + .renderer(() -> SplitShaftRenderer::new) + .register(); + + public static final TileEntityEntry GEARSHIFT = Create.registrate() + .tileEntity("gearshift", (NonNullFunction, ? extends GearshiftTileEntity>) GearshiftTileEntity::new) + .validBlocks(AllBlocks.GEARSHIFT) + .renderer(() -> SplitShaftRenderer::new) + .register(); + + public static final TileEntityEntry TURNTABLE = Create.registrate() + .tileEntity("turntable", (NonNullFunction, ? extends TurntableTileEntity>) TurntableTileEntity::new) + .validBlocks(AllBlocks.TURNTABLE) + .renderer(() -> KineticTileEntityRenderer::new) + .register(); + + public static final TileEntityEntry HAND_CRANK = Create.registrate() + .tileEntity("hand_crank", (NonNullFunction, ? extends HandCrankTileEntity>) HandCrankTileEntity::new) + .validBlocks(AllBlocks.HAND_CRANK) + .renderer(() -> HandCrankRenderer::new) + .register(); + + public static final TileEntityEntry CUCKOO_CLOCK = Create.registrate() + .tileEntity("cuckoo_clock", (NonNullFunction, ? extends CuckooClockTileEntity>) CuckooClockTileEntity::new) + .validBlocks(AllBlocks.CUCKOO_CLOCK, AllBlocks.MYSTERIOUS_CUCKOO_CLOCK) + .renderer(() -> CuckooClockRenderer::new) + .register(); + + public static final TileEntityEntry MECHANICAL_PUMP = Create.registrate() + .tileEntity("mechanical_pump", (NonNullFunction, ? extends PumpTileEntity>) PumpTileEntity::new) + .validBlocks(AllBlocks.MECHANICAL_PUMP) + .renderer(() -> PumpRenderer::new) + .register(); + + public static final TileEntityEntry FLUID_TANK = Create.registrate() + .tileEntity("fluid_tank", (NonNullFunction, ? extends FluidTankTileEntity>) FluidTankTileEntity::new) + .validBlocks(AllBlocks.FLUID_TANK) + .renderer(() -> FluidTankRenderer::new) + .register(); + + public static final TileEntityEntry BELT = Create.registrate() + .tileEntity("belt", (NonNullFunction, ? extends BeltTileEntity>) BeltTileEntity::new) + .validBlocks(AllBlocks.BELT) + .renderer(() -> BeltRenderer::new) + .register(); + + public static final TileEntityEntry CHUTE = Create.registrate() + .tileEntity("chute", (NonNullFunction, ? extends ChuteTileEntity>) ChuteTileEntity::new) + .validBlocks(AllBlocks.CHUTE) + .renderer(() -> ChuteRenderer::new) + .register(); + + public static final TileEntityEntry ANDESITE_TUNNEL = Create.registrate() + .tileEntity("andesite_tunnel", (NonNullFunction, ? extends BeltTunnelTileEntity>) BeltTunnelTileEntity::new) + .validBlocks(AllBlocks.ANDESITE_TUNNEL) + .renderer(() -> BeltTunnelRenderer::new) + .register(); + + public static final TileEntityEntry BRASS_TUNNEL = Create.registrate() + .tileEntity("brass_tunnel", (NonNullFunction, ? extends BrassTunnelTileEntity>) BrassTunnelTileEntity::new) + .validBlocks(AllBlocks.BRASS_TUNNEL) + .renderer(() -> BeltTunnelRenderer::new) + .register(); + + public static final TileEntityEntry MECHANICAL_ARM = Create.registrate() + .tileEntity("mechanical_arm", (NonNullFunction, ? extends ArmTileEntity>) ArmTileEntity::new) + .validBlocks(AllBlocks.MECHANICAL_ARM) + .renderer(() -> ArmRenderer::new) + .register(); + + public static final TileEntityEntry MECHANICAL_PISTON = Create.registrate() + .tileEntity("mechanical_piston", (NonNullFunction, ? extends MechanicalPistonTileEntity>) MechanicalPistonTileEntity::new) + .validBlocks(AllBlocks.MECHANICAL_PISTON, AllBlocks.STICKY_MECHANICAL_PISTON) + .renderer(() -> MechanicalPistonRenderer::new) + .register(); + + public static final TileEntityEntry MECHANICAL_BEARING = Create.registrate() + .tileEntity("mechanical_bearing", (NonNullFunction, ? extends MechanicalBearingTileEntity>) MechanicalBearingTileEntity::new) + .validBlocks(AllBlocks.MECHANICAL_BEARING) + .renderer(() -> BearingRenderer::new) + .register(); + + public static final TileEntityEntry CLOCKWORK_BEARING = Create.registrate() + .tileEntity("clockwork_bearing", (NonNullFunction, ? extends ClockworkBearingTileEntity>) ClockworkBearingTileEntity::new) + .validBlocks(AllBlocks.CLOCKWORK_BEARING) + .renderer(() -> BearingRenderer::new) + .register(); + + public static final TileEntityEntry ROPE_PULLEY = Create.registrate() + .tileEntity("rope_pulley", (NonNullFunction, ? extends PulleyTileEntity>) PulleyTileEntity::new) + .validBlocks(AllBlocks.ROPE_PULLEY) + .renderer(() -> PulleyRenderer::new) + .register(); + + public static final TileEntityEntry CHASSIS = Create.registrate() + .tileEntity("chassis", (NonNullFunction, ? extends ChassisTileEntity>) ChassisTileEntity::new) + .validBlocks(AllBlocks.RADIAL_CHASSIS, AllBlocks.LINEAR_CHASSIS, AllBlocks.SECONDARY_LINEAR_CHASSIS) + //.renderer(() -> renderer) + .register(); + + public static final TileEntityEntry DRILL = Create.registrate() + .tileEntity("drill", (NonNullFunction, ? extends DrillTileEntity>) DrillTileEntity::new) + .validBlocks(AllBlocks.MECHANICAL_DRILL) + .renderer(() -> DrillRenderer::new) + .register(); + + public static final TileEntityEntry SAW = Create.registrate() + .tileEntity("saw", (NonNullFunction, ? extends SawTileEntity>) SawTileEntity::new) + .validBlocks(AllBlocks.MECHANICAL_SAW) + .renderer(() -> SawRenderer::new) + .register(); + + public static final TileEntityEntry HARVESTER = Create.registrate() + .tileEntity("harvester", (NonNullFunction, ? extends HarvesterTileEntity>) HarvesterTileEntity::new) + .validBlocks(AllBlocks.MECHANICAL_HARVESTER) + .renderer(() -> HarvesterRenderer::new) + .register(); + + public static final TileEntityEntry FLYWHEEL = Create.registrate() + .tileEntity("flywheel", (NonNullFunction, ? extends FlywheelTileEntity>) FlywheelTileEntity::new) + .validBlocks(AllBlocks.FLYWHEEL) + .renderer(() -> FlywheelRenderer::new) + .register(); + + public static final TileEntityEntry FURNACE_ENGINE = Create.registrate() + .tileEntity("furnace_engine", (NonNullFunction, ? extends FurnaceEngineTileEntity>) FurnaceEngineTileEntity::new) + .validBlocks(AllBlocks.FURNACE_ENGINE) + .renderer(() -> EngineRenderer::new) + .register(); + + public static final TileEntityEntry MILLSTONE = Create.registrate() + .tileEntity("millstone", (NonNullFunction, ? extends MillstoneTileEntity>) MillstoneTileEntity::new) + .validBlocks(AllBlocks.MILLSTONE) + .renderer(() -> MillstoneRenderer::new) + .register(); + + public static final TileEntityEntry CRUSHING_WHEEL = Create.registrate() + .tileEntity("crushing_wheel", (NonNullFunction, ? extends CrushingWheelTileEntity>) CrushingWheelTileEntity::new) + .validBlocks(AllBlocks.CRUSHING_WHEEL) + .renderer(() -> KineticTileEntityRenderer::new) + .register(); + + public static final TileEntityEntry CRUSHING_WHEEL_CONTROLLER = Create.registrate() + .tileEntity("crushing_wheel_controller", (NonNullFunction, ? extends CrushingWheelControllerTileEntity>) CrushingWheelControllerTileEntity::new) + .validBlocks(AllBlocks.CRUSHING_WHEEL_CONTROLLER) + //.renderer(() -> renderer) + .register(); + + public static final TileEntityEntry WATER_WHEEL = Create.registrate() + .tileEntity("water_wheel", (NonNullFunction, ? extends WaterWheelTileEntity>) WaterWheelTileEntity::new) + .validBlocks(AllBlocks.WATER_WHEEL) + .renderer(() -> KineticTileEntityRenderer::new) + .register(); + + public static final TileEntityEntry MECHANICAL_PRESS = Create.registrate() + .tileEntity("mechanical_press", (NonNullFunction, ? extends MechanicalPressTileEntity>) MechanicalPressTileEntity::new) + .validBlocks(AllBlocks.MECHANICAL_PRESS) + .renderer(() -> MechanicalPressRenderer::new) + .register(); + + public static final TileEntityEntry MECHANICAL_MIXER = Create.registrate() + .tileEntity("mechanical_mixer", (NonNullFunction, ? extends MechanicalMixerTileEntity>) MechanicalMixerTileEntity::new) + .validBlocks(AllBlocks.MECHANICAL_MIXER) + .renderer(() -> MechanicalMixerRenderer::new) + .register(); + + public static final TileEntityEntry DEPLOYER = Create.registrate() + .tileEntity("deployer", (NonNullFunction, ? extends DeployerTileEntity>) DeployerTileEntity::new) + .validBlocks(AllBlocks.DEPLOYER) + .renderer(() -> DeployerRenderer::new) + .register(); + + public static final TileEntityEntry BASIN = Create.registrate() + .tileEntity("basin", (NonNullFunction, ? extends BasinTileEntity>) BasinTileEntity::new) + .validBlocks(AllBlocks.BASIN) + .renderer(() -> BasinRenderer::new) + .register(); + + public static final TileEntityEntry HEATER = Create.registrate() + .tileEntity("blaze_heater", (NonNullFunction, ? extends BlazeBurnerTileEntity>) BlazeBurnerTileEntity::new) + .validBlocks(AllBlocks.BLAZE_BURNER) + .renderer(() -> BlazeBurnerRenderer::new) + .register(); + + public static final TileEntityEntry MECHANICAL_CRAFTER = Create.registrate() + .tileEntity("mechanical_crafter", (NonNullFunction, ? extends MechanicalCrafterTileEntity>) MechanicalCrafterTileEntity::new) + .validBlocks(AllBlocks.MECHANICAL_CRAFTER) + .renderer(() -> MechanicalCrafterRenderer::new) + .register(); + + public static final TileEntityEntry SEQUENCED_GEARSHIFT = Create.registrate() + .tileEntity("sequenced_gearshift", (NonNullFunction, ? extends SequencedGearshiftTileEntity>) SequencedGearshiftTileEntity::new) + .validBlocks(AllBlocks.SEQUENCED_GEARSHIFT) + .renderer(() -> SplitShaftRenderer::new) + .register(); + + public static final TileEntityEntry ROTATION_SPEED_CONTROLLER = Create.registrate() + .tileEntity("rotation_speed_controller", (NonNullFunction, ? extends SpeedControllerTileEntity>) SpeedControllerTileEntity::new) + .validBlocks(AllBlocks.ROTATION_SPEED_CONTROLLER) + .renderer(() -> SpeedControllerRenderer::new) + .register(); + + public static final TileEntityEntry SPEEDOMETER = Create.registrate() + .tileEntity("speedometer", (NonNullFunction, ? extends SpeedGaugeTileEntity>) SpeedGaugeTileEntity::new) + .validBlocks(AllBlocks.SPEEDOMETER) + .renderer(() -> GaugeRenderer::speed) + .register(); + + public static final TileEntityEntry STRESSOMETER = Create.registrate() + .tileEntity("stressometer", (NonNullFunction, ? extends StressGaugeTileEntity>) StressGaugeTileEntity::new) + .validBlocks(AllBlocks.STRESSOMETER) + .renderer(() -> GaugeRenderer::stress) + .register(); + + public static final TileEntityEntry ANALOG_LEVER = Create.registrate() + .tileEntity("analog_lever", (NonNullFunction, ? extends AnalogLeverTileEntity>) AnalogLeverTileEntity::new) + .validBlocks(AllBlocks.ANALOG_LEVER) + .renderer(() -> AnalogLeverRenderer::new) + .register(); + + public static final TileEntityEntry CART_ASSEMBLER = Create.registrate() + .tileEntity("cart_assembler", (NonNullFunction, ? extends CartAssemblerTileEntity>) CartAssemblerTileEntity::new) + .validBlocks(AllBlocks.CART_ASSEMBLER) + //.renderer(() -> renderer) + .register(); // Logistics - public static final TileEntityEntry REDSTONE_LINK = - register("redstone_link", RedstoneLinkTileEntity::new, AllBlocks.REDSTONE_LINK); - public static final TileEntityEntry NIXIE_TUBE = - register("nixie_tube", NixieTubeTileEntity::new, AllBlocks.NIXIE_TUBE); - public static final TileEntityEntry STOCKPILE_SWITCH = - register("stockpile_switch", StockpileSwitchTileEntity::new, AllBlocks.STOCKPILE_SWITCH); - public static final TileEntityEntry ADJUSTABLE_CRATE = - register("adjustable_crate", AdjustableCrateTileEntity::new, AllBlocks.ADJUSTABLE_CRATE); - public static final TileEntityEntry CREATIVE_CRATE = - register("creative_crate", CreativeCrateTileEntity::new, AllBlocks.CREATIVE_CRATE); - - public static final TileEntityEntry DEPOT = - register("depot", DepotTileEntity::new, AllBlocks.DEPOT); - public static final TileEntityEntry FUNNEL = register("funnel", FunnelTileEntity::new, - AllBlocks.BRASS_FUNNEL, AllBlocks.BRASS_BELT_FUNNEL, AllBlocks.BRASS_CHUTE_FUNNEL, AllBlocks.ANDESITE_FUNNEL, - AllBlocks.ANDESITE_BELT_FUNNEL, AllBlocks.ANDESITE_CHUTE_FUNNEL); - public static final TileEntityEntry PACKAGER = - register("packager", PackagerTileEntity::new, AllBlocks.PACKAGER); - - public static final TileEntityEntry EXTRACTOR = - register("extractor", ExtractorTileEntity::new, AllBlocks.EXTRACTOR, AllBlocks.VERTICAL_EXTRACTOR); - public static final TileEntityEntry LINKED_EXTRACTOR = register("linked_extractor", - LinkedExtractorTileEntity::new, AllBlocks.LINKED_EXTRACTOR, AllBlocks.VERTICAL_LINKED_EXTRACTOR); - public static final TileEntityEntry TRANSPOSER = - register("transposer", TransposerTileEntity::new, AllBlocks.TRANSPOSER, AllBlocks.VERTICAL_TRANSPOSER); - public static final TileEntityEntry LINKED_TRANSPOSER = register("linked_transposer", - LinkedTransposerTileEntity::new, AllBlocks.LINKED_TRANSPOSER, AllBlocks.VERTICAL_LINKED_TRANSPOSER); - public static final TileEntityEntry BELT_OBSERVER = - register("belt_observer", BeltObserverTileEntity::new, AllBlocks.BELT_OBSERVER); - public static final TileEntityEntry ADJUSTABLE_REPEATER = - register("adjustable_repeater", AdjustableRepeaterTileEntity::new, AllBlocks.ADJUSTABLE_REPEATER); - public static final TileEntityEntry ADJUSTABLE_PULSE_REPEATER = register( - "adjustable_pulse_repeater", AdjustablePulseRepeaterTileEntity::new, AllBlocks.ADJUSTABLE_PULSE_REPEATER); - - @SafeVarargs - public static TileEntityEntry register(String name, - NonNullFunction, ? extends T> supplier, NonNullSupplier... blocks) { - return Create.registrate() - .tileEntity(name, supplier) - .validBlocks(blocks) + public static final TileEntityEntry REDSTONE_LINK = Create.registrate() + .tileEntity("redstone_link", (NonNullFunction, ? extends RedstoneLinkTileEntity>) RedstoneLinkTileEntity::new) + .validBlocks(AllBlocks.REDSTONE_LINK) + .renderer(() -> SmartTileEntityRenderer::new) .register(); - } - // TODO move to TileEntityBuilder#renderer - @OnlyIn(Dist.CLIENT) - public static void registerRenderers() { - bind(SCHEMATICANNON, SchematicannonRenderer::new); + public static final TileEntityEntry NIXIE_TUBE = Create.registrate() + .tileEntity("nixie_tube", (NonNullFunction, ? extends NixieTubeTileEntity>) NixieTubeTileEntity::new) + .validBlocks(AllBlocks.NIXIE_TUBE) + .renderer(() -> NixieTubeRenderer::new) + .register(); - bind(SIMPLE_KINETIC, KineticTileEntityRenderer::new); - bind(TURNTABLE, KineticTileEntityRenderer::new); - bind(MOTOR, CreativeMotorRenderer::new); - bind(ENCASED_SHAFT, EncasedShaftRenderer::new); - bind(ADJUSTABLE_PULLEY, EncasedShaftRenderer::new); - bind(DRILL, DrillRenderer::new); - bind(SAW, SawRenderer::new); - bind(ENCASED_FAN, EncasedFanRenderer::new); - bind(GEARBOX, GearboxRenderer::new); - bind(GEARSHIFT, SplitShaftRenderer::new); - bind(CLUTCH, SplitShaftRenderer::new); - bind(SEQUENCED_GEARSHIFT, SplitShaftRenderer::new); - bind(BELT, BeltRenderer::new); - bind(WATER_WHEEL, KineticTileEntityRenderer::new); - bind(HAND_CRANK, HandCrankRenderer::new); - bind(CUCKOO_CLOCK, CuckooClockRenderer::new); - bind(ANALOG_LEVER, AnalogLeverRenderer::new); + public static final TileEntityEntry STOCKPILE_SWITCH = Create.registrate() + .tileEntity("stockpile_switch", (NonNullFunction, ? extends StockpileSwitchTileEntity>) StockpileSwitchTileEntity::new) + .validBlocks(AllBlocks.STOCKPILE_SWITCH) + //.renderer(() -> renderer) + .register(); - bind(MECHANICAL_PUMP, PumpRenderer::new); - bind(FLUID_TANK, FluidTankRenderer::new); + public static final TileEntityEntry ADJUSTABLE_CRATE = Create.registrate() + .tileEntity("adjustable_crate", (NonNullFunction, ? extends AdjustableCrateTileEntity>) AdjustableCrateTileEntity::new) + .validBlocks(AllBlocks.ADJUSTABLE_CRATE) + //.renderer(() -> renderer) + .register(); - bind(MECHANICAL_PISTON, MechanicalPistonRenderer::new); - bind(MECHANICAL_BEARING, BearingRenderer::new); - bind(CLOCKWORK_BEARING, BearingRenderer::new); - bind(ROPE_PULLEY, PulleyRenderer::new); - bind(HARVESTER, HarvesterRenderer::new); + public static final TileEntityEntry CREATIVE_CRATE = Create.registrate() + .tileEntity("creative_crate", (NonNullFunction, ? extends CreativeCrateTileEntity>) CreativeCrateTileEntity::new) + .validBlocks(AllBlocks.CREATIVE_CRATE) + .renderer(() -> SmartTileEntityRenderer::new) + .register(); - bind(MILLSTONE, MillstoneRenderer::new); - bind(CRUSHING_WHEEL, KineticTileEntityRenderer::new); - bind(MECHANICAL_PRESS, MechanicalPressRenderer::new); - bind(MECHANICAL_MIXER, MechanicalMixerRenderer::new); - bind(MECHANICAL_CRAFTER, MechanicalCrafterRenderer::new); - bind(SPEEDOMETER, GaugeRenderer::speed); - bind(STRESSOMETER, GaugeRenderer::stress); - bind(BASIN, BasinRenderer::new); - bind(HEATER, BlazeBurnerRenderer::new); - bind(DEPLOYER, DeployerRenderer::new); - bind(FLYWHEEL, FlywheelRenderer::new); - bind(FURNACE_ENGINE, EngineRenderer::new); - bind(ROTATION_SPEED_CONTROLLER, SpeedControllerRenderer::new); - bind(PACKAGER, PackagerRenderer::new); - bind(DEPOT, DepotRenderer::new); - bind(CHUTE, ChuteRenderer::new); + public static final TileEntityEntry DEPOT = Create.registrate() + .tileEntity("depot", (NonNullFunction, ? extends DepotTileEntity>) DepotTileEntity::new) + .validBlocks(AllBlocks.DEPOT) + .renderer(() -> DepotRenderer::new) + .register(); - bind(CREATIVE_CRATE, SmartTileEntityRenderer::new); - bind(REDSTONE_LINK, SmartTileEntityRenderer::new); - bind(NIXIE_TUBE, NixieTubeRenderer::new); - bind(EXTRACTOR, SmartTileEntityRenderer::new); - bind(LINKED_EXTRACTOR, SmartTileEntityRenderer::new); - bind(TRANSPOSER, SmartTileEntityRenderer::new); - bind(LINKED_TRANSPOSER, SmartTileEntityRenderer::new); - bind(FUNNEL, FunnelRenderer::new); - bind(ANDESITE_TUNNEL, BeltTunnelRenderer::new); - bind(BRASS_TUNNEL, BeltTunnelRenderer::new); - bind(MECHANICAL_ARM, ArmRenderer::new); - bind(BELT_OBSERVER, BeltObserverRenderer::new); - bind(ADJUSTABLE_REPEATER, AdjustableRepeaterRenderer::new); - bind(ADJUSTABLE_PULSE_REPEATER, AdjustableRepeaterRenderer::new); - } + public static final TileEntityEntry FUNNEL = Create.registrate() + .tileEntity("funnel", (NonNullFunction, ? extends FunnelTileEntity>) FunnelTileEntity::new) + .validBlocks(AllBlocks.BRASS_FUNNEL, AllBlocks.BRASS_BELT_FUNNEL, AllBlocks.BRASS_CHUTE_FUNNEL, AllBlocks.ANDESITE_FUNNEL, AllBlocks.ANDESITE_BELT_FUNNEL, AllBlocks.ANDESITE_CHUTE_FUNNEL) + .renderer(() -> FunnelRenderer::new) + .register(); - @OnlyIn(Dist.CLIENT) - private static void bind(TileEntityEntry type, - Function> renderer) { - ClientRegistry.bindTileEntityRenderer(type.get(), renderer); - } + public static final TileEntityEntry PACKAGER = Create.registrate() + .tileEntity("packager", (NonNullFunction, ? extends PackagerTileEntity>) PackagerTileEntity::new) + .validBlocks(AllBlocks.PACKAGER) + .renderer(() -> PackagerRenderer::new) + .register(); + + public static final TileEntityEntry EXTRACTOR = Create.registrate() + .tileEntity("extractor", (NonNullFunction, ? extends ExtractorTileEntity>) ExtractorTileEntity::new) + .validBlocks(AllBlocks.EXTRACTOR, AllBlocks.VERTICAL_EXTRACTOR) + .renderer(() -> SmartTileEntityRenderer::new) + .register(); + + public static final TileEntityEntry LINKED_EXTRACTOR = Create.registrate() + .tileEntity("linked_extractor", (NonNullFunction, ? extends LinkedExtractorTileEntity>) LinkedExtractorTileEntity::new) + .validBlocks(AllBlocks.LINKED_EXTRACTOR, AllBlocks.VERTICAL_LINKED_EXTRACTOR) + .renderer(() -> SmartTileEntityRenderer::new) + .register(); + + public static final TileEntityEntry TRANSPOSER = Create.registrate() + .tileEntity("transposer", (NonNullFunction, ? extends TransposerTileEntity>) TransposerTileEntity::new) + .validBlocks(AllBlocks.TRANSPOSER, AllBlocks.VERTICAL_TRANSPOSER) + .renderer(() -> SmartTileEntityRenderer::new) + .register(); + + public static final TileEntityEntry LINKED_TRANSPOSER = Create.registrate() + .tileEntity("linked_transposer", (NonNullFunction, ? extends LinkedTransposerTileEntity>) LinkedTransposerTileEntity::new) + .validBlocks(AllBlocks.LINKED_TRANSPOSER, AllBlocks.VERTICAL_LINKED_TRANSPOSER) + .renderer(() -> SmartTileEntityRenderer::new) + .register(); + + public static final TileEntityEntry BELT_OBSERVER = Create.registrate() + .tileEntity("belt_observer", (NonNullFunction, ? extends BeltObserverTileEntity>) BeltObserverTileEntity::new) + .validBlocks(AllBlocks.BELT_OBSERVER) + .renderer(() -> BeltObserverRenderer::new) + .register(); + + public static final TileEntityEntry ADJUSTABLE_REPEATER = Create.registrate() + .tileEntity("adjustable_repeater", (NonNullFunction, ? extends AdjustableRepeaterTileEntity>) AdjustableRepeaterTileEntity::new) + .validBlocks(AllBlocks.ADJUSTABLE_REPEATER) + .renderer(() -> AdjustableRepeaterRenderer::new) + .register(); + + public static final TileEntityEntry ADJUSTABLE_PULSE_REPEATER = Create.registrate() + .tileEntity("adjustable_pulse_repeater", (NonNullFunction, ? extends AdjustablePulseRepeaterTileEntity>) AdjustablePulseRepeaterTileEntity::new) + .validBlocks(AllBlocks.ADJUSTABLE_PULSE_REPEATER) + .renderer(() -> AdjustableRepeaterRenderer::new) + .register(); public static void register() {} } diff --git a/src/main/java/com/simibubi/create/CreateClient.java b/src/main/java/com/simibubi/create/CreateClient.java index 5aa0e32d0..0892ba960 100644 --- a/src/main/java/com/simibubi/create/CreateClient.java +++ b/src/main/java/com/simibubi/create/CreateClient.java @@ -68,7 +68,7 @@ public class CreateClient { AllKeys.register(); AllContainerTypes.registerScreenFactories(); - AllTileEntities.registerRenderers(); + //AllTileEntities.registerRenderers(); AllEntityTypes.registerRenderers(); getColorHandler().init();