Cleanup of model registration
This commit is contained in:
parent
ec0724b15f
commit
4612ab334c
22 changed files with 35 additions and 86 deletions
|
@ -29,7 +29,6 @@ import java.util.Map;
|
|||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
|
@ -45,6 +44,7 @@ import net.minecraftforge.fml.common.Mod;
|
|||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.client.models.ModelCompound;
|
||||
import reborncore.client.models.RebornModelRegistry;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.blocks.fluid.BlockFluidTechReborn;
|
||||
|
@ -83,48 +83,20 @@ public class ModelRegistryEventHandler {
|
|||
}
|
||||
|
||||
private static void registerBlocks() {
|
||||
register(TRContent.REFINED_IRON_FENCE, "iron_fence");
|
||||
register(TRContent.RUBBER_SAPLING, "misc/rubber_sapling");
|
||||
|
||||
ResourceLocation oresRL = new ResourceLocation(TechReborn.MOD_ID, "ore");
|
||||
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, TRContent.REFINED_IRON_FENCE));
|
||||
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, TRContent.RUBBER_SAPLING));
|
||||
|
||||
for (Ores value : Ores.values()) {
|
||||
registerBlockstateMultiItem(oresRL, Item.getItemFromBlock(value.block), value.name);
|
||||
|
||||
ModelLoader.setCustomStateMapper(value.block, new DefaultStateMapper() {
|
||||
@Override
|
||||
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
|
||||
return new ModelResourceLocation(oresRL, "type=" + value.name);
|
||||
}
|
||||
});
|
||||
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, value.block).setFileName("ore").setInvVariant("type=" + value.name));
|
||||
}
|
||||
|
||||
ResourceLocation storageRL = new ResourceLocation(TechReborn.MOD_ID, "storage_block");
|
||||
for (StorageBlocks value : StorageBlocks.values()) {
|
||||
registerBlockstateMultiItem(storageRL, Item.getItemFromBlock(value.block), value.name);
|
||||
ModelLoader.setCustomStateMapper(value.block, new DefaultStateMapper() {
|
||||
@Override
|
||||
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
|
||||
return new ModelResourceLocation(storageRL, "type=" + value.name);
|
||||
}
|
||||
});
|
||||
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, value.block).setFileName("storage_block").setInvVariant("type=" + value.name));
|
||||
}
|
||||
|
||||
ResourceLocation machineBlockRL = new ResourceLocation(TechReborn.MOD_ID, "machine_block");
|
||||
for (MachineBlocks value : MachineBlocks.values()) {
|
||||
registerBlockstateMultiItem(machineBlockRL, Item.getItemFromBlock(value.frame), value.name + "_machine_frame");
|
||||
ModelLoader.setCustomStateMapper(value.frame, new DefaultStateMapper() {
|
||||
@Override
|
||||
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
|
||||
return new ModelResourceLocation(machineBlockRL, "type=" + value.name + "_machine_frame");
|
||||
}
|
||||
});
|
||||
registerBlockstateMultiItem(machineBlockRL, Item.getItemFromBlock(value.casing), value.name + "_machine_casing");
|
||||
ModelLoader.setCustomStateMapper(value.casing, new DefaultStateMapper() {
|
||||
@Override
|
||||
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
|
||||
return new ModelResourceLocation(machineBlockRL, "type=" + value.name + "_machine_casing");
|
||||
}
|
||||
});
|
||||
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, value.frame).setFileName("machine_block").setInvVariant("type=" + value.name + "_machine_frame"));
|
||||
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, value.casing).setFileName("machine_block").setInvVariant("type=" + value.name + "_machine_casing"));
|
||||
}
|
||||
|
||||
ResourceLocation cableRL = new ResourceLocation(TechReborn.MOD_ID, "cable_inv");
|
||||
|
@ -306,10 +278,6 @@ public class ModelRegistryEventHandler {
|
|||
});
|
||||
}
|
||||
|
||||
private static void register(Block block, String modelPath) {
|
||||
RebornModelRegistry.registerItemModel(Item.getItemFromBlock(block), modelPath);
|
||||
}
|
||||
|
||||
private static void register(Item item, String modelPath) {
|
||||
RebornModelRegistry.registerItemModel(item, modelPath);
|
||||
}
|
||||
|
|
|
@ -113,13 +113,11 @@ public class RegistryEventHandler {
|
|||
RebornRegistry.registerBlock(TRContent.RUBBER_LEAVES = InitUtils.setup(new BlockRubberLeaves(), "rubber_leaves"));
|
||||
RebornRegistry.registerBlock(TRContent.RUBBER_LOG = InitUtils.setup(new BlockRubberLog(), "rubber_log"));
|
||||
RebornRegistry.registerBlock(TRContent.RUBBER_PLANKS = InitUtils.setup(new BlockRubberPlank(), "rubber_planks"));
|
||||
RebornRegistry.registerBlock(TRContent.RUBBER_SAPLING = InitUtils.setup(new BlockRubberSapling(), "rubber_sapling"),
|
||||
ItemBlockRubberSapling.class,
|
||||
"rubber_sapling");
|
||||
RebornRegistry.registerBlockNoItem(TRContent.RUBBER_LOG_SLAB_HALF = InitUtils.setup(new BlockRubberPlankSlab.BlockHalf("rubber_plank"), "rubber_plank_slab"));
|
||||
RebornRegistry.registerBlock(
|
||||
TRContent.RUBBER_SAPLING = InitUtils.setup(new BlockRubberSapling(), "rubber_sapling"),
|
||||
ItemBlockRubberSapling.class,
|
||||
"rubber_sapling");
|
||||
RebornRegistry.registerBlock(
|
||||
TRContent.RUBBER_LOG_SLAB_DOUBLE = InitUtils.setup(new BlockRubberPlankSlab.BlockDouble("rubber_plank", TRContent.RUBBER_LOG_SLAB_HALF), "rubber_plank_double_slab"),
|
||||
RebornRegistry.registerBlock(TRContent.RUBBER_LOG_SLAB_DOUBLE = InitUtils.setup(new BlockRubberPlankSlab.BlockDouble("rubber_plank", TRContent.RUBBER_LOG_SLAB_HALF), "rubber_plank_double_slab"),
|
||||
new ItemSlab(TRContent.RUBBER_LOG_SLAB_HALF, (BlockSlab) TRContent.RUBBER_LOG_SLAB_HALF, (BlockSlab) TRContent.RUBBER_LOG_SLAB_DOUBLE),
|
||||
"rubber_plank_double_slab");
|
||||
RebornRegistry.registerBlock(TRContent.RUBBER_LOG_STAIR = InitUtils.setup(new BlockRubberPlankStair(TRContent.RUBBER_LOG.getDefaultState(), "rubber_plank"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue