2019-07-11 19:55:11 +02:00
|
|
|
package com.simibubi.create;
|
|
|
|
|
|
|
|
import java.util.function.Supplier;
|
|
|
|
|
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-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-08-29 01:51:28 +02:00
|
|
|
import com.simibubi.create.modules.contraptions.receivers.EncasedFanTileEntity;
|
|
|
|
import com.simibubi.create.modules.contraptions.receivers.EncasedFanTileEntityRenderer;
|
2019-08-17 00:57:36 +02:00
|
|
|
import com.simibubi.create.modules.contraptions.receivers.TurntableTileEntity;
|
|
|
|
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-08-27 17:35:34 +02:00
|
|
|
import com.simibubi.create.modules.economy.ShopShelfTileEntity;
|
2019-08-31 08:37:57 +02:00
|
|
|
import com.simibubi.create.modules.logistics.block.BeltFunnelTileEntity;
|
2019-09-05 02:16:44 +02:00
|
|
|
import com.simibubi.create.modules.logistics.block.EntityDetectorTileEntity;
|
|
|
|
import com.simibubi.create.modules.logistics.block.EntityDetectorTileEntityRenderer;
|
2019-08-28 16:54:27 +02:00
|
|
|
import com.simibubi.create.modules.logistics.block.ExtractorTileEntity;
|
2019-09-05 02:16:44 +02:00
|
|
|
import com.simibubi.create.modules.logistics.block.ExtractorTileEntityRenderer;
|
2019-08-27 17:35:34 +02:00
|
|
|
import com.simibubi.create.modules.logistics.block.FlexcrateTileEntity;
|
2019-08-28 16:54:27 +02:00
|
|
|
import com.simibubi.create.modules.logistics.block.LinkedExtractorTileEntity;
|
2019-09-05 02:16:44 +02:00
|
|
|
import com.simibubi.create.modules.logistics.block.LinkedExtractorTileEntityRenderer;
|
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-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-11 19:55:11 +02:00
|
|
|
import net.minecraftforge.event.RegistryEvent;
|
|
|
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
2019-07-13 12:55:28 +02:00
|
|
|
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
2019-07-11 19:55:11 +02:00
|
|
|
import net.minecraftforge.fml.common.Mod;
|
|
|
|
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
|
|
|
|
|
|
|
|
@Mod.EventBusSubscriber(bus = Bus.MOD)
|
|
|
|
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-08-17 00:57:36 +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-05 02:16:44 +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),
|
|
|
|
DRILL(DrillTileEntity::new, AllBlocks.DRILL),
|
|
|
|
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-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-05 02:16:44 +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-08-28 19:45:41 +02:00
|
|
|
|
2019-08-26 20:21:03 +02:00
|
|
|
// Economy
|
|
|
|
SHOP_SHELF(ShopShelfTileEntity::new, AllBlocks.SHOP_SHELF),
|
2019-08-17 00:57:36 +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
|
|
|
}
|
|
|
|
|
|
|
|
@SubscribeEvent
|
|
|
|
public static void onTileEntityRegistry(final RegistryEvent.Register<TileEntityType<?>> event) {
|
|
|
|
|
|
|
|
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-07-11 19:55:11 +02:00
|
|
|
ResourceLocation resourceLocation = new ResourceLocation(Create.ID, tileEntity.name().toLowerCase());
|
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);
|
|
|
|
event.getRegistry().register(tileEntity.type);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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());
|
|
|
|
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());
|
|
|
|
bind(DrillTileEntity.class, new KineticTileEntityRenderer());
|
|
|
|
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());
|
|
|
|
bind(EntityDetectorTileEntity.class, new EntityDetectorTileEntityRenderer());
|
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
|
|
|
|
|
|
|
}
|