use of forestry.arboriculture.blocks.BlockForestryStairs in project Binnie by ForestryMC.
the class ModuleWood method registerItemsAndBlocks.
@Override
public void registerItemsAndBlocks() {
MinecraftForge.EVENT_BUS.register(this);
WoodAccess woodAccess = WoodAccess.getInstance();
registerPlanks();
logs = BlockETLog.create(false);
logsFireproof = BlockETLog.create(true);
for (BlockETLog block : logs) {
ExtraTrees.proxy.registerBlock(block, new ItemBlockETWood<>(block));
registerOreDictWildcard(OreDictUtil.LOG_WOOD, block);
}
logsFireproof = BlockETLog.create(true);
for (BlockETLog block : logsFireproof) {
ExtraTrees.proxy.registerBlock(block, new ItemBlockETWood<>(block));
registerOreDictWildcard(OreDictUtil.LOG_WOOD, block);
}
woodAccess.registerLogs(logs);
woodAccess.registerLogs(logsFireproof);
planks = BlockETPlank.create(false);
for (BlockETPlank block : planks) {
ExtraTrees.proxy.registerBlock(block, new ItemBlockETWood<>(block));
registerOreDictWildcard(OreDictUtil.PLANK_WOOD, block);
}
planksFireproof = BlockETPlank.create(true);
for (BlockETPlank block : planksFireproof) {
ExtraTrees.proxy.registerBlock(block, new ItemBlockETWood<>(block));
registerOreDictWildcard(OreDictUtil.PLANK_WOOD, block);
}
woodAccess.registerPlanks(planks);
woodAccess.registerPlanks(planksFireproof);
slabs = BlockETSlab.create(false, false);
slabsDouble = BlockETSlab.create(false, true);
for (int i = 0; i < slabs.size(); i++) {
BlockETSlab slab = slabs.get(i);
BlockETSlab slabDouble = slabsDouble.get(i);
ExtraTrees.proxy.registerBlock(slab, new ItemETSlab(slab, slab, slabDouble));
ExtraTrees.proxy.registerBlock(slabDouble, new ItemETSlab(slabDouble, slab, slabDouble));
registerOreDictWildcard(OreDictUtil.SLAB_WOOD, slab);
}
slabsFireproof = BlockETSlab.create(true, false);
slabsDoubleFireproof = BlockETSlab.create(true, true);
for (int i = 0; i < slabsFireproof.size(); i++) {
BlockETSlab slab = slabsFireproof.get(i);
BlockETSlab slabDouble = slabsDoubleFireproof.get(i);
ExtraTrees.proxy.registerBlock(slab, new ItemETSlab(slab, slab, slabDouble));
ExtraTrees.proxy.registerBlock(slabDouble, new ItemETSlab(slabDouble, slab, slabDouble));
registerOreDictWildcard(OreDictUtil.SLAB_WOOD, slab);
}
woodAccess.registerSlabs(slabs);
woodAccess.registerSlabs(slabsFireproof);
stairs = new ArrayList<>();
for (BlockETPlank plank : planks) {
for (IBlockState blockState : plank.getBlockState().getValidStates()) {
int meta = plank.getMetaFromState(blockState);
EnumETLog woodType = plank.getWoodType(meta);
BlockForestryStairs<EnumETLog> stair = new BlockForestryStairs<>(false, blockState, woodType);
String name = "stairs." + woodType;
stair.setRegistryName(new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, name));
stair.setUnlocalizedName(name);
ExtraTrees.proxy.registerBlock(stair, new ItemBlockETWood<>(stair));
stairs.add(stair);
registerOreDictWildcard(OreDictUtil.STAIR_WOOD, stair);
}
}
stairsFireproof = new ArrayList<>();
for (BlockETPlank plank : planksFireproof) {
for (IBlockState blockState : plank.getBlockState().getValidStates()) {
int meta = plank.getMetaFromState(blockState);
EnumETLog woodType = plank.getWoodType(meta);
BlockForestryStairs<EnumETLog> stair = new BlockForestryStairs<>(true, blockState, woodType);
String name = "stairs.fireproof." + woodType;
stair.setRegistryName(new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, name));
stair.setUnlocalizedName(name);
ExtraTrees.proxy.registerBlock(stair, new ItemBlockETWood<>(stair));
stairsFireproof.add(stair);
registerOreDictWildcard(OreDictUtil.STAIR_WOOD, stair);
}
}
woodAccess.registerStairs(stairs);
woodAccess.registerStairs(stairsFireproof);
fences = BlockETFence.create(false);
for (BlockETFence block : fences) {
ExtraTrees.proxy.registerBlock(block, new ItemBlockETWood<>(block));
registerOreDictWildcard(OreDictUtil.FENCE_WOOD, block);
FMLInterModComms.sendMessage("forestry", "add-fence-block", block.getRegistryName().toString());
}
fencesFireproof = BlockETFence.create(true);
for (BlockETFence block : fencesFireproof) {
ExtraTrees.proxy.registerBlock(block, new ItemBlockETWood<>(block));
registerOreDictWildcard(OreDictUtil.FENCE_WOOD, block);
FMLInterModComms.sendMessage("forestry", "add-fence-block", block.getRegistryName().toString());
}
woodAccess.registerFences(fences);
woodAccess.registerFences(fencesFireproof);
fenceGates = new ArrayList<>();
fenceGatesFireproof = new ArrayList<>();
for (ExtraTreePlanks plankType : ExtraTreePlanks.VALUES) {
EnumETLog woodType = plankType.getWoodType();
BlockForestryFenceGate<EnumETLog> fenceGate = new BlockForestryFenceGate<>(false, woodType);
String name = "fence.gates." + woodType;
fenceGate.setRegistryName(new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, name));
fenceGate.setUnlocalizedName(name);
ExtraTrees.proxy.registerBlock(fenceGate, new ItemBlockETWood<>(fenceGate));
registerOreDictWildcard(OreDictUtil.FENCE_GATE_WOOD, fenceGate);
fenceGates.add(fenceGate);
FMLInterModComms.sendMessage("forestry", "add-fence-block", fenceGate.getRegistryName().toString());
BlockForestryFenceGate<EnumETLog> fenceGateFireproof = new BlockForestryFenceGate<>(true, woodType);
String nameFireproof = "fence.gates.fireproof." + woodType;
fenceGateFireproof.setRegistryName(new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, nameFireproof));
fenceGateFireproof.setUnlocalizedName(nameFireproof);
ExtraTrees.proxy.registerBlock(fenceGateFireproof, new ItemBlockETWood<>(fenceGateFireproof));
registerOreDictWildcard(OreDictUtil.FENCE_GATE_WOOD, fenceGateFireproof);
fenceGatesFireproof.add(fenceGateFireproof);
FMLInterModComms.sendMessage("forestry", "add-fence-block", fenceGateFireproof.getRegistryName().toString());
}
// Forestry's API doesn't allow typed lists to be registered, but making a new one allows us to get away with it
woodAccess.registerFenceGates(new ArrayList<>(fenceGates));
woodAccess.registerFenceGates(new ArrayList<>(fenceGatesFireproof));
doors = new ArrayList<>();
for (EnumETLog woodType : EnumETLog.VALUES) {
if (woodType.hasProducts()) {
BlockETDoor door = new BlockETDoor(woodType);
ExtraTrees.proxy.registerBlock(door, new ItemBlockETWoodDoor(door));
registerOreDictWildcard(OreDictUtil.DOOR_WOOD, door);
doors.add(door);
}
}
registerDoors(woodAccess, doors);
blockMultiFence = new BlockMultiFence();
ExtraTrees.proxy.registerBlock(blockMultiFence, new ItemMetadata(blockMultiFence));
leavesDefault = BlockETDefaultLeaves.create();
Map speciesToLeavesDefault = ModuleArboriculture.getBlocks().speciesToLeavesDefault;
for (BlockETDefaultLeaves leaves : leavesDefault) {
ExtraTrees.proxy.registerBlock(leaves, new ItemBlockLeaves(leaves));
registerOreDictWildcard(OreDictUtil.TREE_LEAVES, leaves);
PropertyETType treeType = leaves.getVariant();
for (ETTreeDefinition treeDefinition : treeType.getAllowedValues()) {
Preconditions.checkNotNull(treeDefinition);
String speciesUid = treeDefinition.getUID();
IBlockState blockState = leaves.getDefaultState().withProperty(treeType, treeDefinition);
speciesToLeavesDefault.put(speciesUid, blockState);
}
}
leavesDecorative = BlockETDecorativeLeaves.create();
speciesToLeavesDecorative = new HashMap<>();
for (BlockETDecorativeLeaves leaves : leavesDecorative) {
ExtraTrees.proxy.registerBlock(leaves, new ItemBlockETDecorativeLeaves(leaves));
registerOreDictWildcard(OreDictUtil.TREE_LEAVES, leaves);
for (IBlockState state : leaves.getBlockState().getValidStates()) {
ETTreeDefinition treeDefinition = state.getValue(leaves.getVariant());
String speciesUid = treeDefinition.getUID();
int meta = leaves.getMetaFromState(state);
speciesToLeavesDecorative.put(speciesUid, new ItemStack(leaves, 1, meta));
}
}
shrubLog = new BlockShrubLog();
ExtraTrees.proxy.registerBlock(shrubLog, new ItemBlockETWood<>(shrubLog));
woodAccess.register(EnumShrubLog.INSTANCE, WoodBlockKind.LOG, false, shrubLog.getStateFromMeta(0), new ItemStack(shrubLog, 1, 0));
woodAccess.register(EnumShrubLog.INSTANCE, WoodBlockKind.LOG, true, shrubLog.getStateFromMeta(1), new ItemStack(shrubLog, 1, 1));
}
Aggregations