use of ferro2000.immersivetech.common.items.ItemITBase in project Immersive-Tech by FerroO2000.
the class ITContent method preInit.
public static void preInit() {
/*BLOCKS*/
/*MULTIBLOCKS*/
blockMetalMultiblock = new BlockMetalMultiblock();
blockStoneMultiblock = new BlockStoneMultiblock();
/*CONNECTORS*/
blockConnectors = new BlockConnectors();
/*METAL*/
// blockMetalDevice = new BlockMetalDevice();
/*STONE*/
blockStoneDecoration = new BlockStoneDecoration();
/*FLUIDS*/
fluidDistWater = new Fluid("dist_water", new ResourceLocation("immersivetech:blocks/fluid/dist_water_still"), new ResourceLocation("immersivetech:blocks/fluid/dist_water_flow")).setDensity(1000).setViscosity(1000);
if (!FluidRegistry.registerFluid(fluidDistWater)) {
fluidDistWater = FluidRegistry.getFluid("distwater");
}
FluidRegistry.addBucketForFluid(fluidDistWater);
fluidSteam = new Fluid("steam", new ResourceLocation("immersivetech:blocks/fluid/steam_still"), new ResourceLocation("immersivetech:blocks/fluid/steam_flow")).setDensity(-100).setViscosity(500).setGaseous(true);
if (!FluidRegistry.registerFluid(fluidSteam)) {
fluidSteam = FluidRegistry.getFluid("steam");
}
FluidRegistry.addBucketForFluid(fluidSteam);
/*FLUID BLOCKS*/
blockFluidDistWater = new BlockITFluid("fluidDistWater", fluidDistWater, Material.WATER);
blockFluidSteam = new BlockITFluid("fluidSteam", fluidSteam, Material.WATER);
/*ITEMS*/
/*MATERIALS*/
itemMaterial = new ItemITBase("material", 64, "salt");
}
use of ferro2000.immersivetech.common.items.ItemITBase in project Immersive-Tech by FerroO2000.
the class ClientProxy method registerModels.
/**
* @author BluSunrize
*/
@SubscribeEvent
public static void registerModels(ModelRegistryEvent evt) {
WireApi.registerConnectorForRender("conn_timer", new ResourceLocation("immersivetech:block/connector/connectors_timer.obj.ie"), null);
for (Block block : ITContent.registeredITBlocks) {
final ResourceLocation loc = Block.REGISTRY.getNameForObject(block);
Item blockItem = Item.getItemFromBlock(block);
if (blockItem == null)
throw new RuntimeException("ITEMBLOCK FOR " + loc + " : " + block + " IS NULL");
if (block instanceof IIEMetaBlock) {
IIEMetaBlock ieMetaBlock = (IIEMetaBlock) block;
if (ieMetaBlock.useCustomStateMapper())
ModelLoader.setCustomStateMapper(block, IECustomStateMapper.getStateMapper(ieMetaBlock));
ModelLoader.setCustomMeshDefinition(blockItem, new ItemMeshDefinition() {
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
return new ModelResourceLocation(loc, "inventory");
}
});
for (int meta = 0; meta < ieMetaBlock.getMetaEnums().length; meta++) {
String location = loc.toString();
String prop = ieMetaBlock.appendPropertiesToState() ? ("inventory," + ieMetaBlock.getMetaProperty().getName() + "=" + ieMetaBlock.getMetaEnums()[meta].toString().toLowerCase(Locale.US)) : null;
if (ieMetaBlock.useCustomStateMapper()) {
String custom = ieMetaBlock.getCustomStateMapping(meta, true);
if (custom != null)
location += "_" + custom;
}
try {
ModelLoader.setCustomModelResourceLocation(blockItem, meta, new ModelResourceLocation(location, prop));
} catch (NullPointerException npe) {
throw new RuntimeException("WELP! apparently " + ieMetaBlock + " lacks an item!", npe);
}
}
} else if (block instanceof BlockITFluid)
mapFluidState(block, ((BlockITFluid) block).getFluid());
else
ModelLoader.setCustomModelResourceLocation(blockItem, 0, new ModelResourceLocation(loc, "inventory"));
}
for (Item item : ITContent.registeredITItems) {
if (item instanceof ItemBlock)
continue;
if (item instanceof ItemITBase) {
ItemITBase ipMetaItem = (ItemITBase) item;
if (ipMetaItem.registerSubModels && ipMetaItem.getSubNames() != null && ipMetaItem.getSubNames().length > 0) {
for (int meta = 0; meta < ipMetaItem.getSubNames().length; meta++) {
ResourceLocation loc = new ResourceLocation(ImmersiveTech.MODID, ipMetaItem.itemName + "/" + ipMetaItem.getSubNames()[meta]);
ModelBakery.registerItemVariants(ipMetaItem, loc);
ModelLoader.setCustomModelResourceLocation(ipMetaItem, meta, new ModelResourceLocation(loc, "inventory"));
}
} else {
final ResourceLocation loc = new ResourceLocation(ImmersiveTech.MODID, ipMetaItem.itemName);
ModelBakery.registerItemVariants(ipMetaItem, loc);
ModelLoader.setCustomMeshDefinition(ipMetaItem, new ItemMeshDefinition() {
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
return new ModelResourceLocation(loc, "inventory");
}
});
}
} else {
final ResourceLocation loc = Item.REGISTRY.getNameForObject(item);
ModelBakery.registerItemVariants(item, loc);
ModelLoader.setCustomMeshDefinition(item, new ItemMeshDefinition() {
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
return new ModelResourceLocation(loc, "inventory");
}
});
}
}
}
Aggregations