2019-07-11 19:55:11 +02:00
|
|
|
package com.simibubi.create;
|
|
|
|
|
|
|
|
import java.util.function.Supplier;
|
|
|
|
|
2019-10-15 22:22:19 +02:00
|
|
|
import com.simibubi.create.foundation.utility.Lang;
|
2019-08-17 00:57:36 +02:00
|
|
|
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
|
|
|
|
import com.simibubi.create.modules.contraptions.generators.MotorTileEntity;
|
|
|
|
import com.simibubi.create.modules.contraptions.generators.MotorTileEntityRenderer;
|
2019-08-20 11:37:32 +02:00
|
|
|
import com.simibubi.create.modules.contraptions.generators.WaterWheelTileEntity;
|
2019-10-29 19:02:20 +01:00
|
|
|
import com.simibubi.create.modules.contraptions.receivers.BasinTileEntity;
|
|
|
|
import com.simibubi.create.modules.contraptions.receivers.BasinTileEntityRenderer;
|
2019-08-22 15:52:15 +02:00
|
|
|
import com.simibubi.create.modules.contraptions.receivers.CrushingWheelControllerTileEntity;
|
2019-08-17 00:57:36 +02:00
|
|
|
import com.simibubi.create.modules.contraptions.receivers.CrushingWheelTileEntity;
|
|
|
|
import com.simibubi.create.modules.contraptions.receivers.DrillTileEntity;
|
2019-10-19 15:42:42 +02:00
|
|
|
import com.simibubi.create.modules.contraptions.receivers.DrillTileEntityRenderer;
|
2019-08-29 01:51:28 +02:00
|
|
|
import com.simibubi.create.modules.contraptions.receivers.EncasedFanTileEntity;
|
|
|
|
import com.simibubi.create.modules.contraptions.receivers.EncasedFanTileEntityRenderer;
|
2019-10-19 15:42:42 +02:00
|
|
|
import com.simibubi.create.modules.contraptions.receivers.HarvesterTileEntity;
|
|
|
|
import com.simibubi.create.modules.contraptions.receivers.HarvesterTileEntityRenderer;
|
2019-10-29 19:02:20 +01:00
|
|
|
import com.simibubi.create.modules.contraptions.receivers.MechanicalMixerTileEntity;
|
|
|
|
import com.simibubi.create.modules.contraptions.receivers.MechanicalMixerTileEntityRenderer;
|
2019-09-13 18:36:18 +02:00
|
|
|
import com.simibubi.create.modules.contraptions.receivers.MechanicalPressTileEntity;
|
|
|
|
import com.simibubi.create.modules.contraptions.receivers.MechanicalPressTileEntityRenderer;
|
2019-10-19 23:42:44 +02:00
|
|
|
import com.simibubi.create.modules.contraptions.receivers.SawTileEntity;
|
|
|
|
import com.simibubi.create.modules.contraptions.receivers.SawTileEntityRenderer;
|
2019-08-17 00:57:36 +02:00
|
|
|
import com.simibubi.create.modules.contraptions.receivers.TurntableTileEntity;
|
2019-09-07 13:12:12 +02:00
|
|
|
import com.simibubi.create.modules.contraptions.receivers.constructs.ChassisTileEntity;
|
|
|
|
import com.simibubi.create.modules.contraptions.receivers.constructs.MechanicalBearingTileEntity;
|
|
|
|
import com.simibubi.create.modules.contraptions.receivers.constructs.MechanicalBearingTileEntityRenderer;
|
2019-08-17 00:57:36 +02:00
|
|
|
import com.simibubi.create.modules.contraptions.receivers.constructs.MechanicalPistonTileEntity;
|
|
|
|
import com.simibubi.create.modules.contraptions.receivers.constructs.MechanicalPistonTileEntityRenderer;
|
2019-08-31 08:37:57 +02:00
|
|
|
import com.simibubi.create.modules.contraptions.relays.ClutchTileEntity;
|
2019-08-29 01:51:28 +02:00
|
|
|
import com.simibubi.create.modules.contraptions.relays.EncasedShaftTileEntity;
|
|
|
|
import com.simibubi.create.modules.contraptions.relays.EncasedShaftTileEntityRenderer;
|
2019-08-17 00:57:36 +02:00
|
|
|
import com.simibubi.create.modules.contraptions.relays.GearboxTileEntity;
|
|
|
|
import com.simibubi.create.modules.contraptions.relays.GearboxTileEntityRenderer;
|
2019-08-28 19:45:41 +02:00
|
|
|
import com.simibubi.create.modules.contraptions.relays.GearshiftTileEntity;
|
2019-08-31 08:37:57 +02:00
|
|
|
import com.simibubi.create.modules.contraptions.relays.ShaftTileEntity;
|
2019-08-29 01:51:28 +02:00
|
|
|
import com.simibubi.create.modules.contraptions.relays.SplitShaftTileEntityRenderer;
|
2019-08-31 08:37:57 +02:00
|
|
|
import com.simibubi.create.modules.contraptions.relays.belt.BeltTileEntity;
|
|
|
|
import com.simibubi.create.modules.contraptions.relays.belt.BeltTileEntityRenderer;
|
2019-09-24 14:40:01 +02:00
|
|
|
import com.simibubi.create.modules.curiosities.partialWindows.WindowInABlockTileEntity;
|
2019-08-28 16:54:27 +02:00
|
|
|
import com.simibubi.create.modules.logistics.block.LinkedTileEntityRenderer;
|
2019-08-28 19:45:41 +02:00
|
|
|
import com.simibubi.create.modules.logistics.block.RedstoneBridgeTileEntity;
|
2019-08-27 17:35:34 +02:00
|
|
|
import com.simibubi.create.modules.logistics.block.StockswitchTileEntity;
|
2019-10-05 19:00:43 +02:00
|
|
|
import com.simibubi.create.modules.logistics.block.belts.BeltFunnelTileEntity;
|
2019-11-18 16:14:26 +01:00
|
|
|
import com.simibubi.create.modules.logistics.block.belts.BeltFunnelTileEntityRenderer;
|
2019-10-05 19:00:43 +02:00
|
|
|
import com.simibubi.create.modules.logistics.block.belts.EntityDetectorTileEntity;
|
|
|
|
import com.simibubi.create.modules.logistics.block.belts.EntityDetectorTileEntityRenderer;
|
|
|
|
import com.simibubi.create.modules.logistics.block.belts.ExtractorTileEntity;
|
|
|
|
import com.simibubi.create.modules.logistics.block.belts.ExtractorTileEntityRenderer;
|
|
|
|
import com.simibubi.create.modules.logistics.block.belts.LinkedExtractorTileEntity;
|
|
|
|
import com.simibubi.create.modules.logistics.block.belts.LinkedExtractorTileEntityRenderer;
|
2019-09-13 18:36:18 +02:00
|
|
|
import com.simibubi.create.modules.logistics.block.diodes.FlexpeaterTileEntity;
|
|
|
|
import com.simibubi.create.modules.logistics.block.diodes.FlexpeaterTileEntityRenderer;
|
2019-10-05 19:00:43 +02:00
|
|
|
import com.simibubi.create.modules.logistics.block.inventories.FlexcrateTileEntity;
|
|
|
|
import com.simibubi.create.modules.logistics.management.base.LogisticalCasingTileEntity;
|
|
|
|
import com.simibubi.create.modules.logistics.management.base.LogisticalControllerTileEntity;
|
|
|
|
import com.simibubi.create.modules.logistics.management.base.LogisticalControllerTileEntityRenderer;
|
|
|
|
import com.simibubi.create.modules.logistics.management.controller.CalculationTileEntity;
|
|
|
|
import com.simibubi.create.modules.logistics.management.controller.RequestTileEntity;
|
|
|
|
import com.simibubi.create.modules.logistics.management.controller.StorageTileEntity;
|
|
|
|
import com.simibubi.create.modules.logistics.management.controller.SupplyTileEntity;
|
|
|
|
import com.simibubi.create.modules.logistics.management.controller.TransactionsTileEntity;
|
|
|
|
import com.simibubi.create.modules.logistics.management.index.LogisticalIndexTileEntity;
|
2019-10-11 05:56:32 +02:00
|
|
|
import com.simibubi.create.modules.logistics.transport.villager.LogisticiansTableTileEntity;
|
|
|
|
import com.simibubi.create.modules.logistics.transport.villager.LogisticiansTableTileEntityRenderer;
|
|
|
|
import com.simibubi.create.modules.logistics.transport.villager.PackageFunnelTileEntity;
|
2019-07-23 12:54:53 +02:00
|
|
|
import com.simibubi.create.modules.schematics.block.SchematicTableTileEntity;
|
|
|
|
import com.simibubi.create.modules.schematics.block.SchematicannonRenderer;
|
|
|
|
import com.simibubi.create.modules.schematics.block.SchematicannonTileEntity;
|
2019-07-11 19:55:11 +02:00
|
|
|
|
2019-08-06 18:13:33 +02:00
|
|
|
import net.minecraft.block.Block;
|
2019-07-13 12:55:28 +02:00
|
|
|
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
2019-07-11 19:55:11 +02:00
|
|
|
import net.minecraft.tileentity.TileEntity;
|
|
|
|
import net.minecraft.tileentity.TileEntityType;
|
|
|
|
import net.minecraft.util.ResourceLocation;
|
2019-07-15 12:10:57 +02:00
|
|
|
import net.minecraftforge.api.distmarker.Dist;
|
|
|
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
2019-07-13 12:55:28 +02:00
|
|
|
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
2019-10-15 22:22:19 +02:00
|
|
|
import net.minecraftforge.registries.IForgeRegistry;
|
2019-07-11 19:55:11 +02:00
|
|
|
|
|
|
|
public enum AllTileEntities {
|
|
|
|
|
2019-08-06 18:13:33 +02:00
|
|
|
// Schematics
|
|
|
|
SCHEMATICANNON(SchematicannonTileEntity::new, AllBlocks.SCHEMATICANNON),
|
|
|
|
SCHEMATICTABLE(SchematicTableTileEntity::new, AllBlocks.SCHEMATIC_TABLE),
|
2019-07-11 19:55:11 +02:00
|
|
|
|
2019-08-06 18:13:33 +02:00
|
|
|
// Kinetics
|
2019-08-29 01:51:28 +02:00
|
|
|
SHAFT(ShaftTileEntity::new, AllBlocks.SHAFT, AllBlocks.COGWHEEL, AllBlocks.LARGE_COGWHEEL, AllBlocks.ENCASED_SHAFT),
|
2019-09-07 13:12:12 +02:00
|
|
|
MOTOR(MotorTileEntity::new, AllBlocks.MOTOR),
|
|
|
|
GEARBOX(GearboxTileEntity::new, AllBlocks.GEARBOX),
|
2019-08-06 18:13:33 +02:00
|
|
|
TURNTABLE(TurntableTileEntity::new, AllBlocks.TURNTABLE),
|
2019-08-29 01:51:28 +02:00
|
|
|
ENCASED_SHAFT(EncasedShaftTileEntity::new, AllBlocks.ENCASED_SHAFT, AllBlocks.ENCASED_BELT),
|
2019-09-07 13:12:12 +02:00
|
|
|
ENCASED_FAN(EncasedFanTileEntity::new, AllBlocks.ENCASED_FAN),
|
|
|
|
CLUTCH(ClutchTileEntity::new, AllBlocks.CLUTCH),
|
|
|
|
GEARSHIFT(GearshiftTileEntity::new, AllBlocks.GEARSHIFT),
|
|
|
|
BELT(BeltTileEntity::new, AllBlocks.BELT),
|
2019-08-17 00:57:36 +02:00
|
|
|
MECHANICAL_PISTON(MechanicalPistonTileEntity::new, AllBlocks.MECHANICAL_PISTON, AllBlocks.STICKY_MECHANICAL_PISTON),
|
2019-09-07 13:12:12 +02:00
|
|
|
MECHANICAL_BEARING(MechanicalBearingTileEntity::new, AllBlocks.MECHANICAL_BEARING),
|
2019-10-19 15:42:42 +02:00
|
|
|
CHASSIS(ChassisTileEntity::new, AllBlocks.ROTATION_CHASSIS, AllBlocks.TRANSLATION_CHASSIS,
|
2019-10-18 13:14:03 +02:00
|
|
|
AllBlocks.TRANSLATION_CHASSIS_SECONDARY),
|
2019-08-17 00:57:36 +02:00
|
|
|
DRILL(DrillTileEntity::new, AllBlocks.DRILL),
|
2019-10-19 23:42:44 +02:00
|
|
|
SAW(SawTileEntity::new, AllBlocks.SAW),
|
2019-10-19 15:42:42 +02:00
|
|
|
HARVESTER(HarvesterTileEntity::new, AllBlocks.HARVESTER),
|
2019-08-17 00:57:36 +02:00
|
|
|
CRUSHING_WHEEL(CrushingWheelTileEntity::new, AllBlocks.CRUSHING_WHEEL),
|
2019-08-22 15:52:15 +02:00
|
|
|
CRUSHING_WHEEL_CONTROLLER(CrushingWheelControllerTileEntity::new, AllBlocks.CRUSHING_WHEEL_CONTROLLER),
|
2019-08-20 11:37:32 +02:00
|
|
|
WATER_WHEEL(WaterWheelTileEntity::new, AllBlocks.WATER_WHEEL),
|
2019-09-13 18:36:18 +02:00
|
|
|
MECHANICAL_PRESS(MechanicalPressTileEntity::new, AllBlocks.MECHANICAL_PRESS),
|
2019-10-29 19:02:20 +01:00
|
|
|
MECHANICAL_MIXER(MechanicalMixerTileEntity::new, AllBlocks.MECHANICAL_MIXER),
|
|
|
|
BASIN(BasinTileEntity::new, AllBlocks.BASIN),
|
2019-08-17 00:57:36 +02:00
|
|
|
|
2019-08-25 10:14:15 +02:00
|
|
|
// Logistics
|
|
|
|
REDSTONE_BRIDGE(RedstoneBridgeTileEntity::new, AllBlocks.REDSTONE_BRIDGE),
|
2019-08-26 20:17:16 +02:00
|
|
|
STOCKSWITCH(StockswitchTileEntity::new, AllBlocks.STOCKSWITCH),
|
2019-09-07 13:12:12 +02:00
|
|
|
FLEXCRATE(FlexcrateTileEntity::new, AllBlocks.FLEXCRATE),
|
|
|
|
EXTRACTOR(ExtractorTileEntity::new, AllBlocks.EXTRACTOR),
|
2019-08-28 16:54:27 +02:00
|
|
|
LINKED_EXTRACTOR(LinkedExtractorTileEntity::new, AllBlocks.LINKED_EXTRACTOR),
|
2019-08-31 08:37:57 +02:00
|
|
|
BELT_FUNNEL(BeltFunnelTileEntity::new, AllBlocks.BELT_FUNNEL),
|
2019-09-05 02:16:44 +02:00
|
|
|
ENTITY_DETECTOR(EntityDetectorTileEntity::new, AllBlocks.ENTITY_DETECTOR),
|
2019-09-13 18:36:18 +02:00
|
|
|
FLEXPEATER(FlexpeaterTileEntity::new, AllBlocks.FLEXPEATER),
|
2019-10-05 19:00:43 +02:00
|
|
|
LOGISTICAL_CASING(LogisticalCasingTileEntity::new, AllBlocks.LOGISTICAL_CASING),
|
|
|
|
LOGISTICAL_SUPPLY_CONTROLLER(SupplyTileEntity::new, AllBlocks.LOGISTICAL_CONTROLLER),
|
|
|
|
LOGISTICAL_REQUEST_CONTROLLER(RequestTileEntity::new, AllBlocks.LOGISTICAL_CONTROLLER),
|
|
|
|
LOGISTICAL_STORAGE_CONTROLLER(StorageTileEntity::new, AllBlocks.LOGISTICAL_CONTROLLER),
|
|
|
|
LOGISTICAL_CALCULATION_CONTROLLER(CalculationTileEntity::new, AllBlocks.LOGISTICAL_CONTROLLER),
|
|
|
|
LOGISTICAL_TRANSATIONS_CONTROLLER(TransactionsTileEntity::new, AllBlocks.LOGISTICAL_CONTROLLER),
|
|
|
|
LOGISTICAL_INDEX(LogisticalIndexTileEntity::new, AllBlocks.LOGISTICAL_INDEX),
|
2019-10-11 05:56:32 +02:00
|
|
|
LOGISTICIANS_TABLE(LogisticiansTableTileEntity::new, AllBlocks.LOGISTICIANS_TABLE),
|
|
|
|
PACKAGE_FUNNEL(PackageFunnelTileEntity::new, AllBlocks.PACKAGE_FUNNEL),
|
|
|
|
|
2019-09-24 14:40:01 +02:00
|
|
|
// Curiosities
|
|
|
|
WINDOW_IN_A_BLOCK(WindowInABlockTileEntity::new, AllBlocks.WINDOW_IN_A_BLOCK),
|
2019-08-28 19:45:41 +02:00
|
|
|
|
2019-08-26 20:21:03 +02:00
|
|
|
;
|
2019-08-28 19:45:41 +02:00
|
|
|
|
2019-07-11 19:55:11 +02:00
|
|
|
private Supplier<? extends TileEntity> supplier;
|
|
|
|
public TileEntityType<?> type;
|
2019-08-06 18:13:33 +02:00
|
|
|
private AllBlocks[] blocks;
|
2019-07-11 19:55:11 +02:00
|
|
|
|
2019-08-06 18:13:33 +02:00
|
|
|
private AllTileEntities(Supplier<? extends TileEntity> supplier, AllBlocks... blocks) {
|
2019-07-11 19:55:11 +02:00
|
|
|
this.supplier = supplier;
|
2019-08-06 18:13:33 +02:00
|
|
|
this.blocks = blocks;
|
2019-07-11 19:55:11 +02:00
|
|
|
}
|
2019-10-18 13:14:03 +02:00
|
|
|
|
2019-10-11 05:56:32 +02:00
|
|
|
public boolean typeOf(TileEntity te) {
|
|
|
|
return te.getType().equals(type);
|
|
|
|
}
|
2019-07-11 19:55:11 +02:00
|
|
|
|
2019-10-15 22:22:19 +02:00
|
|
|
public static void registerTileEntities(IForgeRegistry<TileEntityType<?>> registry) {
|
2019-07-11 19:55:11 +02:00
|
|
|
for (AllTileEntities tileEntity : values()) {
|
2019-08-06 18:13:33 +02:00
|
|
|
Block[] blocks = new Block[tileEntity.blocks.length];
|
|
|
|
for (int i = 0; i < blocks.length; i++)
|
|
|
|
blocks[i] = tileEntity.blocks[i].block;
|
2019-08-17 00:57:36 +02:00
|
|
|
|
2019-10-15 22:22:19 +02:00
|
|
|
ResourceLocation resourceLocation = new ResourceLocation(Create.ID, Lang.asId(tileEntity.name()));
|
2019-08-06 18:13:33 +02:00
|
|
|
tileEntity.type = TileEntityType.Builder.create(tileEntity.supplier, blocks).build(null)
|
2019-07-11 19:55:11 +02:00
|
|
|
.setRegistryName(resourceLocation);
|
2019-10-15 22:22:19 +02:00
|
|
|
registry.register(tileEntity.type);
|
2019-07-11 19:55:11 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-15 12:10:57 +02:00
|
|
|
@OnlyIn(Dist.CLIENT)
|
2019-07-11 19:55:11 +02:00
|
|
|
public static void registerRenderers() {
|
2019-07-13 12:55:28 +02:00
|
|
|
bind(SchematicannonTileEntity.class, new SchematicannonRenderer());
|
2019-08-29 01:51:28 +02:00
|
|
|
bind(ShaftTileEntity.class, new KineticTileEntityRenderer());
|
2019-08-06 18:13:33 +02:00
|
|
|
bind(TurntableTileEntity.class, new KineticTileEntityRenderer());
|
|
|
|
bind(MotorTileEntity.class, new MotorTileEntityRenderer());
|
2019-08-29 01:51:28 +02:00
|
|
|
bind(EncasedShaftTileEntity.class, new EncasedShaftTileEntityRenderer());
|
2019-10-19 15:42:42 +02:00
|
|
|
bind(DrillTileEntity.class, new DrillTileEntityRenderer());
|
2019-10-19 23:42:44 +02:00
|
|
|
bind(SawTileEntity.class, new SawTileEntityRenderer());
|
2019-08-29 01:51:28 +02:00
|
|
|
bind(EncasedFanTileEntity.class, new EncasedFanTileEntityRenderer());
|
2019-08-06 18:13:33 +02:00
|
|
|
bind(GearboxTileEntity.class, new GearboxTileEntityRenderer());
|
2019-08-29 01:51:28 +02:00
|
|
|
bind(GearshiftTileEntity.class, new SplitShaftTileEntityRenderer());
|
|
|
|
bind(ClutchTileEntity.class, new SplitShaftTileEntityRenderer());
|
2019-08-10 01:00:36 +02:00
|
|
|
bind(BeltTileEntity.class, new BeltTileEntityRenderer());
|
2019-08-17 00:57:36 +02:00
|
|
|
bind(MechanicalPistonTileEntity.class, new MechanicalPistonTileEntityRenderer());
|
2019-09-07 13:12:12 +02:00
|
|
|
bind(MechanicalBearingTileEntity.class, new MechanicalBearingTileEntityRenderer());
|
2019-08-17 00:57:36 +02:00
|
|
|
bind(CrushingWheelTileEntity.class, new KineticTileEntityRenderer());
|
2019-08-20 11:37:32 +02:00
|
|
|
bind(WaterWheelTileEntity.class, new KineticTileEntityRenderer());
|
2019-08-28 16:54:27 +02:00
|
|
|
bind(RedstoneBridgeTileEntity.class, new LinkedTileEntityRenderer());
|
2019-09-05 02:16:44 +02:00
|
|
|
bind(LinkedExtractorTileEntity.class, new LinkedExtractorTileEntityRenderer());
|
|
|
|
bind(ExtractorTileEntity.class, new ExtractorTileEntityRenderer());
|
2019-11-18 16:14:26 +01:00
|
|
|
bind(BeltFunnelTileEntity.class, new BeltFunnelTileEntityRenderer());
|
2019-09-05 02:16:44 +02:00
|
|
|
bind(EntityDetectorTileEntity.class, new EntityDetectorTileEntityRenderer());
|
2019-09-13 18:36:18 +02:00
|
|
|
bind(MechanicalPressTileEntity.class, new MechanicalPressTileEntityRenderer());
|
|
|
|
bind(FlexpeaterTileEntity.class, new FlexpeaterTileEntityRenderer());
|
2019-10-05 19:00:43 +02:00
|
|
|
bind(LogisticalControllerTileEntity.class, new LogisticalControllerTileEntityRenderer());
|
2019-10-11 05:56:32 +02:00
|
|
|
bind(LogisticiansTableTileEntity.class, new LogisticiansTableTileEntityRenderer());
|
2019-10-19 15:42:42 +02:00
|
|
|
bind(HarvesterTileEntity.class, new HarvesterTileEntityRenderer());
|
2019-10-29 19:02:20 +01:00
|
|
|
bind(MechanicalMixerTileEntity.class, new MechanicalMixerTileEntityRenderer());
|
|
|
|
bind(BasinTileEntity.class, new BasinTileEntityRenderer());
|
2019-07-11 19:55:11 +02:00
|
|
|
}
|
|
|
|
|
2019-07-15 12:10:57 +02:00
|
|
|
@OnlyIn(Dist.CLIENT)
|
2019-07-13 12:55:28 +02:00
|
|
|
private static <T extends TileEntity> void bind(Class<T> clazz, TileEntityRenderer<? super T> renderer) {
|
|
|
|
ClientRegistry.bindTileEntitySpecialRenderer(clazz, renderer);
|
|
|
|
}
|
2019-07-11 19:55:11 +02:00
|
|
|
|
|
|
|
}
|