Search in sources :

Example 86 with ResourceLocation

use of net.minecraft.util.ResourceLocation in project OpenModularTurrets by OpenModularTurretsTeam.

the class MekanismRecipeHandler method init.

public static void init() {
    String Mek = "Mekanism";
    Item ironEnrichedItem = Item.REGISTRY.getObject(new ResourceLocation(Mek, "EnrichedIron"));
    Item alloyEnrichedItem = Item.REGISTRY.getObject(new ResourceLocation(Mek, "EnrichedAlloy"));
    Item alloyReinforcedItem = Item.REGISTRY.getObject(new ResourceLocation(Mek, "ReinforcedAlloy"));
    Item alloyAtomicItem = Item.REGISTRY.getObject(new ResourceLocation(Mek, "AtomicAlloy"));
    Item energyTabletItem = Item.REGISTRY.getObject(new ResourceLocation(Mek, "EnergyTablet"));
    Item controlCircuitItem = Item.REGISTRY.getObject(new ResourceLocation(Mek, "ControlCircuit"));
    ItemStack ironEnriched;
    ItemStack alloyEnriched;
    ItemStack alloyReinforced;
    ItemStack alloyAtomic;
    ItemStack energyTablet;
    ItemStack controlCircuit;
    /* ModItems */
    if (ironEnrichedItem != null) {
        ironEnriched = new ItemStack(ironEnrichedItem, 1);
    } else {
        postErrorMessage();
        return;
    }
    if (alloyEnrichedItem != null) {
        alloyEnriched = new ItemStack(alloyEnrichedItem, 1);
    } else {
        postErrorMessage();
        return;
    }
    if (alloyReinforcedItem != null) {
        alloyReinforced = new ItemStack(alloyReinforcedItem, 1);
    } else {
        postErrorMessage();
        return;
    }
    if (alloyAtomicItem != null) {
        alloyAtomic = new ItemStack(alloyAtomicItem, 1);
    } else {
        postErrorMessage();
        return;
    }
    if (energyTabletItem != null) {
        energyTablet = new ItemStack(energyTabletItem, 1);
        energyTablet.setItemDamage(OreDictionary.WILDCARD_VALUE);
    } else {
        postErrorMessage();
        return;
    }
    if (controlCircuitItem != null) {
        controlCircuit = new ItemStack(controlCircuitItem, 1);
    } else {
        postErrorMessage();
        return;
    }
    // ModItems
    // Barrels
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.intermediateProductTiered, 1, 11), "CAC", " B ", "CAC", 'A', ironEnriched, 'B', new ItemStack(ModItems.intermediateProductTiered, 1, 10), 'C', "ingotTin"));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.intermediateProductTiered, 1, 12), "CAC", " B ", "CAC", 'A', alloyEnriched, 'B', new ItemStack(ModItems.intermediateProductTiered, 1, 11), 'C', "ingotSteel"));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.intermediateProductTiered, 1, 13), "CAC", " B ", "CAC", 'A', alloyReinforced, 'B', new ItemStack(ModItems.intermediateProductTiered, 1, 12), 'C', "ingotRefinedGlowstone"));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.intermediateProductTiered, 1, 14), "CAC", " B ", "CAC", 'A', alloyAtomic, 'B', new ItemStack(ModItems.intermediateProductTiered, 1, 13), 'C', "ingotRefinedObsidian"));
    // Chambers
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.intermediateProductTiered, 1, 6), "ACA", " BC", "ACA", 'A', ironEnriched, 'B', new ItemStack(ModItems.intermediateProductTiered, 1, 5), 'C', "ingotTin"));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.intermediateProductTiered, 1, 7), "ACA", " BC", "ACA", 'A', alloyEnriched, 'B', new ItemStack(ModItems.intermediateProductTiered, 1, 6), 'C', "ingotSteel"));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.intermediateProductTiered, 1, 8), "ACA", " BC", "ACA", 'A', alloyReinforced, 'B', new ItemStack(ModItems.intermediateProductTiered, 1, 7), 'C', "ingotRefinedGlowstone"));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.intermediateProductTiered, 1, 9), "ACA", " BC", "ACA", 'A', alloyAtomic, 'B', new ItemStack(ModItems.intermediateProductTiered, 1, 8), 'C', "ingotRefinedObsidian"));
    // Sensors
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.intermediateProductTiered, 1, 1), " A ", "DBD", " C ", 'A', ironEnriched, 'B', new ItemStack(ModItems.intermediateProductTiered, 1, 0), 'C', RecipeHandler.ioBus, 'D', controlCircuit));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.intermediateProductTiered, 1, 2), " A ", "DBD", " C ", 'A', alloyEnriched, 'B', new ItemStack(ModItems.intermediateProductTiered, 1, 1), 'C', RecipeHandler.ioBus, 'D', controlCircuit));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.intermediateProductTiered, 1, 3), " A ", "DBD", " C ", 'B', new ItemStack(ModItems.intermediateProductTiered, 1, 2), 'C', RecipeHandler.ioBus, 'D', Items.DIAMOND, 'A', alloyReinforced, 'D', controlCircuit));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.intermediateProductTiered, 1, 4), " A ", "DBD", " C ", 'B', new ItemStack(ModItems.intermediateProductTiered, 1, 3), 'C', RecipeHandler.ioBus, 'A', alloyAtomic, 'D', controlCircuit));
    // Bases
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.turretBase, 1, 1), "ABA", "ECE", "ADA", 'A', ironEnriched, 'B', energyTablet, 'C', new ItemStack(ModItems.intermediateProductTiered, 1, 1), 'D', "ingotTin", 'E', RecipeHandler.ioBus));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.turretBase, 1, 2), "ABA", "ECE", "ADA", 'A', alloyEnriched, 'B', energyTablet, 'C', new ItemStack(ModItems.intermediateProductTiered, 1, 2), 'D', "ingotSteel", 'E', RecipeHandler.ioBus));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.turretBase, 1, 3), "ABA", "ECE", "ADA", 'A', alloyReinforced, 'B', energyTablet, 'C', new ItemStack(ModItems.intermediateProductTiered, 1, 3), 'D', "ingotRefinedGlowstone", 'E', RecipeHandler.ioBus));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.turretBase, 1, 4), "ABA", "ECE", "ADA", 'A', Blocks.OBSIDIAN, 'B', energyTablet, 'C', new ItemStack(ModItems.intermediateProductTiered, 1, 4), 'D', "ingotRefinedObsidian", 'E', RecipeHandler.ioBus));
    //Power Expanders
    GameRegistry.addRecipe(new ShapedOreRecipe(RecipeHandler.expanderPowerTierTwo, "ABA", "ECE", "ADA", 'A', ironEnriched, 'B', energyTablet, 'C', Blocks.REDSTONE_BLOCK, 'D', "ingotTin", 'E', RecipeHandler.ioBus));
    GameRegistry.addRecipe(new ShapedOreRecipe(RecipeHandler.expanderPowerTierThree, "ABA", "ECE", "ADA", 'A', alloyEnriched, 'B', energyTablet, 'C', Blocks.REDSTONE_BLOCK, 'D', "ingotSteel", 'E', RecipeHandler.ioBus));
    GameRegistry.addRecipe(new ShapedOreRecipe(RecipeHandler.expanderPowerTierFour, "ABA", "ECE", "ADA", 'A', alloyReinforced, 'B', energyTablet, 'C', Blocks.REDSTONE_BLOCK, 'D', "ingotRefinedGlowstone", 'E', RecipeHandler.ioBus));
    GameRegistry.addRecipe(new ShapedOreRecipe(RecipeHandler.expanderPowerTierFive, "ABA", "ECE", "ADA", 'A', Blocks.OBSIDIAN, 'B', energyTablet, 'C', Blocks.REDSTONE_BLOCK, 'D', "ingotRefinedObsidian", 'E', RecipeHandler.ioBus));
    //Inventory Expanders
    GameRegistry.addRecipe(new ShapedOreRecipe(RecipeHandler.expanderInvTierTwo, "ABA", "ECE", "ADA", 'A', ironEnriched, 'B', energyTablet, 'C', Blocks.CHEST, 'D', "ingotTin", 'E', RecipeHandler.ioBus));
    GameRegistry.addRecipe(new ShapedOreRecipe(RecipeHandler.expanderInvTierThree, "ABA", "ECE", "ADA", 'A', alloyEnriched, 'B', energyTablet, 'C', Blocks.CHEST, 'D', "ingotSteel", 'E', RecipeHandler.ioBus));
    GameRegistry.addRecipe(new ShapedOreRecipe(RecipeHandler.expanderInvTierFour, "ABA", "ECE", "ADA", 'A', alloyReinforced, 'B', energyTablet, 'C', Blocks.CHEST, 'D', "ingotRefinedGlowstone", 'E', RecipeHandler.ioBus));
    GameRegistry.addRecipe(new ShapedOreRecipe(RecipeHandler.expanderInvTierFive, "ABA", "ECE", "ADA", 'A', Blocks.OBSIDIAN, 'B', energyTablet, 'C', Blocks.CHEST, 'D', "ingotRefinedObsidian", 'E', RecipeHandler.ioBus));
    // Turrets
    if (ConfigHandler.getGunTurretSettings().isEnabled()) {
        GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.machineGunTurret, 1), " A ", "CAC", "DBD", 'A', new ItemStack(ModItems.intermediateProductTiered, 1, 11), 'B', new ItemStack(ModItems.intermediateProductTiered, 1, 6), 'C', "ingotTin", 'D', RecipeHandler.ioBus));
    }
    if (ConfigHandler.getIncendiaryTurretSettings().isEnabled()) {
        GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.incendiaryTurret, 1), "A A", "BCB", "DCD", 'A', new ItemStack(ModItems.intermediateProductTiered, 1, 11), 'B', new ItemStack(ModItems.intermediateProductTiered, 1, 6), 'C', "ingotTin", 'D', RecipeHandler.ioBus));
    }
    if (ConfigHandler.getGrenadeTurretSettings().isEnabled()) {
        GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.grenadeLauncherTurret, 1), " A ", "CBC", "CDC", 'A', new ItemStack(ModItems.intermediateProductTiered, 1, 12), 'B', new ItemStack(ModItems.intermediateProductTiered, 1, 7), 'C', "ingotSteel", 'D', RecipeHandler.ioBus));
    }
    if (ConfigHandler.getRelativisticTurretSettings().isEnabled()) {
        GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.relativisticTurret, 1), "CAC", "ABA", "CDC", 'A', Items.ENDER_PEARL, 'B', new ItemStack(ModItems.intermediateProductTiered, 1, 2), 'C', "ingotSteel", 'D', RecipeHandler.ioBus));
    }
    if (ConfigHandler.getRocketTurretSettings().isEnabled()) {
        GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.rocketTurret, 1), "CAC", "CAC", "EDE", 'A', new ItemStack(ModItems.intermediateProductTiered, 1, 13), 'B', new ItemStack(ModItems.intermediateProductTiered, 1, 8), 'C', "ingotRefinedGlowstone", 'D', RecipeHandler.ioBus, 'E', Items.DIAMOND));
    }
    if (ConfigHandler.getTeleporterTurretSettings().isEnabled()) {
        GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.teleporterTurret, 1), "CEC", "ABA", "CDC", 'A', Items.DIAMOND, 'B', new ItemStack(ModItems.intermediateProductTiered, 1, 3), 'C', Items.ENDER_EYE, 'D', RecipeHandler.ioBus, 'E', Items.DIAMOND));
    }
    if (ConfigHandler.getLaserTurretSettings().isEnabled()) {
        GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.laserTurret, 1), "EAE", "CBC", "DCD", 'A', new ItemStack(ModItems.intermediateProductTiered, 1, 14), 'B', new ItemStack(ModItems.intermediateProductTiered, 1, 9), 'C', Blocks.OBSIDIAN, 'D', RecipeHandler.ioBus, 'E', "ingotRefinedObsidian"));
    }
    if (ConfigHandler.getRailgunTurretSettings().isEnabled()) {
        GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.railGunTurret, 1), "EAE", "CAC", "DBD", 'A', new ItemStack(ModItems.intermediateProductTiered, 1, 14), 'B', new ItemStack(ModItems.intermediateProductTiered, 1, 9), 'C', Blocks.OBSIDIAN, 'D', RecipeHandler.ioBus, 'E', "ingotRefinedObsidian"));
    }
    // Ammo
    GameRegistry.addRecipe(new ShapedOreRecipe(RecipeHandler.ammoRocket, " A ", "ABA", "ACA", 'A', "ingotTin", 'B', Items.GUNPOWDER, 'C', Items.REDSTONE));
    GameRegistry.addRecipe(new ShapedOreRecipe(RecipeHandler.ammoBullet, " A ", " B ", " C ", 'A', "ingotOsmium", 'B', Items.GUNPOWDER, 'C', "ingotIron"));
    GameRegistry.addRecipe(new ShapedOreRecipe(RecipeHandler.ammoGrenade, " C ", "ABA", " A ", 'A', "ingotIron", 'B', Items.GUNPOWDER, 'C', Items.REDSTONE));
    GameRegistry.addRecipe(new ShapedOreRecipe(RecipeHandler.ammoFerroSlug, " C ", "CBC", " A ", 'A', alloyEnriched, 'B', Items.FLINT, 'C', Items.REDSTONE));
}
Also used : Item(net.minecraft.item.Item) ResourceLocation(net.minecraft.util.ResourceLocation) ShapedOreRecipe(net.minecraftforge.oredict.ShapedOreRecipe) ItemStack(net.minecraft.item.ItemStack)

Example 87 with ResourceLocation

use of net.minecraft.util.ResourceLocation in project OpenModularTurrets by OpenModularTurretsTeam.

the class ModEntities method registerProjectiles.

public static void registerProjectiles(OpenModularTurrets mod) {
    EntityTools.registerModEntity(new ResourceLocation(Reference.MOD_ID + ":rocketProjectile"), RocketProjectile.class, Reference.MOD_ID + ":rocketProjectile", 1, mod, 64, 64, true);
    EntityTools.registerModEntity(new ResourceLocation(Reference.MOD_ID + ":grenadeProjectile"), GrenadeProjectile.class, Reference.MOD_ID + ":grenadeProjectile", 2, mod, 64, 64, true);
    EntityTools.registerModEntity(new ResourceLocation(Reference.MOD_ID + ":bulletProjectile"), BulletProjectile.class, Reference.MOD_ID + ":bulletProjectile", 3, mod, 64, 64, true);
    EntityTools.registerModEntity(new ResourceLocation(Reference.MOD_ID + ":laserProjectile"), LaserProjectile.class, Reference.MOD_ID + ":laserProjectile", 4, mod, 64, 64, true);
    EntityTools.registerModEntity(new ResourceLocation(Reference.MOD_ID + ":blazingClayProjectile"), BlazingClayProjectile.class, Reference.MOD_ID + ":blazingClayProjectile", 5, mod, 64, 64, true);
}
Also used : ResourceLocation(net.minecraft.util.ResourceLocation)

Example 88 with ResourceLocation

use of net.minecraft.util.ResourceLocation in project Railcraft by Railcraft.

the class CartContentRenderer method render.

public void render(RenderCart renderer, T cart, float light, float partialTicks) {
    int blockOffset = cart.getDisplayTileOffset();
    IBlockState blockState = cart.getDisplayTile();
    if (blockState.getRenderType() != EnumBlockRenderType.INVISIBLE) {
        GlStateManager.pushMatrix();
        renderer.bindTex(TextureMap.LOCATION_BLOCKS_TEXTURE);
        OpenGL.glTranslatef(-0.5F, (float) (blockOffset - 8) / 16.0F, 0.5F);
        Minecraft.getMinecraft().getBlockRendererDispatcher().renderBlockBrightness(blockState, cart.getBrightness(light));
        GlStateManager.popMatrix();
        renderer.bindTex(cart);
        return;
    }
    ModelTextured contents = CartModelManager.getContentModel(cart.getClass());
    if (contents == CartModelManager.emptyModel)
        return;
    ResourceLocation texture = contents.getTexture();
    if (texture == null)
        return;
    renderer.bindTex(texture);
    OpenGL.glPushAttrib(GL11.GL_ENABLE_BIT);
    if (!contents.cullBackFaces())
        OpenGL.glDisable(GL11.GL_CULL_FACE);
    OpenGL.glPushMatrix();
    OpenGL.glTranslatef(-0.5F, blockOffset / 16.0F - 0.5F, -0.5F);
    contents.render(cart, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
    OpenGL.glEnable(GL11.GL_CULL_FACE);
    OpenGL.glPopMatrix();
    OpenGL.glPopAttrib();
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) ModelTextured(mods.railcraft.client.render.models.programmatic.ModelTextured) ResourceLocation(net.minecraft.util.ResourceLocation)

Example 89 with ResourceLocation

use of net.minecraft.util.ResourceLocation in project Railcraft by Railcraft.

the class MappingRegistry method write.

public void write(NBTTagCompound nbt) {
    NBTTagList blocksMapping = new NBTTagList();
    for (Block b : idToBlock) {
        NBTTagCompound sub = new NBTTagCompound();
        if (b != null) {
            Object obj = Block.REGISTRY.getNameForObject(b);
            if (obj == null) {
                BCLog.logger.error("Block " + b.getUnlocalizedName() + " (" + b.getClass().getName() + ") does not have a registry name! This is a bug!");
            } else {
                String name = obj.toString();
                if (name == null || name.length() == 0) {
                    BCLog.logger.error("Block " + b.getUnlocalizedName() + " (" + b.getClass().getName() + ") has an empty registry name! This is a bug!");
                } else {
                    sub.setString("name", name);
                }
            }
        } else {
            throw new IllegalArgumentException("Found a null block!");
        }
        blocksMapping.appendTag(sub);
    }
    nbt.setTag("blocksMapping", blocksMapping);
    NBTTagList itemsMapping = new NBTTagList();
    for (Item i : idToItem) {
        NBTTagCompound sub = new NBTTagCompound();
        if (i != null) {
            ResourceLocation obj = Item.REGISTRY.getNameForObject(i);
            if (obj == null) {
                BCLog.logger.error("Item " + i.getUnlocalizedName() + " (" + i.getClass().getName() + ") does not have a registry name! This is a bug!");
            } else {
                String name = obj.toString();
                if (name == null || name.length() == 0) {
                    BCLog.logger.error("Item " + i.getUnlocalizedName() + " (" + i.getClass().getName() + ") has an empty registry name! This is a bug!");
                } else {
                    sub.setString("name", name);
                }
            }
        } else {
            throw new IllegalArgumentException("Found a null item!");
        }
        itemsMapping.appendTag(sub);
    }
    nbt.setTag("itemsMapping", itemsMapping);
    NBTTagList entitiesMapping = new NBTTagList();
    for (Class<? extends Entity> e : idToEntity) {
        NBTTagCompound sub = new NBTTagCompound();
        sub.setString("name", e.getCanonicalName());
        entitiesMapping.appendTag(sub);
    }
    nbt.setTag("entitiesMapping", entitiesMapping);
// System.out.println("[W] idToItem size : " + idToItem.size());
// for (Item i : idToItem) {
// System.out.println("- " + (i != null ? i.toString() : "null"));
// }
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) Item(net.minecraft.item.Item) ResourceLocation(net.minecraft.util.ResourceLocation) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) Block(net.minecraft.block.Block)

Example 90 with ResourceLocation

use of net.minecraft.util.ResourceLocation in project Railcraft by Railcraft.

the class MappingRegistry method getMissingMappingFromFML.

private Object getMissingMappingFromFML(boolean isBlock, String name, int i) {
    ResourceLocation location = new ResourceLocation(name);
    String modName = name.split(":")[0];
    if (Loader.isModLoaded(modName)) {
        try {
            FMLMissingMappingsEvent.MissingMapping mapping = new FMLMissingMappingsEvent.MissingMapping(isBlock ? GameRegistry.Type.BLOCK : GameRegistry.Type.ITEM, location, i);
            ListMultimap<String, FMLMissingMappingsEvent.MissingMapping> missingMapping = ArrayListMultimap.create();
            missingMapping.put(modName, mapping);
            FMLMissingMappingsEvent event = new FMLMissingMappingsEvent(missingMapping);
            for (ModContainer container : Loader.instance().getModList()) {
                if (container instanceof FMLModContainer) {
                    event.applyModContainer(container);
                    ((FMLModContainer) container).handleModStateEvent(event);
                    if (mapping.getAction() != FMLMissingMappingsEvent.Action.DEFAULT) {
                        break;
                    }
                }
            }
            if (mapping.getAction() == FMLMissingMappingsEvent.Action.REMAP) {
                return mapping.getTarget();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    return null;
}
Also used : FMLModContainer(net.minecraftforge.fml.common.FMLModContainer) FMLModContainer(net.minecraftforge.fml.common.FMLModContainer) ModContainer(net.minecraftforge.fml.common.ModContainer) ResourceLocation(net.minecraft.util.ResourceLocation) FMLMissingMappingsEvent(net.minecraftforge.fml.common.event.FMLMissingMappingsEvent)

Aggregations

ResourceLocation (net.minecraft.util.ResourceLocation)272 ItemStack (net.minecraft.item.ItemStack)51 Block (net.minecraft.block.Block)47 Item (net.minecraft.item.Item)32 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)31 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)30 IBlockState (net.minecraft.block.state.IBlockState)17 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)15 ArrayList (java.util.ArrayList)14 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)14 Map (java.util.Map)11 EntityPlayer (net.minecraft.entity.player.EntityPlayer)11 ShaderLayer (blusunrize.immersiveengineering.api.shader.ShaderCase.ShaderLayer)10 IOException (java.io.IOException)10 TileEntity (net.minecraft.tileentity.TileEntity)9 IBakedModel (net.minecraft.client.renderer.block.model.IBakedModel)8 EnumFacing (net.minecraft.util.EnumFacing)8 BlockPos (net.minecraft.util.math.BlockPos)8 Random (java.util.Random)7 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)7