mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-10 20:11:35 +01:00
Merge branch 'mc1.15/dev' of https://github.com/Creators-of-Create/Create into mc1.15/dev
This commit is contained in:
commit
dac1cf0303
73 changed files with 558 additions and 406 deletions
|
@ -7,6 +7,7 @@ import com.simibubi.create.content.contraptions.components.clock.CuckooClockTile
|
||||||
import com.simibubi.create.content.contraptions.components.crafter.MechanicalCrafterInstance;
|
import com.simibubi.create.content.contraptions.components.crafter.MechanicalCrafterInstance;
|
||||||
import com.simibubi.create.content.contraptions.components.crafter.MechanicalCrafterRenderer;
|
import com.simibubi.create.content.contraptions.components.crafter.MechanicalCrafterRenderer;
|
||||||
import com.simibubi.create.content.contraptions.components.crafter.MechanicalCrafterTileEntity;
|
import com.simibubi.create.content.contraptions.components.crafter.MechanicalCrafterTileEntity;
|
||||||
|
import com.simibubi.create.content.contraptions.components.crank.HandCrankInstance;
|
||||||
import com.simibubi.create.content.contraptions.components.crank.HandCrankRenderer;
|
import com.simibubi.create.content.contraptions.components.crank.HandCrankRenderer;
|
||||||
import com.simibubi.create.content.contraptions.components.crank.HandCrankTileEntity;
|
import com.simibubi.create.content.contraptions.components.crank.HandCrankTileEntity;
|
||||||
import com.simibubi.create.content.contraptions.components.crusher.CrushingWheelControllerTileEntity;
|
import com.simibubi.create.content.contraptions.components.crusher.CrushingWheelControllerTileEntity;
|
||||||
|
@ -119,9 +120,9 @@ public class AllTileEntities {
|
||||||
// Schematics
|
// Schematics
|
||||||
public static final TileEntityEntry<SchematicannonTileEntity> SCHEMATICANNON = Create.registrate()
|
public static final TileEntityEntry<SchematicannonTileEntity> SCHEMATICANNON = Create.registrate()
|
||||||
.tileEntity("schematicannon", SchematicannonTileEntity::new)
|
.tileEntity("schematicannon", SchematicannonTileEntity::new)
|
||||||
|
.instance(() -> SchematicannonInstance::new)
|
||||||
.validBlocks(AllBlocks.SCHEMATICANNON)
|
.validBlocks(AllBlocks.SCHEMATICANNON)
|
||||||
.renderer(() -> SchematicannonRenderer::new)
|
.renderer(() -> SchematicannonRenderer::new)
|
||||||
.onRegister(SchematicannonInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<SchematicTableTileEntity> SCHEMATIC_TABLE = Create.registrate()
|
public static final TileEntityEntry<SchematicTableTileEntity> SCHEMATIC_TABLE = Create.registrate()
|
||||||
|
@ -132,44 +133,44 @@ public class AllTileEntities {
|
||||||
// Kinetics
|
// Kinetics
|
||||||
public static final TileEntityEntry<SimpleKineticTileEntity> SIMPLE_KINETIC = Create.registrate()
|
public static final TileEntityEntry<SimpleKineticTileEntity> SIMPLE_KINETIC = Create.registrate()
|
||||||
.tileEntity("simple_kinetic", SimpleKineticTileEntity::new)
|
.tileEntity("simple_kinetic", SimpleKineticTileEntity::new)
|
||||||
|
.instance(() -> SingleRotatingInstance::new)
|
||||||
.validBlocks(AllBlocks.SHAFT, AllBlocks.COGWHEEL, AllBlocks.LARGE_COGWHEEL)
|
.validBlocks(AllBlocks.SHAFT, AllBlocks.COGWHEEL, AllBlocks.LARGE_COGWHEEL)
|
||||||
.renderer(() -> KineticTileEntityRenderer::new)
|
.renderer(() -> KineticTileEntityRenderer::new)
|
||||||
.onRegister(SingleRotatingInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<CreativeMotorTileEntity> MOTOR = Create.registrate()
|
public static final TileEntityEntry<CreativeMotorTileEntity> MOTOR = Create.registrate()
|
||||||
.tileEntity("motor", CreativeMotorTileEntity::new)
|
.tileEntity("motor", CreativeMotorTileEntity::new)
|
||||||
|
.instance(() -> HalfShaftInstance::new)
|
||||||
.validBlocks(AllBlocks.CREATIVE_MOTOR)
|
.validBlocks(AllBlocks.CREATIVE_MOTOR)
|
||||||
.renderer(() -> CreativeMotorRenderer::new)
|
.renderer(() -> CreativeMotorRenderer::new)
|
||||||
.onRegister(HalfShaftInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<GearboxTileEntity> GEARBOX = Create.registrate()
|
public static final TileEntityEntry<GearboxTileEntity> GEARBOX = Create.registrate()
|
||||||
.tileEntity("gearbox", GearboxTileEntity::new)
|
.tileEntity("gearbox", GearboxTileEntity::new)
|
||||||
|
.instance(() -> GearboxInstance::new)
|
||||||
.validBlocks(AllBlocks.GEARBOX)
|
.validBlocks(AllBlocks.GEARBOX)
|
||||||
.renderer(() -> GearboxRenderer::new)
|
.renderer(() -> GearboxRenderer::new)
|
||||||
.onRegister(GearboxInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<EncasedShaftTileEntity> ENCASED_SHAFT = Create.registrate()
|
public static final TileEntityEntry<EncasedShaftTileEntity> ENCASED_SHAFT = Create.registrate()
|
||||||
.tileEntity("encased_shaft", EncasedShaftTileEntity::new)
|
.tileEntity("encased_shaft", EncasedShaftTileEntity::new)
|
||||||
|
.instance(() -> ShaftInstance::new)
|
||||||
.validBlocks(AllBlocks.ANDESITE_ENCASED_SHAFT, AllBlocks.BRASS_ENCASED_SHAFT, AllBlocks.ENCASED_CHAIN_DRIVE)
|
.validBlocks(AllBlocks.ANDESITE_ENCASED_SHAFT, AllBlocks.BRASS_ENCASED_SHAFT, AllBlocks.ENCASED_CHAIN_DRIVE)
|
||||||
.renderer(() -> EncasedShaftRenderer::new)
|
.renderer(() -> EncasedShaftRenderer::new)
|
||||||
.onRegister(ShaftInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<AdjustablePulleyTileEntity> ADJUSTABLE_PULLEY = Create.registrate()
|
public static final TileEntityEntry<AdjustablePulleyTileEntity> ADJUSTABLE_PULLEY = Create.registrate()
|
||||||
.tileEntity("adjustable_pulley", AdjustablePulleyTileEntity::new)
|
.tileEntity("adjustable_pulley", AdjustablePulleyTileEntity::new)
|
||||||
|
.instance(() -> ShaftInstance::new)
|
||||||
.validBlocks(AllBlocks.ADJUSTABLE_CHAIN_GEARSHIFT)
|
.validBlocks(AllBlocks.ADJUSTABLE_CHAIN_GEARSHIFT)
|
||||||
.renderer(() -> EncasedShaftRenderer::new)
|
.renderer(() -> EncasedShaftRenderer::new)
|
||||||
.onRegister(ShaftInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<EncasedFanTileEntity> ENCASED_FAN = Create.registrate()
|
public static final TileEntityEntry<EncasedFanTileEntity> ENCASED_FAN = Create.registrate()
|
||||||
.tileEntity("encased_fan", EncasedFanTileEntity::new)
|
.tileEntity("encased_fan", EncasedFanTileEntity::new)
|
||||||
|
.instance(() -> FanInstance::new)
|
||||||
.validBlocks(AllBlocks.ENCASED_FAN)
|
.validBlocks(AllBlocks.ENCASED_FAN)
|
||||||
.renderer(() -> EncasedFanRenderer::new)
|
.renderer(() -> EncasedFanRenderer::new)
|
||||||
.onRegister(FanInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<NozzleTileEntity> NOZZLE = Create.registrate()
|
public static final TileEntityEntry<NozzleTileEntity> NOZZLE = Create.registrate()
|
||||||
|
@ -180,59 +181,59 @@ public class AllTileEntities {
|
||||||
|
|
||||||
public static final TileEntityEntry<ClutchTileEntity> CLUTCH = Create.registrate()
|
public static final TileEntityEntry<ClutchTileEntity> CLUTCH = Create.registrate()
|
||||||
.tileEntity("clutch", ClutchTileEntity::new)
|
.tileEntity("clutch", ClutchTileEntity::new)
|
||||||
|
.instance(() -> SplitShaftInstance::new)
|
||||||
.validBlocks(AllBlocks.CLUTCH)
|
.validBlocks(AllBlocks.CLUTCH)
|
||||||
.renderer(() -> SplitShaftRenderer::new)
|
.renderer(() -> SplitShaftRenderer::new)
|
||||||
.onRegister(SplitShaftInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<GearshiftTileEntity> GEARSHIFT = Create.registrate()
|
public static final TileEntityEntry<GearshiftTileEntity> GEARSHIFT = Create.registrate()
|
||||||
.tileEntity("gearshift", GearshiftTileEntity::new)
|
.tileEntity("gearshift", GearshiftTileEntity::new)
|
||||||
|
.instance(() -> SplitShaftInstance::new)
|
||||||
.validBlocks(AllBlocks.GEARSHIFT)
|
.validBlocks(AllBlocks.GEARSHIFT)
|
||||||
.renderer(() -> SplitShaftRenderer::new)
|
.renderer(() -> SplitShaftRenderer::new)
|
||||||
.onRegister(SplitShaftInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<TurntableTileEntity> TURNTABLE = Create.registrate()
|
public static final TileEntityEntry<TurntableTileEntity> TURNTABLE = Create.registrate()
|
||||||
.tileEntity("turntable", TurntableTileEntity::new)
|
.tileEntity("turntable", TurntableTileEntity::new)
|
||||||
|
.instance(() -> SingleRotatingInstance::new)
|
||||||
.validBlocks(AllBlocks.TURNTABLE)
|
.validBlocks(AllBlocks.TURNTABLE)
|
||||||
.renderer(() -> KineticTileEntityRenderer::new)
|
.renderer(() -> KineticTileEntityRenderer::new)
|
||||||
.onRegister(SingleRotatingInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<HandCrankTileEntity> HAND_CRANK = Create.registrate()
|
public static final TileEntityEntry<HandCrankTileEntity> HAND_CRANK = Create.registrate()
|
||||||
.tileEntity("hand_crank", HandCrankTileEntity::new)
|
.tileEntity("hand_crank", HandCrankTileEntity::new)
|
||||||
|
.instance(() -> HandCrankInstance::new)
|
||||||
.validBlocks(AllBlocks.HAND_CRANK, AllBlocks.COPPER_VALVE_HANDLE)
|
.validBlocks(AllBlocks.HAND_CRANK, AllBlocks.COPPER_VALVE_HANDLE)
|
||||||
.validBlocks(AllBlocks.DYED_VALVE_HANDLES)
|
.validBlocks(AllBlocks.DYED_VALVE_HANDLES)
|
||||||
.renderer(() -> HandCrankRenderer::new)
|
.renderer(() -> HandCrankRenderer::new)
|
||||||
.onRegister(SingleRotatingInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<CuckooClockTileEntity> CUCKOO_CLOCK = Create.registrate()
|
public static final TileEntityEntry<CuckooClockTileEntity> CUCKOO_CLOCK = Create.registrate()
|
||||||
.tileEntity("cuckoo_clock", CuckooClockTileEntity::new)
|
.tileEntity("cuckoo_clock", CuckooClockTileEntity::new)
|
||||||
|
.instance(() -> HorizontalHalfShaftInstance::new)
|
||||||
.validBlocks(AllBlocks.CUCKOO_CLOCK, AllBlocks.MYSTERIOUS_CUCKOO_CLOCK)
|
.validBlocks(AllBlocks.CUCKOO_CLOCK, AllBlocks.MYSTERIOUS_CUCKOO_CLOCK)
|
||||||
.renderer(() -> CuckooClockRenderer::new)
|
.renderer(() -> CuckooClockRenderer::new)
|
||||||
.onRegister(HorizontalHalfShaftInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<GantryShaftTileEntity> GANTRY_SHAFT = Create.registrate()
|
public static final TileEntityEntry<GantryShaftTileEntity> GANTRY_SHAFT = Create.registrate()
|
||||||
.tileEntity("gantry_shaft", GantryShaftTileEntity::new)
|
.tileEntity("gantry_shaft", GantryShaftTileEntity::new)
|
||||||
|
.instance(() -> SingleRotatingInstance::new)
|
||||||
.validBlocks(AllBlocks.GANTRY_SHAFT)
|
.validBlocks(AllBlocks.GANTRY_SHAFT)
|
||||||
.renderer(() -> KineticTileEntityRenderer::new)
|
.renderer(() -> KineticTileEntityRenderer::new)
|
||||||
.onRegister(SingleRotatingInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<GantryCarriageTileEntity> GANTRY_PINION = Create.registrate()
|
public static final TileEntityEntry<GantryCarriageTileEntity> GANTRY_PINION = Create.registrate()
|
||||||
.tileEntity("gantry_pinion", GantryCarriageTileEntity::new)
|
.tileEntity("gantry_pinion", GantryCarriageTileEntity::new)
|
||||||
|
.instance(() -> GantryCarriageInstance::new)
|
||||||
.validBlocks(AllBlocks.GANTRY_CARRIAGE)
|
.validBlocks(AllBlocks.GANTRY_CARRIAGE)
|
||||||
.renderer(() -> GantryCarriageRenderer::new)
|
.renderer(() -> GantryCarriageRenderer::new)
|
||||||
.onRegister(GantryCarriageInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<PumpTileEntity> MECHANICAL_PUMP = Create.registrate()
|
public static final TileEntityEntry<PumpTileEntity> MECHANICAL_PUMP = Create.registrate()
|
||||||
.tileEntity("mechanical_pump", PumpTileEntity::new)
|
.tileEntity("mechanical_pump", PumpTileEntity::new)
|
||||||
|
.instance(() -> PumpCogInstance::new)
|
||||||
.validBlocks(AllBlocks.MECHANICAL_PUMP)
|
.validBlocks(AllBlocks.MECHANICAL_PUMP)
|
||||||
.renderer(() -> PumpRenderer::new)
|
.renderer(() -> PumpRenderer::new)
|
||||||
.onRegister(PumpCogInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<SmartFluidPipeTileEntity> SMART_FLUID_PIPE = Create.registrate()
|
public static final TileEntityEntry<SmartFluidPipeTileEntity> SMART_FLUID_PIPE = Create.registrate()
|
||||||
|
@ -259,9 +260,9 @@ public class AllTileEntities {
|
||||||
|
|
||||||
public static final TileEntityEntry<FluidValveTileEntity> FLUID_VALVE = Create.registrate()
|
public static final TileEntityEntry<FluidValveTileEntity> FLUID_VALVE = Create.registrate()
|
||||||
.tileEntity("fluid_valve", FluidValveTileEntity::new)
|
.tileEntity("fluid_valve", FluidValveTileEntity::new)
|
||||||
|
.instance(() -> ShaftInstance::new)
|
||||||
.validBlocks(AllBlocks.FLUID_VALVE)
|
.validBlocks(AllBlocks.FLUID_VALVE)
|
||||||
.renderer(() -> FluidValveRenderer::new)
|
.renderer(() -> FluidValveRenderer::new)
|
||||||
.onRegister(ShaftInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<FluidTankTileEntity> FLUID_TANK = Create.registrate()
|
public static final TileEntityEntry<FluidTankTileEntity> FLUID_TANK = Create.registrate()
|
||||||
|
@ -278,9 +279,9 @@ public class AllTileEntities {
|
||||||
|
|
||||||
public static final TileEntityEntry<HosePulleyTileEntity> HOSE_PULLEY = Create.registrate()
|
public static final TileEntityEntry<HosePulleyTileEntity> HOSE_PULLEY = Create.registrate()
|
||||||
.tileEntity("hose_pulley", HosePulleyTileEntity::new)
|
.tileEntity("hose_pulley", HosePulleyTileEntity::new)
|
||||||
|
.instance(() -> ShaftInstance::new)
|
||||||
.validBlocks(AllBlocks.HOSE_PULLEY)
|
.validBlocks(AllBlocks.HOSE_PULLEY)
|
||||||
.renderer(() -> HosePulleyRenderer::new)
|
.renderer(() -> HosePulleyRenderer::new)
|
||||||
.onRegister(ShaftInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<SpoutTileEntity> SPOUT = Create.registrate()
|
public static final TileEntityEntry<SpoutTileEntity> SPOUT = Create.registrate()
|
||||||
|
@ -297,9 +298,9 @@ public class AllTileEntities {
|
||||||
|
|
||||||
public static final TileEntityEntry<BeltTileEntity> BELT = Create.registrate()
|
public static final TileEntityEntry<BeltTileEntity> BELT = Create.registrate()
|
||||||
.tileEntity("belt", BeltTileEntity::new)
|
.tileEntity("belt", BeltTileEntity::new)
|
||||||
|
.instance(() -> BeltInstance::new)
|
||||||
.validBlocks(AllBlocks.BELT)
|
.validBlocks(AllBlocks.BELT)
|
||||||
.renderer(() -> BeltRenderer::new)
|
.renderer(() -> BeltRenderer::new)
|
||||||
.onRegister(BeltInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<ChuteTileEntity> CHUTE = Create.registrate()
|
public static final TileEntityEntry<ChuteTileEntity> CHUTE = Create.registrate()
|
||||||
|
@ -316,58 +317,58 @@ public class AllTileEntities {
|
||||||
|
|
||||||
public static final TileEntityEntry<BeltTunnelTileEntity> ANDESITE_TUNNEL = Create.registrate()
|
public static final TileEntityEntry<BeltTunnelTileEntity> ANDESITE_TUNNEL = Create.registrate()
|
||||||
.tileEntity("andesite_tunnel", BeltTunnelTileEntity::new)
|
.tileEntity("andesite_tunnel", BeltTunnelTileEntity::new)
|
||||||
|
.instance(() -> BeltTunnelInstance::new)
|
||||||
.validBlocks(AllBlocks.ANDESITE_TUNNEL)
|
.validBlocks(AllBlocks.ANDESITE_TUNNEL)
|
||||||
.renderer(() -> BeltTunnelRenderer::new)
|
.renderer(() -> BeltTunnelRenderer::new)
|
||||||
.onRegister(BeltTunnelInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<BrassTunnelTileEntity> BRASS_TUNNEL = Create.registrate()
|
public static final TileEntityEntry<BrassTunnelTileEntity> BRASS_TUNNEL = Create.registrate()
|
||||||
.tileEntity("brass_tunnel", BrassTunnelTileEntity::new)
|
.tileEntity("brass_tunnel", BrassTunnelTileEntity::new)
|
||||||
|
.instance(() -> BeltTunnelInstance::new)
|
||||||
.validBlocks(AllBlocks.BRASS_TUNNEL)
|
.validBlocks(AllBlocks.BRASS_TUNNEL)
|
||||||
.renderer(() -> BeltTunnelRenderer::new)
|
.renderer(() -> BeltTunnelRenderer::new)
|
||||||
.onRegister(BeltTunnelInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<ArmTileEntity> MECHANICAL_ARM = Create.registrate()
|
public static final TileEntityEntry<ArmTileEntity> MECHANICAL_ARM = Create.registrate()
|
||||||
.tileEntity("mechanical_arm", ArmTileEntity::new)
|
.tileEntity("mechanical_arm", ArmTileEntity::new)
|
||||||
|
.instance(() -> ArmInstance::new)
|
||||||
.validBlocks(AllBlocks.MECHANICAL_ARM)
|
.validBlocks(AllBlocks.MECHANICAL_ARM)
|
||||||
.renderer(() -> ArmRenderer::new)
|
.renderer(() -> ArmRenderer::new)
|
||||||
.onRegister((type) -> DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> ArmInstance.register(type)))//ArmInstance line 142 -> Minecraft.getInstance().world causes ClientWorld to get loaded on the server
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<MechanicalPistonTileEntity> MECHANICAL_PISTON = Create.registrate()
|
public static final TileEntityEntry<MechanicalPistonTileEntity> MECHANICAL_PISTON = Create.registrate()
|
||||||
.tileEntity("mechanical_piston", MechanicalPistonTileEntity::new)
|
.tileEntity("mechanical_piston", MechanicalPistonTileEntity::new)
|
||||||
|
.instance(() -> ShaftInstance::new)
|
||||||
.validBlocks(AllBlocks.MECHANICAL_PISTON, AllBlocks.STICKY_MECHANICAL_PISTON)
|
.validBlocks(AllBlocks.MECHANICAL_PISTON, AllBlocks.STICKY_MECHANICAL_PISTON)
|
||||||
.renderer(() -> MechanicalPistonRenderer::new)
|
.renderer(() -> MechanicalPistonRenderer::new)
|
||||||
.onRegister(ShaftInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<WindmillBearingTileEntity> WINDMILL_BEARING = Create.registrate()
|
public static final TileEntityEntry<WindmillBearingTileEntity> WINDMILL_BEARING = Create.registrate()
|
||||||
.tileEntity("windmill_bearing", WindmillBearingTileEntity::new)
|
.tileEntity("windmill_bearing", WindmillBearingTileEntity::new)
|
||||||
|
.instance(() -> BackHalfShaftInstance::new)
|
||||||
.validBlocks(AllBlocks.WINDMILL_BEARING)
|
.validBlocks(AllBlocks.WINDMILL_BEARING)
|
||||||
.renderer(() -> BearingRenderer::new)
|
.renderer(() -> BearingRenderer::new)
|
||||||
.onRegister(BackHalfShaftInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<MechanicalBearingTileEntity> MECHANICAL_BEARING = Create.registrate()
|
public static final TileEntityEntry<MechanicalBearingTileEntity> MECHANICAL_BEARING = Create.registrate()
|
||||||
.tileEntity("mechanical_bearing", MechanicalBearingTileEntity::new)
|
.tileEntity("mechanical_bearing", MechanicalBearingTileEntity::new)
|
||||||
|
.instance(() -> BackHalfShaftInstance::new)
|
||||||
.validBlocks(AllBlocks.MECHANICAL_BEARING)
|
.validBlocks(AllBlocks.MECHANICAL_BEARING)
|
||||||
.renderer(() -> BearingRenderer::new)
|
.renderer(() -> BearingRenderer::new)
|
||||||
.onRegister(BackHalfShaftInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<ClockworkBearingTileEntity> CLOCKWORK_BEARING = Create.registrate()
|
public static final TileEntityEntry<ClockworkBearingTileEntity> CLOCKWORK_BEARING = Create.registrate()
|
||||||
.tileEntity("clockwork_bearing", ClockworkBearingTileEntity::new)
|
.tileEntity("clockwork_bearing", ClockworkBearingTileEntity::new)
|
||||||
|
.instance(() -> BackHalfShaftInstance::new)
|
||||||
.validBlocks(AllBlocks.CLOCKWORK_BEARING)
|
.validBlocks(AllBlocks.CLOCKWORK_BEARING)
|
||||||
.renderer(() -> BearingRenderer::new)
|
.renderer(() -> BearingRenderer::new)
|
||||||
.onRegister(BackHalfShaftInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<PulleyTileEntity> ROPE_PULLEY = Create.registrate()
|
public static final TileEntityEntry<PulleyTileEntity> ROPE_PULLEY = Create.registrate()
|
||||||
.tileEntity("rope_pulley", PulleyTileEntity::new)
|
.tileEntity("rope_pulley", PulleyTileEntity::new)
|
||||||
|
.instance(() -> ShaftInstance::new)
|
||||||
.validBlocks(AllBlocks.ROPE_PULLEY)
|
.validBlocks(AllBlocks.ROPE_PULLEY)
|
||||||
.renderer(() -> PulleyRenderer::new)
|
.renderer(() -> PulleyRenderer::new)
|
||||||
.onRegister(ShaftInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<ChassisTileEntity> CHASSIS = Create.registrate()
|
public static final TileEntityEntry<ChassisTileEntity> CHASSIS = Create.registrate()
|
||||||
|
@ -378,23 +379,23 @@ public class AllTileEntities {
|
||||||
|
|
||||||
public static final TileEntityEntry<StickerTileEntity> STICKER = Create.registrate()
|
public static final TileEntityEntry<StickerTileEntity> STICKER = Create.registrate()
|
||||||
.tileEntity("sticker", StickerTileEntity::new)
|
.tileEntity("sticker", StickerTileEntity::new)
|
||||||
|
.instance(() -> StickerInstance::new)
|
||||||
.validBlocks(AllBlocks.STICKER)
|
.validBlocks(AllBlocks.STICKER)
|
||||||
.renderer(() -> StickerRenderer::new)
|
.renderer(() -> StickerRenderer::new)
|
||||||
.onRegister(StickerInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<DrillTileEntity> DRILL = Create.registrate()
|
public static final TileEntityEntry<DrillTileEntity> DRILL = Create.registrate()
|
||||||
.tileEntity("drill", DrillTileEntity::new)
|
.tileEntity("drill", DrillTileEntity::new)
|
||||||
|
.instance(() -> DrillInstance::new)
|
||||||
.validBlocks(AllBlocks.MECHANICAL_DRILL)
|
.validBlocks(AllBlocks.MECHANICAL_DRILL)
|
||||||
.renderer(() -> DrillRenderer::new)
|
.renderer(() -> DrillRenderer::new)
|
||||||
.onRegister(DrillInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<SawTileEntity> SAW = Create.registrate()
|
public static final TileEntityEntry<SawTileEntity> SAW = Create.registrate()
|
||||||
.tileEntity("saw", SawTileEntity::new)
|
.tileEntity("saw", SawTileEntity::new)
|
||||||
|
.instance(() -> SawInstance::new)
|
||||||
.validBlocks(AllBlocks.MECHANICAL_SAW)
|
.validBlocks(AllBlocks.MECHANICAL_SAW)
|
||||||
.renderer(() -> SawRenderer::new)
|
.renderer(() -> SawRenderer::new)
|
||||||
.onRegister(SawInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<HarvesterTileEntity> HARVESTER = Create.registrate()
|
public static final TileEntityEntry<HarvesterTileEntity> HARVESTER = Create.registrate()
|
||||||
|
@ -418,30 +419,30 @@ public class AllTileEntities {
|
||||||
|
|
||||||
public static final TileEntityEntry<FlywheelTileEntity> FLYWHEEL = Create.registrate()
|
public static final TileEntityEntry<FlywheelTileEntity> FLYWHEEL = Create.registrate()
|
||||||
.tileEntity("flywheel", FlywheelTileEntity::new)
|
.tileEntity("flywheel", FlywheelTileEntity::new)
|
||||||
|
.instance(() -> FlyWheelInstance::new)
|
||||||
.validBlocks(AllBlocks.FLYWHEEL)
|
.validBlocks(AllBlocks.FLYWHEEL)
|
||||||
.renderer(() -> FlywheelRenderer::new)
|
.renderer(() -> FlywheelRenderer::new)
|
||||||
.onRegister(FlyWheelInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<FurnaceEngineTileEntity> FURNACE_ENGINE = Create.registrate()
|
public static final TileEntityEntry<FurnaceEngineTileEntity> FURNACE_ENGINE = Create.registrate()
|
||||||
.tileEntity("furnace_engine", FurnaceEngineTileEntity::new)
|
.tileEntity("furnace_engine", FurnaceEngineTileEntity::new)
|
||||||
|
.instance(() -> EngineInstance::new)
|
||||||
.validBlocks(AllBlocks.FURNACE_ENGINE)
|
.validBlocks(AllBlocks.FURNACE_ENGINE)
|
||||||
.renderer(() -> EngineRenderer::new)
|
.renderer(() -> EngineRenderer::new)
|
||||||
.onRegister(EngineInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<MillstoneTileEntity> MILLSTONE = Create.registrate()
|
public static final TileEntityEntry<MillstoneTileEntity> MILLSTONE = Create.registrate()
|
||||||
.tileEntity("millstone", MillstoneTileEntity::new)
|
.tileEntity("millstone", MillstoneTileEntity::new)
|
||||||
|
.instance(() -> MillStoneCogInstance::new)
|
||||||
.validBlocks(AllBlocks.MILLSTONE)
|
.validBlocks(AllBlocks.MILLSTONE)
|
||||||
.renderer(() -> MillstoneRenderer::new)
|
.renderer(() -> MillstoneRenderer::new)
|
||||||
.onRegister(MillStoneCogInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<CrushingWheelTileEntity> CRUSHING_WHEEL = Create.registrate()
|
public static final TileEntityEntry<CrushingWheelTileEntity> CRUSHING_WHEEL = Create.registrate()
|
||||||
.tileEntity("crushing_wheel", CrushingWheelTileEntity::new)
|
.tileEntity("crushing_wheel", CrushingWheelTileEntity::new)
|
||||||
|
.instance(() -> SingleRotatingInstance::new)
|
||||||
.validBlocks(AllBlocks.CRUSHING_WHEEL)
|
.validBlocks(AllBlocks.CRUSHING_WHEEL)
|
||||||
.renderer(() -> KineticTileEntityRenderer::new)
|
.renderer(() -> KineticTileEntityRenderer::new)
|
||||||
.onRegister(SingleRotatingInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<CrushingWheelControllerTileEntity> CRUSHING_WHEEL_CONTROLLER =
|
public static final TileEntityEntry<CrushingWheelControllerTileEntity> CRUSHING_WHEEL_CONTROLLER =
|
||||||
|
@ -453,30 +454,30 @@ public class AllTileEntities {
|
||||||
|
|
||||||
public static final TileEntityEntry<WaterWheelTileEntity> WATER_WHEEL = Create.registrate()
|
public static final TileEntityEntry<WaterWheelTileEntity> WATER_WHEEL = Create.registrate()
|
||||||
.tileEntity("water_wheel", WaterWheelTileEntity::new)
|
.tileEntity("water_wheel", WaterWheelTileEntity::new)
|
||||||
|
.instance(() -> SingleRotatingInstance::new)
|
||||||
.validBlocks(AllBlocks.WATER_WHEEL)
|
.validBlocks(AllBlocks.WATER_WHEEL)
|
||||||
.renderer(() -> KineticTileEntityRenderer::new)
|
.renderer(() -> KineticTileEntityRenderer::new)
|
||||||
.onRegister(SingleRotatingInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<MechanicalPressTileEntity> MECHANICAL_PRESS = Create.registrate()
|
public static final TileEntityEntry<MechanicalPressTileEntity> MECHANICAL_PRESS = Create.registrate()
|
||||||
.tileEntity("mechanical_press", MechanicalPressTileEntity::new)
|
.tileEntity("mechanical_press", MechanicalPressTileEntity::new)
|
||||||
|
.instance(() -> PressInstance::new)
|
||||||
.validBlocks(AllBlocks.MECHANICAL_PRESS)
|
.validBlocks(AllBlocks.MECHANICAL_PRESS)
|
||||||
.renderer(() -> MechanicalPressRenderer::new)
|
.renderer(() -> MechanicalPressRenderer::new)
|
||||||
.onRegister(PressInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<MechanicalMixerTileEntity> MECHANICAL_MIXER = Create.registrate()
|
public static final TileEntityEntry<MechanicalMixerTileEntity> MECHANICAL_MIXER = Create.registrate()
|
||||||
.tileEntity("mechanical_mixer", MechanicalMixerTileEntity::new)
|
.tileEntity("mechanical_mixer", MechanicalMixerTileEntity::new)
|
||||||
|
.instance(() -> MixerInstance::new)
|
||||||
.validBlocks(AllBlocks.MECHANICAL_MIXER)
|
.validBlocks(AllBlocks.MECHANICAL_MIXER)
|
||||||
.renderer(() -> MechanicalMixerRenderer::new)
|
.renderer(() -> MechanicalMixerRenderer::new)
|
||||||
.onRegister(MixerInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<DeployerTileEntity> DEPLOYER = Create.registrate()
|
public static final TileEntityEntry<DeployerTileEntity> DEPLOYER = Create.registrate()
|
||||||
.tileEntity("deployer", DeployerTileEntity::new)
|
.tileEntity("deployer", DeployerTileEntity::new)
|
||||||
|
.instance(() -> ShaftInstance::new)
|
||||||
.validBlocks(AllBlocks.DEPLOYER)
|
.validBlocks(AllBlocks.DEPLOYER)
|
||||||
.renderer(() -> DeployerRenderer::new)
|
.renderer(() -> DeployerRenderer::new)
|
||||||
.onRegister(ShaftInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<BasinTileEntity> BASIN = Create.registrate()
|
public static final TileEntityEntry<BasinTileEntity> BASIN = Create.registrate()
|
||||||
|
@ -493,41 +494,42 @@ public class AllTileEntities {
|
||||||
|
|
||||||
public static final TileEntityEntry<MechanicalCrafterTileEntity> MECHANICAL_CRAFTER = Create.registrate()
|
public static final TileEntityEntry<MechanicalCrafterTileEntity> MECHANICAL_CRAFTER = Create.registrate()
|
||||||
.tileEntity("mechanical_crafter", MechanicalCrafterTileEntity::new)
|
.tileEntity("mechanical_crafter", MechanicalCrafterTileEntity::new)
|
||||||
|
.instance(() -> MechanicalCrafterInstance::new)
|
||||||
.validBlocks(AllBlocks.MECHANICAL_CRAFTER)
|
.validBlocks(AllBlocks.MECHANICAL_CRAFTER)
|
||||||
.renderer(() -> MechanicalCrafterRenderer::new)
|
.renderer(() -> MechanicalCrafterRenderer::new)
|
||||||
.onRegister(MechanicalCrafterInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<SequencedGearshiftTileEntity> SEQUENCED_GEARSHIFT = Create.registrate()
|
public static final TileEntityEntry<SequencedGearshiftTileEntity> SEQUENCED_GEARSHIFT = Create.registrate()
|
||||||
.tileEntity("sequenced_gearshift", SequencedGearshiftTileEntity::new)
|
.tileEntity("sequenced_gearshift", SequencedGearshiftTileEntity::new)
|
||||||
|
.instance(() -> SplitShaftInstance::new)
|
||||||
.validBlocks(AllBlocks.SEQUENCED_GEARSHIFT)
|
.validBlocks(AllBlocks.SEQUENCED_GEARSHIFT)
|
||||||
.renderer(() -> SplitShaftRenderer::new)
|
.renderer(() -> SplitShaftRenderer::new)
|
||||||
.onRegister(SplitShaftInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<SpeedControllerTileEntity> ROTATION_SPEED_CONTROLLER = Create.registrate()
|
public static final TileEntityEntry<SpeedControllerTileEntity> ROTATION_SPEED_CONTROLLER = Create.registrate()
|
||||||
.tileEntity("rotation_speed_controller", SpeedControllerTileEntity::new)
|
.tileEntity("rotation_speed_controller", SpeedControllerTileEntity::new)
|
||||||
|
.instance(() -> ShaftInstance::new)
|
||||||
.validBlocks(AllBlocks.ROTATION_SPEED_CONTROLLER)
|
.validBlocks(AllBlocks.ROTATION_SPEED_CONTROLLER)
|
||||||
.renderer(() -> SpeedControllerRenderer::new)
|
.renderer(() -> SpeedControllerRenderer::new)
|
||||||
.onRegister(ShaftInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<SpeedGaugeTileEntity> SPEEDOMETER = Create.registrate()
|
public static final TileEntityEntry<SpeedGaugeTileEntity> SPEEDOMETER = Create.registrate()
|
||||||
.tileEntity("speedometer", SpeedGaugeTileEntity::new)
|
.tileEntity("speedometer", SpeedGaugeTileEntity::new)
|
||||||
|
.instance(() -> ShaftInstance::new)
|
||||||
.validBlocks(AllBlocks.SPEEDOMETER)
|
.validBlocks(AllBlocks.SPEEDOMETER)
|
||||||
.renderer(() -> GaugeRenderer::speed)
|
.renderer(() -> GaugeRenderer::speed)
|
||||||
.onRegister(ShaftInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<StressGaugeTileEntity> STRESSOMETER = Create.registrate()
|
public static final TileEntityEntry<StressGaugeTileEntity> STRESSOMETER = Create.registrate()
|
||||||
.tileEntity("stressometer", StressGaugeTileEntity::new)
|
.tileEntity("stressometer", StressGaugeTileEntity::new)
|
||||||
|
.instance(() -> ShaftInstance::new)
|
||||||
.validBlocks(AllBlocks.STRESSOMETER)
|
.validBlocks(AllBlocks.STRESSOMETER)
|
||||||
.renderer(() -> GaugeRenderer::stress)
|
.renderer(() -> GaugeRenderer::stress)
|
||||||
.onRegister(ShaftInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<AnalogLeverTileEntity> ANALOG_LEVER = Create.registrate()
|
public static final TileEntityEntry<AnalogLeverTileEntity> ANALOG_LEVER = Create.registrate()
|
||||||
.tileEntity("analog_lever", AnalogLeverTileEntity::new)
|
.tileEntity("analog_lever", AnalogLeverTileEntity::new)
|
||||||
|
.instance(() -> AnalogLeverInstance::new)
|
||||||
.validBlocks(AllBlocks.ANALOG_LEVER)
|
.validBlocks(AllBlocks.ANALOG_LEVER)
|
||||||
.renderer(() -> AnalogLeverRenderer::new)
|
.renderer(() -> AnalogLeverRenderer::new)
|
||||||
.register();
|
.register();
|
||||||
|
@ -577,10 +579,10 @@ public class AllTileEntities {
|
||||||
|
|
||||||
public static final TileEntityEntry<FunnelTileEntity> FUNNEL = Create.registrate()
|
public static final TileEntityEntry<FunnelTileEntity> FUNNEL = Create.registrate()
|
||||||
.tileEntity("funnel", FunnelTileEntity::new)
|
.tileEntity("funnel", FunnelTileEntity::new)
|
||||||
|
.instance(() -> FunnelInstance::new)
|
||||||
.validBlocks(AllBlocks.BRASS_FUNNEL, AllBlocks.BRASS_BELT_FUNNEL, AllBlocks.ANDESITE_FUNNEL,
|
.validBlocks(AllBlocks.BRASS_FUNNEL, AllBlocks.BRASS_BELT_FUNNEL, AllBlocks.ANDESITE_FUNNEL,
|
||||||
AllBlocks.ANDESITE_BELT_FUNNEL)
|
AllBlocks.ANDESITE_BELT_FUNNEL)
|
||||||
.renderer(() -> FunnelRenderer::new)
|
.renderer(() -> FunnelRenderer::new)
|
||||||
.onRegister(FunnelInstance::register)
|
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
public static final TileEntityEntry<ContentObserverTileEntity> CONTENT_OBSERVER = Create.registrate()
|
public static final TileEntityEntry<ContentObserverTileEntity> CONTENT_OBSERVER = Create.registrate()
|
||||||
|
|
|
@ -10,11 +10,6 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.DistExecutor;
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
|
|
||||||
public class BackHalfShaftInstance extends HalfShaftInstance {
|
public class BackHalfShaftInstance extends HalfShaftInstance {
|
||||||
public static void register(TileEntityType<? extends KineticTileEntity> type) {
|
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () ->
|
|
||||||
InstancedTileRenderRegistry.instance.register(type, BackHalfShaftInstance::new));
|
|
||||||
}
|
|
||||||
|
|
||||||
public BackHalfShaftInstance(InstancedTileRenderer<?> modelManager, KineticTileEntity tile) {
|
public BackHalfShaftInstance(InstancedTileRenderer<?> modelManager, KineticTileEntity tile) {
|
||||||
super(modelManager, tile);
|
super(modelManager, tile);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,11 +12,6 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.DistExecutor;
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
|
|
||||||
public class HalfShaftInstance extends SingleRotatingInstance {
|
public class HalfShaftInstance extends SingleRotatingInstance {
|
||||||
public static void register(TileEntityType<? extends KineticTileEntity> type) {
|
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () ->
|
|
||||||
InstancedTileRenderRegistry.instance.register(type, HalfShaftInstance::new));
|
|
||||||
}
|
|
||||||
|
|
||||||
public HalfShaftInstance(InstancedTileRenderer<?> modelManager, KineticTileEntity tile) {
|
public HalfShaftInstance(InstancedTileRenderer<?> modelManager, KineticTileEntity tile) {
|
||||||
super(modelManager, tile);
|
super(modelManager, tile);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,10 +10,6 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.DistExecutor;
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
|
|
||||||
public class HorizontalHalfShaftInstance extends HalfShaftInstance {
|
public class HorizontalHalfShaftInstance extends HalfShaftInstance {
|
||||||
public static void register(TileEntityType<? extends KineticTileEntity> type) {
|
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () ->
|
|
||||||
InstancedTileRenderRegistry.instance.register(type, HorizontalHalfShaftInstance::new));
|
|
||||||
}
|
|
||||||
|
|
||||||
public HorizontalHalfShaftInstance(InstancedTileRenderer<?> modelManager, KineticTileEntity tile) {
|
public HorizontalHalfShaftInstance(InstancedTileRenderer<?> modelManager, KineticTileEntity tile) {
|
||||||
super(modelManager, tile);
|
super(modelManager, tile);
|
||||||
|
|
|
@ -80,9 +80,6 @@ public abstract class KineticTileEntity extends SmartTileEntity
|
||||||
}
|
}
|
||||||
|
|
||||||
super.initialize();
|
super.initialize();
|
||||||
|
|
||||||
if (world != null && world.isRemote)
|
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> CreateClient.kineticRenderer.add(this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -551,11 +548,6 @@ public abstract class KineticTileEntity extends SmartTileEntity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onChunkLightUpdate() {
|
|
||||||
CreateClient.kineticRenderer.onLightUpdate(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected AxisAlignedBB cachedBoundingBox;
|
protected AxisAlignedBB cachedBoundingBox;
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public AxisAlignedBB getRenderBoundingBox() {
|
public AxisAlignedBB getRenderBoundingBox() {
|
||||||
|
|
|
@ -10,10 +10,6 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.DistExecutor;
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
|
|
||||||
public class ShaftlessCogInstance extends SingleRotatingInstance {
|
public class ShaftlessCogInstance extends SingleRotatingInstance {
|
||||||
public static void register(TileEntityType<? extends KineticTileEntity> type) {
|
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () ->
|
|
||||||
InstancedTileRenderRegistry.instance.register(type, ShaftlessCogInstance::new));
|
|
||||||
}
|
|
||||||
|
|
||||||
public ShaftlessCogInstance(InstancedTileRenderer<?> modelManager, KineticTileEntity tile) {
|
public ShaftlessCogInstance(InstancedTileRenderer<?> modelManager, KineticTileEntity tile) {
|
||||||
super(modelManager, tile);
|
super(modelManager, tile);
|
||||||
|
|
|
@ -14,10 +14,6 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.DistExecutor;
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
|
|
||||||
public class SingleRotatingInstance extends KineticTileInstance<KineticTileEntity> {
|
public class SingleRotatingInstance extends KineticTileInstance<KineticTileEntity> {
|
||||||
public static void register(TileEntityType<? extends KineticTileEntity> type) {
|
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () ->
|
|
||||||
InstancedTileRenderRegistry.instance.register(type, SingleRotatingInstance::new));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected InstanceKey<RotatingData> rotatingModelKey;
|
protected InstanceKey<RotatingData> rotatingModelKey;
|
||||||
|
|
||||||
|
|
|
@ -17,9 +17,6 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.DistExecutor;
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
|
|
||||||
public class DrillInstance extends SingleRotatingInstance {
|
public class DrillInstance extends SingleRotatingInstance {
|
||||||
public static void register(TileEntityType<? extends KineticTileEntity> type) {
|
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () ->
|
|
||||||
InstancedTileRenderRegistry.instance.register(type, DrillInstance::new)); }
|
|
||||||
|
|
||||||
public DrillInstance(InstancedTileRenderer<?> modelManager, KineticTileEntity tile) {
|
public DrillInstance(InstancedTileRenderer<?> modelManager, KineticTileEntity tile) {
|
||||||
super(modelManager, tile);
|
super(modelManager, tile);
|
||||||
|
|
|
@ -6,7 +6,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Con
|
||||||
import com.simibubi.create.foundation.config.AllConfigs;
|
import com.simibubi.create.foundation.config.AllConfigs;
|
||||||
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
||||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||||
import com.simibubi.create.foundation.utility.LerpedFloat;
|
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
|
|
|
@ -18,10 +18,6 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.DistExecutor;
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
|
|
||||||
public class MechanicalCrafterInstance extends SingleRotatingInstance {
|
public class MechanicalCrafterInstance extends SingleRotatingInstance {
|
||||||
public static void register(TileEntityType<? extends KineticTileEntity> type) {
|
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () ->
|
|
||||||
InstancedTileRenderRegistry.instance.register(type, MechanicalCrafterInstance::new));
|
|
||||||
}
|
|
||||||
|
|
||||||
public MechanicalCrafterInstance(InstancedTileRenderer<?> modelManager, KineticTileEntity tile) {
|
public MechanicalCrafterInstance(InstancedTileRenderer<?> modelManager, KineticTileEntity tile) {
|
||||||
super(modelManager, tile);
|
super(modelManager, tile);
|
||||||
|
|
|
@ -0,0 +1,78 @@
|
||||||
|
package com.simibubi.create.content.contraptions.components.crank;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
|
import com.simibubi.create.AllBlockPartials;
|
||||||
|
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||||
|
import com.simibubi.create.content.contraptions.base.SingleRotatingInstance;
|
||||||
|
import com.simibubi.create.content.logistics.block.redstone.AnalogLeverInstance;
|
||||||
|
import com.simibubi.create.content.logistics.block.redstone.AnalogLeverTileEntity;
|
||||||
|
import com.simibubi.create.foundation.render.backend.RenderMaterials;
|
||||||
|
import com.simibubi.create.foundation.render.backend.instancing.*;
|
||||||
|
import com.simibubi.create.foundation.render.backend.instancing.impl.ModelData;
|
||||||
|
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||||
|
import com.simibubi.create.foundation.utility.MatrixStacker;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.state.properties.BlockStateProperties;
|
||||||
|
import net.minecraft.tileentity.TileEntityType;
|
||||||
|
import net.minecraft.util.Direction;
|
||||||
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
|
|
||||||
|
public class HandCrankInstance extends SingleRotatingInstance implements ITickableInstance {
|
||||||
|
|
||||||
|
private InstanceKey<ModelData> crank;
|
||||||
|
private Direction facing;
|
||||||
|
|
||||||
|
public HandCrankInstance(InstancedTileRenderer<?> modelManager, KineticTileEntity tile) {
|
||||||
|
super(modelManager, tile);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void init() {
|
||||||
|
super.init();
|
||||||
|
|
||||||
|
Block block = lastState.getBlock();
|
||||||
|
AllBlockPartials renderedHandle = null;
|
||||||
|
if (block instanceof HandCrankBlock)
|
||||||
|
renderedHandle = ((HandCrankBlock) block).getRenderedHandle();
|
||||||
|
if (renderedHandle == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
facing = lastState.get(BlockStateProperties.FACING);
|
||||||
|
InstancedModel<ModelData> model = renderedHandle.renderOnDirectionalSouthModel(modelManager, lastState, facing.getOpposite());
|
||||||
|
crank = model.createInstance();
|
||||||
|
|
||||||
|
updateLight();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tick() {
|
||||||
|
if (crank == null) return;
|
||||||
|
|
||||||
|
HandCrankTileEntity crankTile = (HandCrankTileEntity) tile;
|
||||||
|
|
||||||
|
Direction.Axis axis = facing.getAxis();
|
||||||
|
float angle = (crankTile.independentAngle + AnimationTickHolder.getPartialTicks() * crankTile.chasingVelocity) / 360;
|
||||||
|
|
||||||
|
MatrixStack ms = new MatrixStack();
|
||||||
|
MatrixStacker.of(ms)
|
||||||
|
.translate(getFloatingPos())
|
||||||
|
.centre()
|
||||||
|
.rotate(Direction.getFacingFromAxis(Direction.AxisDirection.POSITIVE, axis), angle)
|
||||||
|
.unCentre();
|
||||||
|
|
||||||
|
crank.getInstance().setTransformNoCopy(ms);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void remove() {
|
||||||
|
super.remove();
|
||||||
|
if (crank != null) crank.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateLight() {
|
||||||
|
super.updateLight();
|
||||||
|
if (crank != null) relight(pos, crank.getInstance());
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,6 +8,7 @@ import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||||
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||||
|
|
||||||
|
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
|
@ -26,6 +27,8 @@ public class HandCrankRenderer extends KineticTileEntityRenderer {
|
||||||
int light, int overlay) {
|
int light, int overlay) {
|
||||||
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
||||||
|
|
||||||
|
if (FastRenderDispatcher.available(te.getWorld())) return;
|
||||||
|
|
||||||
BlockState state = te.getBlockState();
|
BlockState state = te.getBlockState();
|
||||||
Block block = state.getBlock();
|
Block block = state.getBlock();
|
||||||
AllBlockPartials renderedHandle = null;
|
AllBlockPartials renderedHandle = null;
|
||||||
|
|
|
@ -20,10 +20,6 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.DistExecutor;
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
|
|
||||||
public class FanInstance extends KineticTileInstance<EncasedFanTileEntity> {
|
public class FanInstance extends KineticTileInstance<EncasedFanTileEntity> {
|
||||||
public static void register(TileEntityType<? extends EncasedFanTileEntity> type) {
|
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () ->
|
|
||||||
InstancedTileRenderRegistry.instance.register(type, FanInstance::new));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected InstanceKey<RotatingData> shaft;
|
protected InstanceKey<RotatingData> shaft;
|
||||||
protected InstanceKey<RotatingData> fan;
|
protected InstanceKey<RotatingData> fan;
|
||||||
|
|
|
@ -30,10 +30,6 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.DistExecutor;
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
|
|
||||||
public class FlyWheelInstance extends KineticTileInstance<FlywheelTileEntity> implements ITickableInstance {
|
public class FlyWheelInstance extends KineticTileInstance<FlywheelTileEntity> implements ITickableInstance {
|
||||||
public static void register(TileEntityType<? extends FlywheelTileEntity> type) {
|
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () ->
|
|
||||||
InstancedTileRenderRegistry.instance.register(type, FlyWheelInstance::new));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Direction facing;
|
protected Direction facing;
|
||||||
protected boolean connectedLeft;
|
protected boolean connectedLeft;
|
||||||
|
|
|
@ -20,10 +20,6 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.DistExecutor;
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
|
|
||||||
public class EngineInstance extends TileEntityInstance<EngineTileEntity> {
|
public class EngineInstance extends TileEntityInstance<EngineTileEntity> {
|
||||||
public static void register(TileEntityType<? extends EngineTileEntity> type) {
|
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () ->
|
|
||||||
InstancedTileRenderRegistry.instance.register(type, EngineInstance::new));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected InstanceKey<ModelData> frame;
|
protected InstanceKey<ModelData> frame;
|
||||||
|
|
||||||
|
|
|
@ -104,16 +104,4 @@ public class EngineTileEntity extends SmartTileEntity implements IInstanceRender
|
||||||
poweredWheel.setRotation(appliedSpeed, appliedCapacity);
|
poweredWheel.setRotation(appliedSpeed, appliedCapacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onChunkLightUpdate() {
|
|
||||||
CreateClient.kineticRenderer.onLightUpdate(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initialize() {
|
|
||||||
super.initialize();
|
|
||||||
|
|
||||||
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> CreateClient.kineticRenderer.add(this));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,9 +13,6 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.DistExecutor;
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
|
|
||||||
public class MillStoneCogInstance extends SingleRotatingInstance {
|
public class MillStoneCogInstance extends SingleRotatingInstance {
|
||||||
public static void register(TileEntityType<? extends KineticTileEntity> type) {
|
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () ->
|
|
||||||
InstancedTileRenderRegistry.instance.register(type, MillStoneCogInstance::new)); }
|
|
||||||
|
|
||||||
public MillStoneCogInstance(InstancedTileRenderer<?> modelManager, KineticTileEntity tile) {
|
public MillStoneCogInstance(InstancedTileRenderer<?> modelManager, KineticTileEntity tile) {
|
||||||
super(modelManager, tile);
|
super(modelManager, tile);
|
||||||
|
|
|
@ -21,10 +21,6 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.DistExecutor;
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
|
|
||||||
public class MixerInstance extends ShaftlessCogInstance implements ITickableInstance {
|
public class MixerInstance extends ShaftlessCogInstance implements ITickableInstance {
|
||||||
public static void register(TileEntityType<? extends KineticTileEntity> type) {
|
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () ->
|
|
||||||
InstancedTileRenderRegistry.instance.register(type, MixerInstance::new));
|
|
||||||
}
|
|
||||||
|
|
||||||
private InstanceKey<RotatingData> mixerHead;
|
private InstanceKey<RotatingData> mixerHead;
|
||||||
private InstanceKey<ModelData> mixerPole;
|
private InstanceKey<ModelData> mixerPole;
|
||||||
|
|
|
@ -18,10 +18,6 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.DistExecutor;
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
|
|
||||||
public class PressInstance extends ShaftInstance implements ITickableInstance {
|
public class PressInstance extends ShaftInstance implements ITickableInstance {
|
||||||
public static void register(TileEntityType<? extends KineticTileEntity> type) {
|
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () ->
|
|
||||||
InstancedTileRenderRegistry.instance.register(type, PressInstance::new));
|
|
||||||
}
|
|
||||||
|
|
||||||
private InstanceKey<ModelData> pressHead;
|
private InstanceKey<ModelData> pressHead;
|
||||||
|
|
||||||
|
|
|
@ -17,10 +17,6 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.DistExecutor;
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
|
|
||||||
public class SawInstance extends SingleRotatingInstance {
|
public class SawInstance extends SingleRotatingInstance {
|
||||||
public static void register(TileEntityType<? extends KineticTileEntity> type) {
|
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () ->
|
|
||||||
InstancedTileRenderRegistry.instance.register(type, SawInstance::new));
|
|
||||||
}
|
|
||||||
|
|
||||||
public SawInstance(InstancedTileRenderer<?> modelManager, KineticTileEntity tile) {
|
public SawInstance(InstancedTileRenderer<?> modelManager, KineticTileEntity tile) {
|
||||||
super(modelManager, tile);
|
super(modelManager, tile);
|
||||||
|
|
|
@ -16,10 +16,6 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.DistExecutor;
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
|
|
||||||
public class StickerInstance extends TileEntityInstance<StickerTileEntity> implements ITickableInstance {
|
public class StickerInstance extends TileEntityInstance<StickerTileEntity> implements ITickableInstance {
|
||||||
public static void register(TileEntityType<? extends StickerTileEntity> type) {
|
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () ->
|
|
||||||
InstancedTileRenderRegistry.instance.register(type, StickerInstance::new));
|
|
||||||
}
|
|
||||||
|
|
||||||
float lastOffset = Float.NaN;
|
float lastOffset = Float.NaN;
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,8 @@ import com.simibubi.create.content.contraptions.components.structureMovement.glu
|
||||||
import com.simibubi.create.foundation.render.backend.instancing.IInstanceRendered;
|
import com.simibubi.create.foundation.render.backend.instancing.IInstanceRendered;
|
||||||
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
||||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||||
import com.simibubi.create.foundation.utility.LerpedFloat;
|
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||||
import com.simibubi.create.foundation.utility.LerpedFloat.Chaser;
|
import com.simibubi.create.foundation.utility.animation.LerpedFloat.Chaser;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
@ -43,7 +43,6 @@ public class StickerTileEntity extends SmartTileEntity implements IInstanceRende
|
||||||
if (!world.isRemote)
|
if (!world.isRemote)
|
||||||
return;
|
return;
|
||||||
piston.startWithValue(isBlockStateExtended() ? 1 : 0);
|
piston.startWithValue(isBlockStateExtended() ? 1 : 0);
|
||||||
CreateClient.kineticRenderer.add(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBlockStateExtended() {
|
public boolean isBlockStateExtended() {
|
||||||
|
@ -94,8 +93,4 @@ public class StickerTileEntity extends SmartTileEntity implements IInstanceRende
|
||||||
0.35F, attach ? 0.75F : 0.2f);
|
0.35F, attach ? 0.75F : 0.2f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onChunkLightUpdate() {
|
|
||||||
CreateClient.kineticRenderer.onLightUpdate(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,10 +23,6 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.DistExecutor;
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
|
|
||||||
public class GantryCarriageInstance extends ShaftInstance implements ITickableInstance {
|
public class GantryCarriageInstance extends ShaftInstance implements ITickableInstance {
|
||||||
public static void register(TileEntityType<? extends KineticTileEntity> type) {
|
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () ->
|
|
||||||
InstancedTileRenderRegistry.instance.register(type, GantryCarriageInstance::new));
|
|
||||||
}
|
|
||||||
|
|
||||||
private InstanceKey<ModelData> gantryCogs;
|
private InstanceKey<ModelData> gantryCogs;
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||||
import com.simibubi.create.foundation.utility.BlockFace;
|
import com.simibubi.create.foundation.utility.BlockFace;
|
||||||
import com.simibubi.create.foundation.utility.Couple;
|
import com.simibubi.create.foundation.utility.Couple;
|
||||||
import com.simibubi.create.foundation.utility.Iterate;
|
import com.simibubi.create.foundation.utility.Iterate;
|
||||||
import com.simibubi.create.foundation.utility.LerpedFloat;
|
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||||
import com.simibubi.create.foundation.utility.VecHelper;
|
import com.simibubi.create.foundation.utility.VecHelper;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
|
|
@ -13,10 +13,6 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.DistExecutor;
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
|
|
||||||
public class PumpCogInstance extends SingleRotatingInstance {
|
public class PumpCogInstance extends SingleRotatingInstance {
|
||||||
public static void register(TileEntityType<? extends KineticTileEntity> type) {
|
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () ->
|
|
||||||
InstancedTileRenderRegistry.instance.register(type, PumpCogInstance::new));
|
|
||||||
}
|
|
||||||
|
|
||||||
public PumpCogInstance(InstancedTileRenderer<?> modelManager, KineticTileEntity tile) {
|
public PumpCogInstance(InstancedTileRenderer<?> modelManager, KineticTileEntity tile) {
|
||||||
super(modelManager, tile);
|
super(modelManager, tile);
|
||||||
|
|
|
@ -19,8 +19,8 @@ import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||||
import com.simibubi.create.foundation.utility.BlockFace;
|
import com.simibubi.create.foundation.utility.BlockFace;
|
||||||
import com.simibubi.create.foundation.utility.Couple;
|
import com.simibubi.create.foundation.utility.Couple;
|
||||||
import com.simibubi.create.foundation.utility.Iterate;
|
import com.simibubi.create.foundation.utility.Iterate;
|
||||||
import com.simibubi.create.foundation.utility.LerpedFloat;
|
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||||
import com.simibubi.create.foundation.utility.LerpedFloat.Chaser;
|
import com.simibubi.create.foundation.utility.animation.LerpedFloat.Chaser;
|
||||||
import com.simibubi.create.foundation.utility.Pair;
|
import com.simibubi.create.foundation.utility.Pair;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
|
|
@ -6,7 +6,7 @@ import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||||
import com.simibubi.create.foundation.fluid.SmartFluidTank;
|
import com.simibubi.create.foundation.fluid.SmartFluidTank;
|
||||||
import com.simibubi.create.foundation.item.TooltipHelper;
|
import com.simibubi.create.foundation.item.TooltipHelper;
|
||||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||||
import com.simibubi.create.foundation.utility.LerpedFloat;
|
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||||
import com.simibubi.create.foundation.utility.ServerSpeedProvider;
|
import com.simibubi.create.foundation.utility.ServerSpeedProvider;
|
||||||
|
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
|
|
|
@ -6,8 +6,8 @@ import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||||
import com.simibubi.create.content.contraptions.fluids.pipes.StraightPipeTileEntity.StraightPipeFluidTransportBehaviour;
|
import com.simibubi.create.content.contraptions.fluids.pipes.StraightPipeTileEntity.StraightPipeFluidTransportBehaviour;
|
||||||
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
||||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||||
import com.simibubi.create.foundation.utility.LerpedFloat;
|
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||||
import com.simibubi.create.foundation.utility.LerpedFloat.Chaser;
|
import com.simibubi.create.foundation.utility.animation.LerpedFloat.Chaser;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
|
|
|
@ -7,7 +7,7 @@ import com.simibubi.create.foundation.fluid.FluidRenderer;
|
||||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||||
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
|
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
|
||||||
import com.simibubi.create.foundation.utility.Iterate;
|
import com.simibubi.create.foundation.utility.Iterate;
|
||||||
import com.simibubi.create.foundation.utility.LerpedFloat;
|
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||||
|
|
|
@ -30,8 +30,8 @@ import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||||
import com.simibubi.create.foundation.utility.Couple;
|
import com.simibubi.create.foundation.utility.Couple;
|
||||||
import com.simibubi.create.foundation.utility.IntAttached;
|
import com.simibubi.create.foundation.utility.IntAttached;
|
||||||
import com.simibubi.create.foundation.utility.Iterate;
|
import com.simibubi.create.foundation.utility.Iterate;
|
||||||
import com.simibubi.create.foundation.utility.LerpedFloat;
|
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||||
import com.simibubi.create.foundation.utility.LerpedFloat.Chaser;
|
import com.simibubi.create.foundation.utility.animation.LerpedFloat.Chaser;
|
||||||
import com.simibubi.create.foundation.utility.NBTHelper;
|
import com.simibubi.create.foundation.utility.NBTHelper;
|
||||||
import com.simibubi.create.foundation.utility.VecHelper;
|
import com.simibubi.create.foundation.utility.VecHelper;
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,8 @@ import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
||||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||||
import com.simibubi.create.foundation.utility.ColorHelper;
|
import com.simibubi.create.foundation.utility.ColorHelper;
|
||||||
import com.simibubi.create.foundation.utility.LerpedFloat;
|
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||||
import com.simibubi.create.foundation.utility.LerpedFloat.Chaser;
|
import com.simibubi.create.foundation.utility.animation.LerpedFloat.Chaser;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.entity.player.ClientPlayerEntity;
|
import net.minecraft.client.entity.player.ClientPlayerEntity;
|
||||||
|
|
|
@ -26,10 +26,6 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.DistExecutor;
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
|
|
||||||
public class BeltInstance extends KineticTileInstance<BeltTileEntity> {
|
public class BeltInstance extends KineticTileInstance<BeltTileEntity> {
|
||||||
public static void register(TileEntityType<? extends BeltTileEntity> type) {
|
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () ->
|
|
||||||
InstancedTileRenderRegistry.instance.register(type, BeltInstance::new));
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean upward;
|
private boolean upward;
|
||||||
private boolean diagonal;
|
private boolean diagonal;
|
||||||
|
|
|
@ -23,6 +23,7 @@ import com.simibubi.create.content.contraptions.relays.belt.transport.ItemHandle
|
||||||
import com.simibubi.create.content.contraptions.relays.belt.transport.TransportedItemStack;
|
import com.simibubi.create.content.contraptions.relays.belt.transport.TransportedItemStack;
|
||||||
import com.simibubi.create.content.logistics.block.belts.tunnel.BrassTunnelTileEntity;
|
import com.simibubi.create.content.logistics.block.belts.tunnel.BrassTunnelTileEntity;
|
||||||
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
|
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
|
||||||
|
import com.simibubi.create.foundation.render.backend.light.ILightListener;
|
||||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||||
import com.simibubi.create.foundation.tileEntity.behaviour.belt.DirectBeltInputBehaviour;
|
import com.simibubi.create.foundation.tileEntity.behaviour.belt.DirectBeltInputBehaviour;
|
||||||
import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour;
|
import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour;
|
||||||
|
@ -56,7 +57,7 @@ import net.minecraftforge.fml.DistExecutor;
|
||||||
import net.minecraftforge.items.CapabilityItemHandler;
|
import net.minecraftforge.items.CapabilityItemHandler;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
public class BeltTileEntity extends KineticTileEntity {
|
public class BeltTileEntity extends KineticTileEntity implements ILightListener {
|
||||||
|
|
||||||
public Map<Entity, TransportedEntityInfo> passengers;
|
public Map<Entity, TransportedEntityInfo> passengers;
|
||||||
public Optional<DyeColor> color;
|
public Optional<DyeColor> color;
|
||||||
|
@ -515,7 +516,6 @@ public class BeltTileEntity extends KineticTileEntity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onChunkLightUpdate() {
|
public void onChunkLightUpdate() {
|
||||||
super.onChunkLightUpdate();
|
|
||||||
updateLight();
|
updateLight();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,11 +133,12 @@ public class BeltMovementHandler {
|
||||||
movement = movement.add(0, -Math.abs(axis.getCoordinate(movement.x, movement.y, movement.z)), 0);
|
movement = movement.add(0, -Math.abs(axis.getCoordinate(movement.x, movement.y, movement.z)), 0);
|
||||||
|
|
||||||
Vec3d centering = new Vec3d(centeringDirection).scale(diffCenter * Math.min(Math.abs(movementSpeed), .1f) * 4);
|
Vec3d centering = new Vec3d(centeringDirection).scale(diffCenter * Math.min(Math.abs(movementSpeed), .1f) * 4);
|
||||||
movement = movement.add(centering);
|
|
||||||
|
|
||||||
float step = entityIn.stepHeight;
|
float step = entityIn.stepHeight;
|
||||||
if (!isPlayer)
|
|
||||||
|
if (!isPlayer) {
|
||||||
|
movement = movement.add(centering);
|
||||||
entityIn.stepHeight = 1;
|
entityIn.stepHeight = 1;
|
||||||
|
}
|
||||||
|
|
||||||
// Entity Collisions
|
// Entity Collisions
|
||||||
if (Math.abs(movementSpeed) < .5f) {
|
if (Math.abs(movementSpeed) < .5f) {
|
||||||
|
|
|
@ -12,11 +12,6 @@ import net.minecraftforge.fml.DistExecutor;
|
||||||
|
|
||||||
public class ShaftInstance extends SingleRotatingInstance {
|
public class ShaftInstance extends SingleRotatingInstance {
|
||||||
|
|
||||||
public static void register(TileEntityType<? extends KineticTileEntity> type) {
|
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () ->
|
|
||||||
InstancedTileRenderRegistry.instance.register(type, ShaftInstance::new));
|
|
||||||
}
|
|
||||||
|
|
||||||
public ShaftInstance(InstancedTileRenderer<?> dispatcher, KineticTileEntity tile) {
|
public ShaftInstance(InstancedTileRenderer<?> dispatcher, KineticTileEntity tile) {
|
||||||
super(dispatcher, tile);
|
super(dispatcher, tile);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,10 +19,6 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.DistExecutor;
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
|
|
||||||
public class SplitShaftInstance extends KineticTileInstance<SplitShaftTileEntity> {
|
public class SplitShaftInstance extends KineticTileInstance<SplitShaftTileEntity> {
|
||||||
public static void register(TileEntityType<? extends SplitShaftTileEntity> type) {
|
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () ->
|
|
||||||
InstancedTileRenderRegistry.instance.register(type, SplitShaftInstance::new));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected ArrayList<InstanceKey<RotatingData>> keys;
|
protected ArrayList<InstanceKey<RotatingData>> keys;
|
||||||
|
|
||||||
|
|
|
@ -21,10 +21,6 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.DistExecutor;
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
|
|
||||||
public class GearboxInstance extends KineticTileInstance<GearboxTileEntity> {
|
public class GearboxInstance extends KineticTileInstance<GearboxTileEntity> {
|
||||||
public static void register(TileEntityType<? extends GearboxTileEntity> type) {
|
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () ->
|
|
||||||
InstancedTileRenderRegistry.instance.register(type, GearboxInstance::new));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected EnumMap<Direction, InstanceKey<RotatingData>> keys;
|
protected EnumMap<Direction, InstanceKey<RotatingData>> keys;
|
||||||
protected Direction sourceFacing;
|
protected Direction sourceFacing;
|
||||||
|
|
|
@ -18,10 +18,7 @@ import java.util.EnumMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class BeltTunnelInstance extends TileEntityInstance<BeltTunnelTileEntity> implements ITickableInstance {
|
public class BeltTunnelInstance extends TileEntityInstance<BeltTunnelTileEntity> implements ITickableInstance {
|
||||||
public static void register(TileEntityType<? extends BeltTunnelTileEntity> type) {
|
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () ->
|
|
||||||
InstancedTileRenderRegistry.instance.register(type, BeltTunnelInstance::new));
|
|
||||||
}
|
|
||||||
|
|
||||||
private Map<Direction, ArrayList<InstanceKey<FlapData>>> tunnelFlaps;
|
private Map<Direction, ArrayList<InstanceKey<FlapData>>> tunnelFlaps;
|
||||||
|
|
||||||
|
|
|
@ -154,8 +154,6 @@ public class BeltTunnelTileEntity extends SmartTileEntity implements IInstanceRe
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
super.initialize();
|
super.initialize();
|
||||||
updateTunnelConnections();
|
updateTunnelConnections();
|
||||||
if (world != null && world.isRemote)
|
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> CreateClient.kineticRenderer.add(this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -198,9 +196,4 @@ public class BeltTunnelTileEntity extends SmartTileEntity implements IInstanceRe
|
||||||
}
|
}
|
||||||
return this.cap.cast();
|
return this.cap.cast();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onChunkLightUpdate() {
|
|
||||||
CreateClient.kineticRenderer.onLightUpdate(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,10 +14,6 @@ import net.minecraftforge.fml.DistExecutor;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class FunnelInstance extends TileEntityInstance<FunnelTileEntity> implements ITickableInstance {
|
public class FunnelInstance extends TileEntityInstance<FunnelTileEntity> implements ITickableInstance {
|
||||||
public static void register(TileEntityType<? extends FunnelTileEntity> type) {
|
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () ->
|
|
||||||
InstancedTileRenderRegistry.instance.register(type, FunnelInstance::new));
|
|
||||||
}
|
|
||||||
|
|
||||||
private ArrayList<InstanceKey<FlapData>> flaps;
|
private ArrayList<InstanceKey<FlapData>> flaps;
|
||||||
|
|
||||||
|
|
|
@ -386,16 +386,4 @@ public class FunnelTileEntity extends SmartTileEntity implements IHaveHoveringIn
|
||||||
TooltipHelper.addHint(tooltip, "hint.horizontal_funnel");
|
TooltipHelper.addHint(tooltip, "hint.horizontal_funnel");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initialize() {
|
|
||||||
super.initialize();
|
|
||||||
if (world != null && world.isRemote)
|
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> CreateClient.kineticRenderer.add(this));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onChunkLightUpdate() {
|
|
||||||
CreateClient.kineticRenderer.onLightUpdate(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,10 +29,7 @@ import java.util.ArrayList;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
public class ArmInstance extends SingleRotatingInstance implements ITickableInstance {
|
public class ArmInstance extends SingleRotatingInstance implements ITickableInstance {
|
||||||
public static void register(TileEntityType<? extends KineticTileEntity> type) {
|
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () ->
|
|
||||||
InstancedTileRenderRegistry.instance.register(type, ArmInstance::new));
|
|
||||||
}
|
|
||||||
private InstanceKey<ModelData> base;
|
private InstanceKey<ModelData> base;
|
||||||
private InstanceKey<ModelData> lowerBody;
|
private InstanceKey<ModelData> lowerBody;
|
||||||
private InstanceKey<ModelData> upperBody;
|
private InstanceKey<ModelData> upperBody;
|
||||||
|
@ -67,6 +64,7 @@ public class ArmInstance extends SingleRotatingInstance implements ITickableInst
|
||||||
clawGrips = Lists.newArrayList(clawGrip1, clawGrip2);
|
clawGrips = Lists.newArrayList(clawGrip1, clawGrip2);
|
||||||
models = Lists.newArrayList(base, lowerBody, upperBody, head, claw, clawGrip1, clawGrip2);
|
models = Lists.newArrayList(base, lowerBody, upperBody, head, claw, clawGrip1, clawGrip2);
|
||||||
|
|
||||||
|
firstTick = true;
|
||||||
tick();
|
tick();
|
||||||
updateLight();
|
updateLight();
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,12 +77,16 @@ public class ArmTileEntity extends KineticTileEntity {
|
||||||
interactionPointTag = new ListNBT();
|
interactionPointTag = new ListNBT();
|
||||||
heldItem = ItemStack.EMPTY;
|
heldItem = ItemStack.EMPTY;
|
||||||
phase = Phase.SEARCH_INPUTS;
|
phase = Phase.SEARCH_INPUTS;
|
||||||
baseAngle = new InterpolatedAngle();
|
|
||||||
lowerArmAngle = new InterpolatedAngle();
|
|
||||||
upperArmAngle = new InterpolatedAngle();
|
|
||||||
headAngle = new InterpolatedAngle();
|
|
||||||
clawAngle = new InterpolatedAngle();
|
|
||||||
previousTarget = ArmAngleTarget.NO_TARGET;
|
previousTarget = ArmAngleTarget.NO_TARGET;
|
||||||
|
baseAngle = new InterpolatedAngle();
|
||||||
|
baseAngle.set(previousTarget.baseAngle);
|
||||||
|
lowerArmAngle = new InterpolatedAngle();
|
||||||
|
lowerArmAngle.set(previousTarget.lowerArmAngle);
|
||||||
|
upperArmAngle = new InterpolatedAngle();
|
||||||
|
upperArmAngle.set(previousTarget.upperArmAngle);
|
||||||
|
headAngle = new InterpolatedAngle();
|
||||||
|
headAngle.set(previousTarget.headAngle);
|
||||||
|
clawAngle = new InterpolatedAngle();
|
||||||
previousBaseAngle = previousTarget.baseAngle;
|
previousBaseAngle = previousTarget.baseAngle;
|
||||||
updateInteractionPoints = true;
|
updateInteractionPoints = true;
|
||||||
redstoneLocked = false;
|
redstoneLocked = false;
|
||||||
|
|
|
@ -0,0 +1,93 @@
|
||||||
|
package com.simibubi.create.content.logistics.block.redstone;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
|
import com.simibubi.create.AllBlockPartials;
|
||||||
|
import com.simibubi.create.content.contraptions.components.flywheel.FlyWheelInstance;
|
||||||
|
import com.simibubi.create.content.contraptions.components.flywheel.FlywheelTileEntity;
|
||||||
|
import com.simibubi.create.foundation.render.backend.RenderMaterials;
|
||||||
|
import com.simibubi.create.foundation.render.backend.instancing.*;
|
||||||
|
import com.simibubi.create.foundation.render.backend.instancing.impl.ModelData;
|
||||||
|
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||||
|
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||||
|
import com.simibubi.create.foundation.utility.ColorHelper;
|
||||||
|
import com.simibubi.create.foundation.utility.MatrixStacker;
|
||||||
|
import net.minecraft.state.properties.AttachFace;
|
||||||
|
import net.minecraft.tileentity.TileEntityType;
|
||||||
|
import net.minecraft.util.Direction;
|
||||||
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
|
|
||||||
|
public class AnalogLeverInstance extends TileEntityInstance<AnalogLeverTileEntity> implements ITickableInstance {
|
||||||
|
|
||||||
|
protected InstanceKey<ModelData> handle;
|
||||||
|
protected InstanceKey<ModelData> indicator;
|
||||||
|
|
||||||
|
private float rX;
|
||||||
|
private float rY;
|
||||||
|
|
||||||
|
public AnalogLeverInstance(InstancedTileRenderer<?> modelManager, AnalogLeverTileEntity tile) {
|
||||||
|
super(modelManager, tile);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void init() {
|
||||||
|
RenderMaterial<?, InstancedModel<ModelData>> mat = modelManager.getMaterial(RenderMaterials.MODELS);
|
||||||
|
|
||||||
|
handle = mat.getModel(AllBlockPartials.ANALOG_LEVER_HANDLE, lastState).createInstance();
|
||||||
|
indicator = mat.getModel(AllBlockPartials.ANALOG_LEVER_INDICATOR, lastState).createInstance();
|
||||||
|
|
||||||
|
AttachFace face = lastState.get(AnalogLeverBlock.FACE);
|
||||||
|
rX = face == AttachFace.FLOOR ? 0 : face == AttachFace.WALL ? 90 : 180;
|
||||||
|
rY = AngleHelper.horizontalAngle(lastState.get(AnalogLeverBlock.HORIZONTAL_FACING));
|
||||||
|
|
||||||
|
setupModel();
|
||||||
|
updateLight();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tick() {
|
||||||
|
if (!tile.clientState.settled())
|
||||||
|
setupModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setupModel() {
|
||||||
|
MatrixStack ms = new MatrixStack();
|
||||||
|
MatrixStacker msr = MatrixStacker.of(ms);
|
||||||
|
|
||||||
|
msr.translate(getFloatingPos());
|
||||||
|
transform(msr);
|
||||||
|
|
||||||
|
float state = tile.clientState.get(AnimationTickHolder.getPartialTicks());
|
||||||
|
|
||||||
|
int color = ColorHelper.mixColors(0x2C0300, 0xCD0000, state / 15f);
|
||||||
|
indicator.getInstance()
|
||||||
|
.setTransform(ms)
|
||||||
|
.setColor(color);
|
||||||
|
|
||||||
|
float angle = (float) ((state / 15) * 90 / 180 * Math.PI);
|
||||||
|
msr.translate(1 / 2f, 1 / 16f, 1 / 2f)
|
||||||
|
.rotate(Direction.EAST, angle)
|
||||||
|
.translate(-1 / 2f, -1 / 16f, -1 / 2f);
|
||||||
|
|
||||||
|
handle.getInstance()
|
||||||
|
.setTransformNoCopy(ms);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void remove() {
|
||||||
|
handle.delete();
|
||||||
|
indicator.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateLight() {
|
||||||
|
relight(pos, handle.getInstance(), indicator.getInstance());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void transform(MatrixStacker msr) {
|
||||||
|
msr.centre()
|
||||||
|
.rotate(Direction.UP, (float) (rY / 180 * Math.PI))
|
||||||
|
.rotate(Direction.EAST, (float) (rX / 180 * Math.PI))
|
||||||
|
.unCentre();
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,6 +4,7 @@ import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
import com.simibubi.create.AllBlockPartials;
|
||||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||||
|
import com.simibubi.create.foundation.render.backend.FastRenderDispatcher;
|
||||||
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
|
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
|
||||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||||
import com.simibubi.create.foundation.utility.ColorHelper;
|
import com.simibubi.create.foundation.utility.ColorHelper;
|
||||||
|
@ -25,6 +26,9 @@ public class AnalogLeverRenderer extends SafeTileEntityRenderer<AnalogLeverTileE
|
||||||
@Override
|
@Override
|
||||||
protected void renderSafe(AnalogLeverTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
protected void renderSafe(AnalogLeverTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
|
||||||
int light, int overlay) {
|
int light, int overlay) {
|
||||||
|
|
||||||
|
if (FastRenderDispatcher.available(te.getWorld())) return;
|
||||||
|
|
||||||
BlockState leverState = te.getBlockState();
|
BlockState leverState = te.getBlockState();
|
||||||
int lightCoords = WorldRenderer.getLightmapCoordinates(te.getWorld(), leverState, te.getPos());
|
int lightCoords = WorldRenderer.getLightmapCoordinates(te.getWorld(), leverState, te.getPos());
|
||||||
float state = te.clientState.get(partialTicks);
|
float state = te.clientState.get(partialTicks);
|
||||||
|
|
|
@ -2,8 +2,10 @@ package com.simibubi.create.content.logistics.block.redstone;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.simibubi.create.CreateClient;
|
||||||
import com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation;
|
import com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation;
|
||||||
import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingValue;
|
import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingValue;
|
||||||
|
import com.simibubi.create.foundation.render.backend.instancing.IInstanceRendered;
|
||||||
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
||||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
|
@ -12,7 +14,7 @@ import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.tileentity.TileEntityType;
|
import net.minecraft.tileentity.TileEntityType;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
public class AnalogLeverTileEntity extends SmartTileEntity implements IHaveGoggleInformation {
|
public class AnalogLeverTileEntity extends SmartTileEntity implements IHaveGoggleInformation, IInstanceRendered {
|
||||||
|
|
||||||
int state = 0;
|
int state = 0;
|
||||||
int lastChange;
|
int lastChange;
|
||||||
|
@ -49,6 +51,12 @@ public class AnalogLeverTileEntity extends SmartTileEntity implements IHaveGoggl
|
||||||
clientState.tick();
|
clientState.tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initialize() {
|
||||||
|
super.initialize();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private void updateOutput() {
|
private void updateOutput() {
|
||||||
AnalogLeverBlock.updateNeighbors(getBlockState(), world, pos);
|
AnalogLeverBlock.updateNeighbors(getBlockState(), world, pos);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,8 +13,8 @@ import com.simibubi.create.foundation.gui.widgets.IconButton;
|
||||||
import com.simibubi.create.foundation.gui.widgets.ScrollInput;
|
import com.simibubi.create.foundation.gui.widgets.ScrollInput;
|
||||||
import com.simibubi.create.foundation.networking.AllPackets;
|
import com.simibubi.create.foundation.networking.AllPackets;
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
import com.simibubi.create.foundation.utility.LerpedFloat;
|
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||||
import com.simibubi.create.foundation.utility.LerpedFloat.Chaser;
|
import com.simibubi.create.foundation.utility.animation.LerpedFloat.Chaser;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
|
@ -22,10 +22,6 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.fml.DistExecutor;
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
|
|
||||||
public class SchematicannonInstance extends TileEntityInstance<SchematicannonTileEntity> implements ITickableInstance {
|
public class SchematicannonInstance extends TileEntityInstance<SchematicannonTileEntity> implements ITickableInstance {
|
||||||
public static void register(TileEntityType<? extends SchematicannonTileEntity> type) {
|
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () ->
|
|
||||||
InstancedTileRenderRegistry.instance.register(type, SchematicannonInstance::new));
|
|
||||||
}
|
|
||||||
|
|
||||||
private InstanceKey<ModelData> connector;
|
private InstanceKey<ModelData> connector;
|
||||||
private InstanceKey<ModelData> pipe;
|
private InstanceKey<ModelData> pipe;
|
||||||
|
|
|
@ -937,18 +937,6 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
||||||
findInventories();
|
findInventories();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initialize() {
|
|
||||||
super.initialize();
|
|
||||||
|
|
||||||
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> CreateClient.kineticRenderer.add(this));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onChunkLightUpdate() {
|
|
||||||
CreateClient.kineticRenderer.onLightUpdate(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldRenderAsTE() {
|
public boolean shouldRenderAsTE() {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -19,10 +19,7 @@ import com.simibubi.create.foundation.block.connected.CTModel;
|
||||||
import com.simibubi.create.foundation.block.connected.ConnectedTextureBehaviour;
|
import com.simibubi.create.foundation.block.connected.ConnectedTextureBehaviour;
|
||||||
import com.simibubi.create.foundation.block.render.CustomRenderedItemModel;
|
import com.simibubi.create.foundation.block.render.CustomRenderedItemModel;
|
||||||
import com.tterrag.registrate.AbstractRegistrate;
|
import com.tterrag.registrate.AbstractRegistrate;
|
||||||
import com.tterrag.registrate.builders.BlockBuilder;
|
import com.tterrag.registrate.builders.*;
|
||||||
import com.tterrag.registrate.builders.Builder;
|
|
||||||
import com.tterrag.registrate.builders.FluidBuilder;
|
|
||||||
import com.tterrag.registrate.builders.ItemBuilder;
|
|
||||||
import com.tterrag.registrate.util.NonNullLazyValue;
|
import com.tterrag.registrate.util.NonNullLazyValue;
|
||||||
import com.tterrag.registrate.util.entry.RegistryEntry;
|
import com.tterrag.registrate.util.entry.RegistryEntry;
|
||||||
import com.tterrag.registrate.util.nullness.NonNullBiFunction;
|
import com.tterrag.registrate.util.nullness.NonNullBiFunction;
|
||||||
|
@ -38,6 +35,8 @@ import net.minecraft.client.renderer.color.IItemColor;
|
||||||
import net.minecraft.client.renderer.model.IBakedModel;
|
import net.minecraft.client.renderer.model.IBakedModel;
|
||||||
import net.minecraft.fluid.Fluid;
|
import net.minecraft.fluid.Fluid;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.tileentity.TileEntityType;
|
||||||
import net.minecraft.util.IItemProvider;
|
import net.minecraft.util.IItemProvider;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
@ -109,6 +108,17 @@ public class CreateRegistrate extends AbstractRegistrate<CreateRegistrate> {
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public <T extends TileEntity> CreateTileEntityBuilder<T, CreateRegistrate> tileEntity(String name, NonNullFunction<TileEntityType<T>, ? extends T> factory) {
|
||||||
|
return this.tileEntity(this.self(), name, (NonNullFunction)factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T extends TileEntity, P> CreateTileEntityBuilder<T, P> tileEntity(P parent, String name, NonNullFunction<TileEntityType<T>, ? extends T> factory) {
|
||||||
|
return (CreateTileEntityBuilder<T, P>) this.entry(name, (callback) -> {
|
||||||
|
return CreateTileEntityBuilder.create(this, parent, name, callback, factory);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/* Palettes */
|
/* Palettes */
|
||||||
|
|
||||||
public <T extends Block> BlockBuilder<T, CreateRegistrate> baseBlock(String name,
|
public <T extends Block> BlockBuilder<T, CreateRegistrate> baseBlock(String name,
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
package com.simibubi.create.foundation.data;
|
||||||
|
|
||||||
|
import com.simibubi.create.CreateClient;
|
||||||
|
import com.simibubi.create.content.logistics.block.redstone.AnalogLeverInstance;
|
||||||
|
import com.simibubi.create.foundation.render.backend.instancing.IRendererFactory;
|
||||||
|
import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderRegistry;
|
||||||
|
import com.tterrag.registrate.AbstractRegistrate;
|
||||||
|
import com.tterrag.registrate.builders.BuilderCallback;
|
||||||
|
import com.tterrag.registrate.builders.TileEntityBuilder;
|
||||||
|
import com.tterrag.registrate.util.OneTimeEventReceiver;
|
||||||
|
import com.tterrag.registrate.util.nullness.NonNullFunction;
|
||||||
|
import com.tterrag.registrate.util.nullness.NonNullSupplier;
|
||||||
|
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.fml.DistExecutor;
|
||||||
|
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||||
|
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
public class CreateTileEntityBuilder<T extends TileEntity, P> extends TileEntityBuilder<T, P> {
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private NonNullSupplier<IRendererFactory<? super T>> instanceFactory;
|
||||||
|
|
||||||
|
public static <T extends TileEntity, P> TileEntityBuilder<T, P> create(AbstractRegistrate<?> owner, P parent, String name, BuilderCallback callback, NonNullFunction<TileEntityType<T>, ? extends T> factory) {
|
||||||
|
return new CreateTileEntityBuilder<>(owner, parent, name, callback, factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected CreateTileEntityBuilder(AbstractRegistrate<?> owner, P parent, String name, BuilderCallback callback, NonNullFunction<TileEntityType<T>, ? extends T> factory) {
|
||||||
|
super(owner, parent, name, callback, factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CreateTileEntityBuilder<T, P> instance(NonNullSupplier<IRendererFactory<? super T>> instanceFactory) {
|
||||||
|
if (this.instanceFactory == null) {
|
||||||
|
DistExecutor.runWhenOn(Dist.CLIENT, () -> this::registerInstance);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.instanceFactory = instanceFactory;
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void registerInstance() {
|
||||||
|
OneTimeEventReceiver.addModListener(FMLClientSetupEvent.class, ($) -> {
|
||||||
|
NonNullSupplier<IRendererFactory<? super T>> instanceFactory = this.instanceFactory;
|
||||||
|
if (instanceFactory != null) {
|
||||||
|
InstancedTileRenderRegistry.instance.register(getEntry(), instanceFactory.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -11,7 +11,7 @@ import org.lwjgl.glfw.GLFW;
|
||||||
|
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.simibubi.create.foundation.gui.widgets.AbstractSimiWidget;
|
import com.simibubi.create.foundation.gui.widgets.AbstractSimiWidget;
|
||||||
import com.simibubi.create.foundation.utility.LerpedFloat;
|
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||||
|
|
||||||
import net.minecraft.client.MainWindow;
|
import net.minecraft.client.MainWindow;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
|
|
@ -8,7 +8,7 @@ import java.util.Optional;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import com.simibubi.create.foundation.utility.LerpedFloat;
|
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.screen.Screen;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
|
|
|
@ -6,6 +6,7 @@ import org.spongepowered.asm.mixin.Shadow;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||||
|
|
||||||
import com.simibubi.create.CreateClient;
|
import com.simibubi.create.CreateClient;
|
||||||
|
@ -18,7 +19,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
@Mixin(World.class)
|
@Mixin(World.class)
|
||||||
public class OnRemoveTileMixin {
|
public class AddRemoveTileMixin {
|
||||||
|
|
||||||
@Shadow @Final public boolean isRemote;
|
@Shadow @Final public boolean isRemote;
|
||||||
|
|
||||||
|
@ -31,4 +32,9 @@ public class OnRemoveTileMixin {
|
||||||
private void onRemoveTile(BlockPos pos, CallbackInfo ci, TileEntity te) {
|
private void onRemoveTile(BlockPos pos, CallbackInfo ci, TileEntity te) {
|
||||||
if (isRemote) CreateClient.kineticRenderer.remove(te);
|
if (isRemote) CreateClient.kineticRenderer.remove(te);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject(at = @At("TAIL"), method = "addTileEntity")
|
||||||
|
private void onAddTile(TileEntity te, CallbackInfoReturnable<Boolean> cir) {
|
||||||
|
if (isRemote) CreateClient.kineticRenderer.queueAdd(te);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -2,6 +2,7 @@ package com.simibubi.create.foundation.mixin;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.simibubi.create.CreateClient;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
@ -42,10 +43,12 @@ public abstract class LightUpdateMixin extends AbstractChunkProvider {
|
||||||
.entrySet()
|
.entrySet()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(entry -> SectionPos.toChunk(entry.getKey().getY()) == sectionY)
|
.filter(entry -> SectionPos.toChunk(entry.getKey().getY()) == sectionY)
|
||||||
.map(Map.Entry::getValue)
|
.map(Map.Entry::getValue).forEach(tile -> {
|
||||||
.filter(tile -> tile instanceof ILightListener)
|
CreateClient.kineticRenderer.onLightUpdate(tile);
|
||||||
.map(tile -> (ILightListener) tile)
|
|
||||||
.forEach(ILightListener::onChunkLightUpdate);
|
if (tile instanceof ILightListener)
|
||||||
|
((ILightListener) tile).onChunkLightUpdate();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ContraptionRenderDispatcher.notifyLightUpdate((ILightReader) thi.getWorld(), type, pos);
|
ContraptionRenderDispatcher.notifyLightUpdate((ILightReader) thi.getWorld(), type, pos);
|
||||||
|
|
|
@ -4,7 +4,7 @@ import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.simibubi.create.foundation.gui.widgets.AbstractSimiWidget;
|
import com.simibubi.create.foundation.gui.widgets.AbstractSimiWidget;
|
||||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||||
import com.simibubi.create.foundation.utility.ColorHelper;
|
import com.simibubi.create.foundation.utility.ColorHelper;
|
||||||
import com.simibubi.create.foundation.utility.LerpedFloat;
|
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.audio.SoundHandler;
|
import net.minecraft.client.audio.SoundHandler;
|
||||||
|
|
|
@ -26,7 +26,7 @@ import com.simibubi.create.foundation.ponder.elements.WorldSectionElement;
|
||||||
import com.simibubi.create.foundation.ponder.instructions.HideAllInstruction;
|
import com.simibubi.create.foundation.ponder.instructions.HideAllInstruction;
|
||||||
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
|
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
|
||||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||||
import com.simibubi.create.foundation.utility.LerpedFloat;
|
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||||
import com.simibubi.create.foundation.utility.MatrixStacker;
|
import com.simibubi.create.foundation.utility.MatrixStacker;
|
||||||
import com.simibubi.create.foundation.utility.Pair;
|
import com.simibubi.create.foundation.utility.Pair;
|
||||||
import com.simibubi.create.foundation.utility.VecHelper;
|
import com.simibubi.create.foundation.utility.VecHelper;
|
||||||
|
|
|
@ -7,10 +7,9 @@ import com.simibubi.create.foundation.gui.AbstractSimiScreen;
|
||||||
import com.simibubi.create.foundation.gui.ScreenOpener;
|
import com.simibubi.create.foundation.gui.ScreenOpener;
|
||||||
import com.simibubi.create.foundation.ponder.content.PonderIndexScreen;
|
import com.simibubi.create.foundation.ponder.content.PonderIndexScreen;
|
||||||
import com.simibubi.create.foundation.ponder.content.PonderTagScreen;
|
import com.simibubi.create.foundation.ponder.content.PonderTagScreen;
|
||||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
|
||||||
import com.simibubi.create.foundation.utility.ColorHelper;
|
import com.simibubi.create.foundation.utility.ColorHelper;
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
import com.simibubi.create.foundation.utility.LerpedFloat;
|
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.FontRenderer;
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
|
|
|
@ -27,8 +27,8 @@ import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
|
||||||
import com.simibubi.create.foundation.utility.ColorHelper;
|
import com.simibubi.create.foundation.utility.ColorHelper;
|
||||||
import com.simibubi.create.foundation.utility.Iterate;
|
import com.simibubi.create.foundation.utility.Iterate;
|
||||||
import com.simibubi.create.foundation.utility.Lang;
|
import com.simibubi.create.foundation.utility.Lang;
|
||||||
import com.simibubi.create.foundation.utility.LerpedFloat;
|
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||||
import com.simibubi.create.foundation.utility.LerpedFloat.Chaser;
|
import com.simibubi.create.foundation.utility.animation.LerpedFloat.Chaser;
|
||||||
import com.simibubi.create.foundation.utility.Pair;
|
import com.simibubi.create.foundation.utility.Pair;
|
||||||
import com.simibubi.create.foundation.utility.Pointing;
|
import com.simibubi.create.foundation.utility.Pointing;
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ package com.simibubi.create.foundation.ponder.elements;
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.foundation.ponder.PonderScene;
|
import com.simibubi.create.foundation.ponder.PonderScene;
|
||||||
import com.simibubi.create.foundation.ponder.PonderUI;
|
import com.simibubi.create.foundation.ponder.PonderUI;
|
||||||
import com.simibubi.create.foundation.utility.LerpedFloat;
|
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||||
|
|
||||||
public abstract class AnimatedOverlayElement extends PonderOverlayElement {
|
public abstract class AnimatedOverlayElement extends PonderOverlayElement {
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ package com.simibubi.create.foundation.ponder.elements;
|
||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.foundation.ponder.PonderWorld;
|
import com.simibubi.create.foundation.ponder.PonderWorld;
|
||||||
import com.simibubi.create.foundation.utility.LerpedFloat;
|
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||||
import com.simibubi.create.foundation.utility.MatrixStacker;
|
import com.simibubi.create.foundation.utility.MatrixStacker;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
|
|
|
@ -3,7 +3,7 @@ package com.simibubi.create.foundation.ponder.instructions;
|
||||||
import com.simibubi.create.foundation.ponder.PonderInstruction;
|
import com.simibubi.create.foundation.ponder.PonderInstruction;
|
||||||
import com.simibubi.create.foundation.ponder.PonderScene;
|
import com.simibubi.create.foundation.ponder.PonderScene;
|
||||||
import com.simibubi.create.foundation.ponder.PonderScene.SceneTransform;
|
import com.simibubi.create.foundation.ponder.PonderScene.SceneTransform;
|
||||||
import com.simibubi.create.foundation.utility.LerpedFloat.Chaser;
|
import com.simibubi.create.foundation.utility.animation.LerpedFloat.Chaser;
|
||||||
|
|
||||||
public class RotateSceneInstruction extends PonderInstruction {
|
public class RotateSceneInstruction extends PonderInstruction {
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import com.simibubi.create.foundation.gui.IScreenRenderable;
|
||||||
import com.simibubi.create.foundation.gui.widgets.AbstractSimiWidget;
|
import com.simibubi.create.foundation.gui.widgets.AbstractSimiWidget;
|
||||||
import com.simibubi.create.foundation.ponder.PonderUI;
|
import com.simibubi.create.foundation.ponder.PonderUI;
|
||||||
import com.simibubi.create.foundation.utility.ColorHelper;
|
import com.simibubi.create.foundation.utility.ColorHelper;
|
||||||
import com.simibubi.create.foundation.utility.LerpedFloat;
|
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.settings.KeyBinding;
|
import net.minecraft.client.settings.KeyBinding;
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package com.simibubi.create.foundation.render.backend.instancing;
|
package com.simibubi.create.foundation.render.backend.instancing;
|
||||||
|
|
||||||
import com.simibubi.create.foundation.render.backend.light.ILightListener;
|
public interface IInstanceRendered {
|
||||||
|
|
||||||
public interface IInstanceRendered extends ILightListener {
|
|
||||||
default boolean shouldRenderAsTE() {
|
default boolean shouldRenderAsTE() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,8 @@ import net.minecraft.world.IBlockReader;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public abstract class InstancedTileRenderer<P extends BasicProgram> {
|
public abstract class InstancedTileRenderer<P extends BasicProgram> {
|
||||||
|
protected ArrayList<TileEntity> queuedAdditions = new ArrayList<>(64);
|
||||||
|
|
||||||
protected Map<TileEntity, TileEntityInstance<?>> instances = new HashMap<>();
|
protected Map<TileEntity, TileEntityInstance<?>> instances = new HashMap<>();
|
||||||
|
|
||||||
protected Map<TileEntity, ITickableInstance> tickableInstances = new HashMap<>();
|
protected Map<TileEntity, ITickableInstance> tickableInstances = new HashMap<>();
|
||||||
|
@ -44,6 +46,8 @@ public abstract class InstancedTileRenderer<P extends BasicProgram> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void beginFrame(double cameraX, double cameraY, double cameraZ) {
|
public void beginFrame(double cameraX, double cameraY, double cameraZ) {
|
||||||
|
queuedAdditions.forEach(this::add);
|
||||||
|
queuedAdditions.clear();
|
||||||
tickableInstances.values().forEach(ITickableInstance::tick);
|
tickableInstances.values().forEach(ITickableInstance::tick);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,6 +116,12 @@ public abstract class InstancedTileRenderer<P extends BasicProgram> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public <T extends TileEntity> void queueAdd(T tile) {
|
||||||
|
if (!Backend.canUseInstancing()) return;
|
||||||
|
|
||||||
|
queuedAdditions.add(tile);
|
||||||
|
}
|
||||||
|
|
||||||
public <T extends TileEntity> void update(T tile) {
|
public <T extends TileEntity> void update(T tile) {
|
||||||
if (!Backend.canUseInstancing()) return;
|
if (!Backend.canUseInstancing()) return;
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
package com.simibubi.create.foundation.render.backend.instancing;
|
package com.simibubi.create.foundation.render.backend.instancing;
|
||||||
|
|
||||||
|
import com.simibubi.create.foundation.render.backend.instancing.impl.ModelData;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.LightType;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public abstract class TileEntityInstance<T extends TileEntity> {
|
public abstract class TileEntityInstance<T extends TileEntity> {
|
||||||
|
@ -57,4 +59,14 @@ public abstract class TileEntityInstance<T extends TileEntity> {
|
||||||
public BlockPos getFloatingPos() {
|
public BlockPos getFloatingPos() {
|
||||||
return pos.subtract(modelManager.getOriginCoordinate());
|
return pos.subtract(modelManager.getOriginCoordinate());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void relight(BlockPos pos, ModelData... models) {
|
||||||
|
relight(world.getLightLevel(LightType.BLOCK, pos), world.getLightLevel(LightType.SKY, pos), models);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void relight(int block, int sky, ModelData... models) {
|
||||||
|
for (ModelData model : models) {
|
||||||
|
model.setBlockLight(block).setSkyLight(sky);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,8 @@ import com.simibubi.create.foundation.fluid.SmartFluidTank;
|
||||||
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
||||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||||
import com.simibubi.create.foundation.tileEntity.behaviour.BehaviourType;
|
import com.simibubi.create.foundation.tileEntity.behaviour.BehaviourType;
|
||||||
import com.simibubi.create.foundation.utility.LerpedFloat;
|
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||||
import com.simibubi.create.foundation.utility.LerpedFloat.Chaser;
|
import com.simibubi.create.foundation.utility.animation.LerpedFloat.Chaser;
|
||||||
import com.simibubi.create.foundation.utility.NBTHelper;
|
import com.simibubi.create.foundation.utility.NBTHelper;
|
||||||
|
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
|
|
|
@ -7,7 +7,7 @@ import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||||
import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform.Sided;
|
import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform.Sided;
|
||||||
import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollValueBehaviour.StepContext;
|
import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollValueBehaviour.StepContext;
|
||||||
|
|
||||||
import com.simibubi.create.foundation.utility.PhysicalFloat;
|
import com.simibubi.create.foundation.utility.animation.PhysicalFloat;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.world.ClientWorld;
|
import net.minecraft.client.world.ClientWorld;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
@ -24,7 +24,7 @@ public class ScrollValueHandler {
|
||||||
private static float lastPassiveScroll = 0.0f;
|
private static float lastPassiveScroll = 0.0f;
|
||||||
private static float passiveScroll = 0.0f;
|
private static float passiveScroll = 0.0f;
|
||||||
private static float passiveScrollDirection = 1f;
|
private static float passiveScrollDirection = 1f;
|
||||||
private static final PhysicalFloat wrenchCog = PhysicalFloat.create().withDrag(0.7);
|
private static final PhysicalFloat wrenchCog = PhysicalFloat.create().withDrag(0.3);
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public static boolean onScroll(double delta) {
|
public static boolean onScroll(double delta) {
|
||||||
|
@ -43,8 +43,8 @@ public class ScrollValueHandler {
|
||||||
if (!mc.player.isAllowEdit())
|
if (!mc.player.isAllowEdit())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
passiveScrollDirection = (float) delta;
|
passiveScrollDirection = (float) -delta;
|
||||||
wrenchCog.bump(3, delta * 10);
|
wrenchCog.bump(3, -delta * 10);
|
||||||
|
|
||||||
if (scrolling.needsWrench && !AllItems.WRENCH.isIn(mc.player.getHeldItemMainhand()))
|
if (scrolling.needsWrench && !AllItems.WRENCH.isIn(mc.player.getHeldItemMainhand()))
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1,147 +0,0 @@
|
||||||
package com.simibubi.create.foundation.utility;
|
|
||||||
|
|
||||||
import net.minecraft.util.math.MathHelper;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class PhysicalFloat {
|
|
||||||
|
|
||||||
float previousValue;
|
|
||||||
float value;
|
|
||||||
|
|
||||||
float speed;
|
|
||||||
|
|
||||||
private final ArrayList<Force> forces = new ArrayList<>();
|
|
||||||
|
|
||||||
public static PhysicalFloat create() {
|
|
||||||
return new PhysicalFloat();
|
|
||||||
}
|
|
||||||
|
|
||||||
public PhysicalFloat startAt(double value) {
|
|
||||||
previousValue = this.value = (float) value;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PhysicalFloat withDrag(double drag) {
|
|
||||||
return addForce(new DragForce((float) drag));
|
|
||||||
}
|
|
||||||
|
|
||||||
public PhysicalFloat zeroing(double g) {
|
|
||||||
return addForce(new ZeroingForce((float) g));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void tick() {
|
|
||||||
previousValue = value;
|
|
||||||
|
|
||||||
for (Force force : forces)
|
|
||||||
speed = force.apply(speed, value);
|
|
||||||
|
|
||||||
forces.removeIf(Force::finished);
|
|
||||||
|
|
||||||
value += speed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PhysicalFloat addForce(Force f) {
|
|
||||||
forces.add(f);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PhysicalFloat bump(double force) {
|
|
||||||
return addForce(new Impulse((float) force));
|
|
||||||
}
|
|
||||||
|
|
||||||
public PhysicalFloat bump(int time, double force) {
|
|
||||||
return addForce(new ForceOverTime(time, (float) force));
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getValue() {
|
|
||||||
return getValue(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getValue(float partialTicks) {
|
|
||||||
return MathHelper.lerp(partialTicks, previousValue, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface Force {
|
|
||||||
|
|
||||||
float apply(float speed, float value);
|
|
||||||
|
|
||||||
boolean finished();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class DragForce implements Force {
|
|
||||||
final float dragFactor;
|
|
||||||
|
|
||||||
public DragForce(float dragFactor) {
|
|
||||||
this.dragFactor = dragFactor;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float apply(float speed, float value) {
|
|
||||||
return speed * dragFactor;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean finished() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class ZeroingForce implements Force {
|
|
||||||
final float g;
|
|
||||||
|
|
||||||
public ZeroingForce(float g) {
|
|
||||||
this.g = g;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float apply(float speed, float value) {
|
|
||||||
return speed - MathHelper.clamp(g * Math.signum(value), -speed, speed);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean finished() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Impulse implements Force {
|
|
||||||
|
|
||||||
float force;
|
|
||||||
|
|
||||||
public Impulse(float force) {
|
|
||||||
this.force = force;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float apply(float speed, float value) {
|
|
||||||
return speed + force;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean finished() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class ForceOverTime implements Force {
|
|
||||||
int timeRemaining;
|
|
||||||
float accel;
|
|
||||||
|
|
||||||
public ForceOverTime(int time, float totalAcceleration) {
|
|
||||||
this.timeRemaining = time;
|
|
||||||
this.accel = totalAcceleration / (float) time;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float apply(float speed, float value) {
|
|
||||||
timeRemaining--;
|
|
||||||
return speed + accel;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean finished() {
|
|
||||||
return timeRemaining <= 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,84 @@
|
||||||
|
package com.simibubi.create.foundation.utility.animation;
|
||||||
|
|
||||||
|
public interface Force {
|
||||||
|
|
||||||
|
float get(float mass, float value, float speed);
|
||||||
|
|
||||||
|
boolean finished();
|
||||||
|
|
||||||
|
class Drag implements Force {
|
||||||
|
final float dragFactor;
|
||||||
|
|
||||||
|
public Drag(float dragFactor) {
|
||||||
|
this.dragFactor = dragFactor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float get(float mass, float value, float speed) {
|
||||||
|
return -speed * dragFactor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean finished() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Zeroing implements Force {
|
||||||
|
final float g;
|
||||||
|
|
||||||
|
public Zeroing(float g) {
|
||||||
|
this.g = g / 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float get(float mass, float value, float speed) {
|
||||||
|
return -Math.signum(value) * g * mass;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean finished() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Impulse implements Force {
|
||||||
|
|
||||||
|
float force;
|
||||||
|
|
||||||
|
public Impulse(float force) {
|
||||||
|
this.force = force;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float get(float mass, float value, float speed) {
|
||||||
|
return force;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean finished() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class OverTime implements Force {
|
||||||
|
int timeRemaining;
|
||||||
|
float f;
|
||||||
|
|
||||||
|
public OverTime(int time, float totalAcceleration) {
|
||||||
|
this.timeRemaining = time;
|
||||||
|
this.f = totalAcceleration / (float) time;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float get(float mass, float value, float speed) {
|
||||||
|
timeRemaining--;
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean finished() {
|
||||||
|
return timeRemaining <= 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
package com.simibubi.create.foundation.utility;
|
package com.simibubi.create.foundation.utility.animation;
|
||||||
|
|
||||||
|
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
|
@ -0,0 +1,80 @@
|
||||||
|
package com.simibubi.create.foundation.utility.animation;
|
||||||
|
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class PhysicalFloat {
|
||||||
|
|
||||||
|
float previousValue;
|
||||||
|
float value;
|
||||||
|
|
||||||
|
float previousSpeed;
|
||||||
|
float speed;
|
||||||
|
|
||||||
|
float mass;
|
||||||
|
|
||||||
|
private final ArrayList<Force> forces = new ArrayList<>();
|
||||||
|
|
||||||
|
public static PhysicalFloat create() {
|
||||||
|
return new PhysicalFloat(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PhysicalFloat create(float mass) {
|
||||||
|
return new PhysicalFloat(mass);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PhysicalFloat(float mass) {
|
||||||
|
this.mass = mass;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PhysicalFloat startAt(double value) {
|
||||||
|
previousValue = this.value = (float) value;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PhysicalFloat withDrag(double drag) {
|
||||||
|
return addForce(new Force.Drag((float) drag));
|
||||||
|
}
|
||||||
|
|
||||||
|
public PhysicalFloat zeroing(double g) {
|
||||||
|
return addForce(new Force.Zeroing((float) g));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void tick() {
|
||||||
|
previousSpeed = speed;
|
||||||
|
previousValue = value;
|
||||||
|
|
||||||
|
float totalImpulse = 0;
|
||||||
|
for (Force force : forces)
|
||||||
|
totalImpulse += force.get(mass, value, speed) / mass;
|
||||||
|
|
||||||
|
speed += totalImpulse;
|
||||||
|
|
||||||
|
forces.removeIf(Force::finished);
|
||||||
|
|
||||||
|
value += speed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PhysicalFloat addForce(Force f) {
|
||||||
|
forces.add(f);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PhysicalFloat bump(double force) {
|
||||||
|
return addForce(new Force.Impulse((float) force));
|
||||||
|
}
|
||||||
|
|
||||||
|
public PhysicalFloat bump(int time, double force) {
|
||||||
|
return addForce(new Force.OverTime(time, (float) force));
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getValue() {
|
||||||
|
return getValue(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getValue(float partialTicks) {
|
||||||
|
return MathHelper.lerp(partialTicks, previousValue, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -4,7 +4,7 @@
|
||||||
"compatibilityLevel": "JAVA_8",
|
"compatibilityLevel": "JAVA_8",
|
||||||
"refmap": "create.refmap.json",
|
"refmap": "create.refmap.json",
|
||||||
"client": [
|
"client": [
|
||||||
"OnRemoveTileMixin",
|
"AddRemoveTileMixin",
|
||||||
"ShaderCloseMixin",
|
"ShaderCloseMixin",
|
||||||
"CancelTileEntityRenderMixin",
|
"CancelTileEntityRenderMixin",
|
||||||
"LightUpdateMixin",
|
"LightUpdateMixin",
|
||||||
|
|
Loading…
Reference in a new issue