use of net.minecraft.client.renderer.block.model.ModelResourceLocation in project EnderIO by SleepyTrousers.
the class BlockDecorationFacing method registerRenderers.
@Override
@SideOnly(Side.CLIENT)
public void registerRenderers(@Nonnull IModObject modObject) {
Item item = Item.getItemFromBlock(this);
Map<IBlockState, ModelResourceLocation> locations = new DefaultStateMapper().putStateModelLocations(this);
NNIterator<EnumDecoBlock> iterator = NNList.of(EnumDecoBlock.class).iterator();
while (iterator.hasNext()) {
EnumDecoBlock type = iterator.next();
IBlockState state = getDefaultState().withProperty(EnumDecoBlock.TYPE, type).withProperty(FACING, EnumFacing.NORTH).withProperty(ACTIVE, false);
ModelResourceLocation mrl = locations.get(state);
if (mrl != null) {
ModelLoader.setCustomModelResourceLocation(item, EnumDecoBlock.getMetaFromType(type), mrl);
}
}
}
use of net.minecraft.client.renderer.block.model.ModelResourceLocation in project EnderIO by SleepyTrousers.
the class ItemConduitFacade method registerRenderers.
@Override
public void registerRenderers(@Nonnull IModObject modObject) {
for (EnumFacadeType type : EnumFacadeType.values()) {
final ModelResourceLocation mrl = new ModelResourceLocation(NullHelper.notnull(getRegistryName(), "unregistered item?"), "type=" + type.getName());
ModelLoader.setCustomModelResourceLocation(this, EnumFacadeType.getMetaFromType(type), mrl);
ItemModelRegistry.registerFacade(mrl);
}
}
use of net.minecraft.client.renderer.block.model.ModelResourceLocation in project HorsePower by GoryMoon.
the class ModModelManager method registerBlockItemModel.
/**
* Register a single model for the {@link Block}'s {@link Item}.
* <p>
* Uses the registry name as the domain/path and the {@link IBlockState} as the variant.
*
* @param state The state to use as the variant
*/
private void registerBlockItemModel(IBlockState state) {
final Block block = state.getBlock();
final Item item = Item.getItemFromBlock(block);
if (item != null) {
registerItemModel(item, new ModelResourceLocation(block.getRegistryName(), propertyStringMapper.getPropertyString(state.getProperties())));
}
}
use of net.minecraft.client.renderer.block.model.ModelResourceLocation in project HorsePower by GoryMoon.
the class ModModelManager method registerItemModel.
/**
* Register a single model for an {@link Item}.
* <p>
* Uses {@code modelLocation} as the domain/path and {@link "inventory"} as the variant.
*
* @param item The Item
* @param modelLocation The model location
*/
private void registerItemModel(Item item, String modelLocation) {
final ModelResourceLocation fullModelLocation = new ModelResourceLocation(modelLocation, "inventory");
registerItemModel(item, fullModelLocation);
}
use of net.minecraft.client.renderer.block.model.ModelResourceLocation in project OpenModularTurrets by OpenModularTurretsTeam.
the class ModTESRItems method init.
@SuppressWarnings("ConstantConditions")
@SideOnly(Side.CLIENT)
public static void init() {
if (OMTConfigHandler.getDisposableTurretSettings().isEnabled()) {
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.disposableItemTurret), 0, DisposableItemTurretTileEntity.class);
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.disposableItemTurret), 0, new ModelResourceLocation(ModBlocks.disposableItemTurret.getRegistryName(), "inventory"));
}
if (OMTConfigHandler.getPotatoCannonTurretSettings().isEnabled()) {
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.potatoCannonTurret), 0, PotatoCannonTurretTileEntity.class);
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.potatoCannonTurret), 0, new ModelResourceLocation(ModBlocks.potatoCannonTurret.getRegistryName(), "inventory"));
}
if (OMTConfigHandler.getGunTurretSettings().isEnabled()) {
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.machineGunTurret), 0, GunTurretTileEntity.class);
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.machineGunTurret), 0, new ModelResourceLocation(ModBlocks.machineGunTurret.getRegistryName(), "inventory"));
}
if (OMTConfigHandler.getIncendiaryTurretSettings().isEnabled()) {
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.incendiaryTurret), 0, IncendiaryTurretTileEntity.class);
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.incendiaryTurret), 0, new ModelResourceLocation(ModBlocks.incendiaryTurret.getRegistryName(), "inventory"));
}
if (OMTConfigHandler.getRelativisticTurretSettings().isEnabled()) {
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.relativisticTurret), 0, RelativisticTurretTileEntity.class);
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.relativisticTurret), 0, new ModelResourceLocation(ModBlocks.relativisticTurret.getRegistryName(), "inventory"));
}
if (OMTConfigHandler.getGrenadeTurretSettings().isEnabled()) {
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.grenadeLauncherTurret), 0, GrenadeLauncherTurretTileEntity.class);
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.grenadeLauncherTurret), 0, new ModelResourceLocation(ModBlocks.grenadeLauncherTurret.getRegistryName(), "inventory"));
}
if (OMTConfigHandler.getRocketTurretSettings().isEnabled()) {
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.rocketTurret), 0, RocketTurretTileEntity.class);
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.rocketTurret), 0, new ModelResourceLocation(ModBlocks.rocketTurret.getRegistryName(), "inventory"));
}
if (OMTConfigHandler.getTeleporterTurretSettings().isEnabled()) {
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.teleporterTurret), 0, TeleporterTurretTileEntity.class);
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.teleporterTurret), 0, new ModelResourceLocation(ModBlocks.teleporterTurret.getRegistryName(), "inventory"));
}
if (OMTConfigHandler.getLaserTurretSettings().isEnabled()) {
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.laserTurret), 0, LaserTurretTileEntity.class);
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.laserTurret), 0, new ModelResourceLocation(ModBlocks.laserTurret.getRegistryName(), "inventory"));
}
if (OMTConfigHandler.getRailgunTurretSettings().isEnabled()) {
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.railGunTurret), 0, RailGunTurretTileEntity.class);
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.railGunTurret), 0, new ModelResourceLocation(ModBlocks.railGunTurret.getRegistryName(), "inventory"));
}
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.leverBlock), 0, LeverTileEntity.class);
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(ModBlocks.leverBlock), 0, new ModelResourceLocation(ModBlocks.leverBlock.getRegistryName(), "inventory"));
}
Aggregations