2019-07-11 09:03:08 +02:00
|
|
|
package com.simibubi.create;
|
|
|
|
|
2019-08-10 01:00:36 +02:00
|
|
|
import com.simibubi.create.foundation.block.IWithoutBlockItem;
|
2019-08-25 10:14:15 +02:00
|
|
|
import com.simibubi.create.foundation.block.ProperStairsBlock;
|
2019-08-17 00:57:36 +02:00
|
|
|
import com.simibubi.create.foundation.block.RenderUtilityAxisBlock;
|
2019-07-23 12:54:53 +02:00
|
|
|
import com.simibubi.create.foundation.block.RenderUtilityBlock;
|
2019-08-17 00:57:36 +02:00
|
|
|
import com.simibubi.create.modules.contraptions.base.HalfAxisBlock;
|
|
|
|
import com.simibubi.create.modules.contraptions.generators.MotorBlock;
|
2019-08-20 11:37:32 +02:00
|
|
|
import com.simibubi.create.modules.contraptions.generators.WaterWheelBlock;
|
2019-08-17 00:57:36 +02:00
|
|
|
import com.simibubi.create.modules.contraptions.receivers.CrushingWheelBlock;
|
2019-08-22 15:52:15 +02:00
|
|
|
import com.simibubi.create.modules.contraptions.receivers.CrushingWheelControllerBlock;
|
2019-08-17 00:57:36 +02:00
|
|
|
import com.simibubi.create.modules.contraptions.receivers.DrillBlock;
|
|
|
|
import com.simibubi.create.modules.contraptions.receivers.HarvesterBlock;
|
|
|
|
import com.simibubi.create.modules.contraptions.receivers.TurntableBlock;
|
|
|
|
import com.simibubi.create.modules.contraptions.receivers.constructs.ChassisBlock;
|
|
|
|
import com.simibubi.create.modules.contraptions.receivers.constructs.MechanicalPistonBlock;
|
|
|
|
import com.simibubi.create.modules.contraptions.receivers.constructs.MechanicalPistonHeadBlock;
|
|
|
|
import com.simibubi.create.modules.contraptions.receivers.constructs.PistonPoleBlock;
|
|
|
|
import com.simibubi.create.modules.contraptions.redstone.ContactBlock;
|
|
|
|
import com.simibubi.create.modules.contraptions.relays.AxisBlock;
|
|
|
|
import com.simibubi.create.modules.contraptions.relays.AxisTunnelBlock;
|
|
|
|
import com.simibubi.create.modules.contraptions.relays.BeltBlock;
|
|
|
|
import com.simibubi.create.modules.contraptions.relays.CogWheelBlock;
|
|
|
|
import com.simibubi.create.modules.contraptions.relays.EncasedBeltBlock;
|
|
|
|
import com.simibubi.create.modules.contraptions.relays.GearboxBlock;
|
|
|
|
import com.simibubi.create.modules.contraptions.relays.GearshifterBlock;
|
2019-08-27 17:35:34 +02:00
|
|
|
import com.simibubi.create.modules.economy.ShopShelfBlock;
|
2019-08-18 17:02:29 +02:00
|
|
|
import com.simibubi.create.modules.gardens.CocoaLogBlock;
|
2019-08-27 17:35:34 +02:00
|
|
|
import com.simibubi.create.modules.logistics.block.ExtractorBlock;
|
|
|
|
import com.simibubi.create.modules.logistics.block.FlexcrateBlock;
|
|
|
|
import com.simibubi.create.modules.logistics.block.LinkedExtractorBlock;
|
|
|
|
import com.simibubi.create.modules.logistics.block.RedstoneBridgeBlock;
|
|
|
|
import com.simibubi.create.modules.logistics.block.StockswitchBlock;
|
2019-07-23 12:54:53 +02:00
|
|
|
import com.simibubi.create.modules.schematics.block.CreativeCrateBlock;
|
|
|
|
import com.simibubi.create.modules.schematics.block.SchematicTableBlock;
|
|
|
|
import com.simibubi.create.modules.schematics.block.SchematicannonBlock;
|
|
|
|
import com.simibubi.create.modules.symmetry.block.CrossPlaneSymmetryBlock;
|
|
|
|
import com.simibubi.create.modules.symmetry.block.PlaneSymmetryBlock;
|
|
|
|
import com.simibubi.create.modules.symmetry.block.TriplePlaneSymmetryBlock;
|
2019-07-11 09:03:08 +02:00
|
|
|
|
|
|
|
import net.minecraft.block.Block;
|
2019-08-06 18:13:33 +02:00
|
|
|
import net.minecraft.block.Block.Properties;
|
2019-07-11 09:03:08 +02:00
|
|
|
import net.minecraft.block.BlockState;
|
2019-08-06 18:13:33 +02:00
|
|
|
import net.minecraft.block.Blocks;
|
2019-08-25 10:14:15 +02:00
|
|
|
import net.minecraft.block.FenceBlock;
|
|
|
|
import net.minecraft.block.FenceGateBlock;
|
2019-08-17 00:57:36 +02:00
|
|
|
import net.minecraft.block.RotatedPillarBlock;
|
2019-08-25 10:14:15 +02:00
|
|
|
import net.minecraft.block.SlabBlock;
|
|
|
|
import net.minecraft.block.WallBlock;
|
2019-07-11 09:03:08 +02:00
|
|
|
import net.minecraft.item.BlockItem;
|
|
|
|
import net.minecraft.item.Item;
|
|
|
|
import net.minecraftforge.registries.IForgeRegistry;
|
|
|
|
|
|
|
|
public enum AllBlocks {
|
|
|
|
|
2019-08-06 18:13:33 +02:00
|
|
|
// Schematics
|
2019-07-11 19:55:11 +02:00
|
|
|
SCHEMATICANNON(new SchematicannonBlock()),
|
2019-07-23 12:54:53 +02:00
|
|
|
SCHEMATICANNON_CONNECTOR(new RenderUtilityBlock()),
|
|
|
|
SCHEMATICANNON_PIPE(new RenderUtilityBlock()),
|
2019-07-13 12:55:28 +02:00
|
|
|
CREATIVE_CRATE(new CreativeCrateBlock()),
|
2019-07-11 19:55:11 +02:00
|
|
|
SCHEMATIC_TABLE(new SchematicTableBlock()),
|
2019-08-06 18:13:33 +02:00
|
|
|
|
|
|
|
// Kinetics
|
|
|
|
AXIS(new AxisBlock(Properties.from(Blocks.ANDESITE))),
|
|
|
|
GEAR(new CogWheelBlock(false)),
|
|
|
|
LARGE_GEAR(new CogWheelBlock(true)),
|
|
|
|
AXIS_TUNNEL(new AxisTunnelBlock()),
|
2019-08-17 00:57:36 +02:00
|
|
|
ENCASED_BELT(new EncasedBeltBlock()),
|
2019-08-06 18:13:33 +02:00
|
|
|
GEARSHIFTER(new GearshifterBlock()),
|
2019-08-17 00:57:36 +02:00
|
|
|
GEARBOX(new GearboxBlock()),
|
2019-08-10 01:00:36 +02:00
|
|
|
BELT(new BeltBlock()),
|
2019-08-17 00:57:36 +02:00
|
|
|
BELT_PULLEY(new RenderUtilityAxisBlock()),
|
2019-08-10 01:00:36 +02:00
|
|
|
BELT_ANIMATION(new RenderUtilityBlock()),
|
2019-08-25 10:14:15 +02:00
|
|
|
|
2019-08-17 00:57:36 +02:00
|
|
|
MOTOR(new MotorBlock()),
|
2019-08-20 11:37:32 +02:00
|
|
|
WATER_WHEEL(new WaterWheelBlock()),
|
2019-08-25 10:14:15 +02:00
|
|
|
|
2019-08-06 18:13:33 +02:00
|
|
|
TURNTABLE(new TurntableBlock()),
|
|
|
|
HALF_AXIS(new HalfAxisBlock()),
|
2019-08-17 00:57:36 +02:00
|
|
|
CRUSHING_WHEEL(new CrushingWheelBlock()),
|
2019-08-22 15:52:15 +02:00
|
|
|
CRUSHING_WHEEL_CONTROLLER(new CrushingWheelControllerBlock()),
|
2019-08-25 10:14:15 +02:00
|
|
|
|
2019-08-17 00:57:36 +02:00
|
|
|
MECHANICAL_PISTON(new MechanicalPistonBlock(false)),
|
|
|
|
STICKY_MECHANICAL_PISTON(new MechanicalPistonBlock(true)),
|
|
|
|
MECHANICAL_PISTON_HEAD(new MechanicalPistonHeadBlock()),
|
|
|
|
PISTON_POLE(new PistonPoleBlock()),
|
|
|
|
CONSTRUCT(new ChassisBlock(ChassisBlock.Type.NORMAL)),
|
|
|
|
STICKY_CONSTRUCT(new ChassisBlock(ChassisBlock.Type.STICKY)),
|
|
|
|
RELOCATION_CONSTRUCT(new ChassisBlock(ChassisBlock.Type.RELOCATING)),
|
2019-08-25 10:14:15 +02:00
|
|
|
|
2019-08-17 00:57:36 +02:00
|
|
|
DRILL(new DrillBlock()),
|
|
|
|
HARVESTER(new HarvesterBlock()),
|
|
|
|
CONTACT(new ContactBlock()),
|
2019-08-25 10:14:15 +02:00
|
|
|
|
|
|
|
// Logistics
|
|
|
|
REDSTONE_BRIDGE(new RedstoneBridgeBlock()),
|
2019-08-26 20:17:16 +02:00
|
|
|
STOCKSWITCH(new StockswitchBlock()),
|
|
|
|
FLEXCRATE(new FlexcrateBlock()),
|
2019-08-27 17:35:34 +02:00
|
|
|
EXTRACTOR(new ExtractorBlock()),
|
|
|
|
LINKED_EXTRACTOR(new LinkedExtractorBlock()),
|
2019-08-25 10:14:15 +02:00
|
|
|
|
2019-08-06 18:13:33 +02:00
|
|
|
// Symmetry
|
2019-07-19 17:50:23 +02:00
|
|
|
SYMMETRY_PLANE(new PlaneSymmetryBlock()),
|
|
|
|
SYMMETRY_CROSSPLANE(new CrossPlaneSymmetryBlock()),
|
2019-08-06 18:13:33 +02:00
|
|
|
SYMMETRY_TRIPLEPLANE(new TriplePlaneSymmetryBlock()),
|
2019-08-25 10:14:15 +02:00
|
|
|
|
2019-08-18 17:02:29 +02:00
|
|
|
// Gardens
|
|
|
|
COCOA_LOG(new CocoaLogBlock()),
|
2019-08-25 10:14:15 +02:00
|
|
|
|
2019-08-26 20:21:03 +02:00
|
|
|
// Economy
|
2019-08-08 23:10:01 +02:00
|
|
|
SHOP_SHELF(new ShopShelfBlock()),
|
2019-08-26 20:21:03 +02:00
|
|
|
|
2019-08-17 00:57:36 +02:00
|
|
|
// Palettes
|
|
|
|
ANDESITE_BRICKS(new Block(Properties.from(Blocks.ANDESITE))),
|
|
|
|
DIORITE_BRICKS(new Block(Properties.from(Blocks.DIORITE))),
|
|
|
|
GRANITE_BRICKS(new Block(Properties.from(Blocks.GRANITE))),
|
|
|
|
|
|
|
|
GABBRO(new Block(Properties.from(Blocks.ANDESITE))),
|
2019-08-25 10:14:15 +02:00
|
|
|
POLISHED_GABBRO(new Block(Properties.from(GABBRO.block))),
|
|
|
|
GABBRO_BRICKS(new Block(Properties.from(GABBRO.block))),
|
|
|
|
PAVED_GABBRO_BRICKS(new Block(Properties.from(GABBRO.block))),
|
|
|
|
INDENTED_GABBRO(new Block(Properties.from(GABBRO.block))),
|
|
|
|
SLIGHTLY_MOSSY_GABBRO_BRICKS(new Block(Properties.from(GABBRO.block))),
|
|
|
|
MOSSY_GABBRO_BRICKS(new Block(Properties.from(GABBRO.block))),
|
|
|
|
|
2019-08-17 00:57:36 +02:00
|
|
|
LIMESTONE(new Block(Properties.from(Blocks.SANDSTONE))),
|
|
|
|
POLISHED_LIMESTONE(new Block(Properties.from(LIMESTONE.block))),
|
|
|
|
LIMESTONE_BRICKS(new Block(Properties.from(LIMESTONE.block))),
|
|
|
|
LIMESTONE_PILLAR(new RotatedPillarBlock(Properties.from(LIMESTONE.block))),
|
2019-08-25 10:14:15 +02:00
|
|
|
|
2019-08-17 00:57:36 +02:00
|
|
|
QUARTZIORITE(new Block(Properties.from(Blocks.QUARTZ_BLOCK))),
|
|
|
|
QUARTZIORITE_BRICKS(new Block(Properties.from(QUARTZIORITE.block))),
|
|
|
|
POLISHED_QUARTZIORITE(new Block(Properties.from(QUARTZIORITE.block))),
|
2019-08-25 10:14:15 +02:00
|
|
|
|
2019-08-17 00:57:36 +02:00
|
|
|
DOLOMITE(new Block(Properties.from(Blocks.GRANITE))),
|
|
|
|
DOLOMITE_BRICKS(new Block(Properties.from(DOLOMITE.block))),
|
|
|
|
POLISHED_DOLOMITE(new Block(Properties.from(DOLOMITE.block))),
|
|
|
|
DOLOMITE_PILLAR(new RotatedPillarBlock(Properties.from(DOLOMITE.block))),
|
2019-08-25 10:14:15 +02:00
|
|
|
|
2019-08-06 18:13:33 +02:00
|
|
|
;
|
2019-07-11 09:03:08 +02:00
|
|
|
|
2019-08-25 10:14:15 +02:00
|
|
|
private enum ComesWith {
|
|
|
|
WALL, FENCE, FENCE_GATE, SLAB, STAIRS;
|
|
|
|
}
|
|
|
|
|
2019-07-11 09:03:08 +02:00
|
|
|
public Block block;
|
2019-08-25 10:14:15 +02:00
|
|
|
public Block[] alsoRegistered;
|
2019-07-11 09:03:08 +02:00
|
|
|
|
2019-08-25 10:14:15 +02:00
|
|
|
private AllBlocks(Block block, ComesWith... comesWith) {
|
2019-07-11 09:03:08 +02:00
|
|
|
this.block = block;
|
|
|
|
this.block.setRegistryName(Create.ID, this.name().toLowerCase());
|
2019-08-25 10:14:15 +02:00
|
|
|
|
|
|
|
alsoRegistered = new Block[comesWith.length];
|
|
|
|
for (int i = 0; i < comesWith.length; i++)
|
|
|
|
alsoRegistered[i] = makeRelatedBlock(block, comesWith[i]);
|
2019-07-11 09:03:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void registerBlocks(IForgeRegistry<Block> registry) {
|
|
|
|
for (AllBlocks block : values()) {
|
|
|
|
registry.register(block.block);
|
2019-08-25 10:14:15 +02:00
|
|
|
for (Block extra : block.alsoRegistered)
|
|
|
|
registry.register(extra);
|
2019-07-11 09:03:08 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void registerItemBlocks(IForgeRegistry<Item> registry) {
|
|
|
|
for (AllBlocks block : values()) {
|
2019-08-10 01:00:36 +02:00
|
|
|
if (block.get() instanceof IWithoutBlockItem)
|
2019-07-11 09:03:08 +02:00
|
|
|
continue;
|
|
|
|
|
2019-08-25 10:14:15 +02:00
|
|
|
registerAsItem(registry, block.get());
|
|
|
|
for (Block extra : block.alsoRegistered)
|
|
|
|
registerAsItem(registry, extra);
|
2019-07-11 09:03:08 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-25 10:14:15 +02:00
|
|
|
private static void registerAsItem(IForgeRegistry<Item> registry, Block blockIn) {
|
|
|
|
registry.register(
|
|
|
|
new BlockItem(blockIn, AllItems.standardProperties()).setRegistryName(blockIn.getRegistryName()));
|
|
|
|
}
|
|
|
|
|
2019-07-11 09:03:08 +02:00
|
|
|
public Block get() {
|
|
|
|
return block;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean typeOf(BlockState state) {
|
|
|
|
return state.getBlock() == block;
|
|
|
|
}
|
|
|
|
|
2019-08-25 10:14:15 +02:00
|
|
|
private Block makeRelatedBlock(Block block, ComesWith feature) {
|
|
|
|
Properties properties = Properties.from(block);
|
|
|
|
Block featured = null;
|
|
|
|
|
|
|
|
switch (feature) {
|
|
|
|
case FENCE:
|
|
|
|
featured = new FenceBlock(properties);
|
|
|
|
break;
|
|
|
|
case SLAB:
|
|
|
|
featured = new SlabBlock(properties);
|
|
|
|
break;
|
|
|
|
case STAIRS:
|
|
|
|
featured = new ProperStairsBlock(block);
|
|
|
|
break;
|
|
|
|
case WALL:
|
|
|
|
featured = new WallBlock(properties);
|
|
|
|
break;
|
|
|
|
case FENCE_GATE:
|
|
|
|
featured = new FenceGateBlock(properties);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return featured.setRegistryName(Create.ID,
|
|
|
|
block.getRegistryName().getPath() + "_" + feature.name().toLowerCase());
|
|
|
|
}
|
|
|
|
|
2019-07-11 09:03:08 +02:00
|
|
|
}
|