Search in sources :

Example 96 with ResourceLocation

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

the class JSONModelRenderer method loadModels.

@SubscribeEvent
public void loadModels(TextureStitchEvent.Pre event) {
    final TextureMap map = event.getMap();
    for (ResourceLocation modelLocation : modelLocations) {
        IModel model = ModelManager.getModel(modelLocation);
        models.put(modelLocation, model);
        model.getTextures().forEach(map::registerSprite);
    }
}
Also used : IModel(net.minecraftforge.client.model.IModel) TextureMap(net.minecraft.client.renderer.texture.TextureMap) ResourceLocation(net.minecraft.util.ResourceLocation) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 97 with ResourceLocation

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

the class ModelManager method registerItemModel.

public static void registerItemModel(Item item, int meta, String domain, String json) {
    ModelResourceLocation location = new ModelResourceLocation(new ResourceLocation(domain, json), "inventory");
    registerItemModel(item, meta, location);
}
Also used : ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) ResourceLocation(net.minecraft.util.ResourceLocation) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation)

Example 98 with ResourceLocation

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

the class OutfittedTrackModel method getDependencies.

@Override
public Collection<ResourceLocation> getDependencies() {
    if (trackTypeModelsLocations.isEmpty()) {
        for (TrackType trackType : TrackRegistry.TRACK_TYPE) {
            for (BlockRailBase.EnumRailDirection shape : BlockTrackOutfitted.SHAPE.getAllowedValues()) {
                trackTypeModelsLocations.add(getTrackTypeModelLocation(trackType, shape));
            }
        }
    }
    if (trackKitModelsLocations.isEmpty()) {
        TrackRegistry.TRACK_KIT.stream().filter(t -> t.getRenderer() == TrackKit.Renderer.COMPOSITE).forEach(t -> {
            EnumSet<BlockRailBase.EnumRailDirection> shapes = EnumSet.copyOf(BlockTrackOutfitted.SHAPE.getAllowedValues());
            if (!t.isAllowedOnSlopes()) {
                shapes.removeIf(s -> !TrackShapeHelper.isLevelStraight(s));
            }
            for (BlockRailBase.EnumRailDirection shape : shapes) {
                for (int state = 0; state < t.getRenderStates(); state++) trackKitModelsLocations.add(getTrackKitModelLocation(t, shape, state));
            }
        });
    }
    if (unifiedModelsLocations.isEmpty()) {
        TrackRegistry.TRACK_KIT.stream().filter(t -> t.getRenderer() == TrackKit.Renderer.UNIFIED).forEach(trackKit -> {
            EnumSet<BlockRailBase.EnumRailDirection> shapes = EnumSet.copyOf(BlockTrackOutfitted.SHAPE.getAllowedValues());
            if (!trackKit.isAllowedOnSlopes()) {
                shapes.removeIf(s -> !TrackShapeHelper.isLevelStraight(s));
            }
            for (TrackType trackType : TrackRegistry.TRACK_TYPE) for (BlockRailBase.EnumRailDirection shape : shapes) {
                for (int state = 0; state < trackKit.getRenderStates(); state++) unifiedModelsLocations.add(getUnifiedModelLocation(trackType, trackKit, shape, state));
            }
        });
    }
    if (models.isEmpty()) {
        models.addAll(trackTypeModelsLocations);
        models.addAll(trackKitModelsLocations);
        models.addAll(unifiedModelsLocations);
    }
    return models;
}
Also used : BlockTrackOutfitted(mods.railcraft.common.blocks.tracks.outfitted.BlockTrackOutfitted) java.util(java.util) Function(com.google.common.base.Function) IExtendedBlockState(net.minecraftforge.common.property.IExtendedBlockState) IModelState(net.minecraftforge.common.model.IModelState) TrackShapeHelper(mods.railcraft.common.blocks.tracks.TrackShapeHelper) EnumFacing(net.minecraft.util.EnumFacing) IOException(java.io.IOException) IModel(net.minecraftforge.client.model.IModel) TrackKit(mods.railcraft.api.tracks.TrackKit) TrackTypes(mods.railcraft.common.blocks.tracks.behaivor.TrackTypes) IBlockState(net.minecraft.block.state.IBlockState) ICustomModelLoader(net.minecraftforge.client.model.ICustomModelLoader) BlockRailBase(net.minecraft.block.BlockRailBase) TrackType(mods.railcraft.api.tracks.TrackType) IResourceManager(net.minecraft.client.resources.IResourceManager) ResourceLocation(net.minecraft.util.ResourceLocation) TrackRegistry(mods.railcraft.api.tracks.TrackRegistry) VertexFormat(net.minecraft.client.renderer.vertex.VertexFormat) Nullable(javax.annotation.Nullable) net.minecraft.client.renderer.block.model(net.minecraft.client.renderer.block.model) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) TrackType(mods.railcraft.api.tracks.TrackType) BlockRailBase(net.minecraft.block.BlockRailBase)

Example 99 with ResourceLocation

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

the class ThaumcraftPlugin method setupResearch.

public static void setupResearch() {
    ResearchCategories.registerCategory(RESEARCH_CATEGORY, null, new ResourceLocation("railcraft", "textures/items/tool.crowbar.magic.png"), new ResourceLocation("thaumcraft", "textures/gui/gui_researchback.png"));
    // Apothecaries Backpack
    Item item = RailcraftItems.BACKPACK_APOTHECARY_T1.item();
    if (item != null) {
        IArcaneRecipe recipe = ThaumcraftApi.addArcaneCraftingRecipe("RC_ApothecariesBackpack", RailcraftItems.BACKPACK_APOTHECARY_T1.getStack(), new AspectList().add(Aspect.AIR, 16).add(Aspect.ORDER, 16), "X#X", "VYV", "X#X", '#', Blocks.WOOL, 'V', Items.GLASS_BOTTLE, 'X', Items.STRING, 'Y', "chestWood");
        AspectList aspects = new AspectList();
        aspects.add(Aspect.VOID, 3).add(Aspect.CRAFT, 3).add(Aspect.MOTION, 2);
        ResearchItem backpack = new ResearchItemRC("RC_ApothecariesBackpack", ThaumcraftPlugin.RESEARCH_CATEGORY, aspects, 2, 0, 6, RailcraftItems.BACKPACK_APOTHECARY_T1.getStack());
        backpack.setPages(ThaumcraftPlugin.getResearchPage("RC_ApothecariesBackpack"), new ResearchPage(recipe)).setParentsHidden("ENCHFABRIC").registerResearchItem();
    }
    // Thaumium Crowbar
    item = RailcraftItems.CROWBAR_THAUMIUM.item();
    if (item != null) {
        String researchTag = "RC_Crowbar_Thaumium";
        IArcaneRecipe recipe = ThaumcraftApi.addArcaneCraftingRecipe(researchTag, new ItemStack(item), new AspectList().add(Aspect.ORDER, 8), " RI", "RIR", "IR ", 'I', ThaumcraftPlugin.ITEMS.get("ingots", 0), 'R', "dyeRed");
        AspectList aspects = new AspectList();
        aspects.add(Aspect.TOOL, 1).add(Aspect.MECHANISM, 2).add(Aspect.METAL, 1);
        ResearchItem thaumiumCrowbar = new ResearchItemRC(researchTag, ThaumcraftPlugin.RESEARCH_CATEGORY, aspects, 0, 0, 3, new ItemStack(item));
        thaumiumCrowbar.setPages(ThaumcraftPlugin.getResearchPage(researchTag), new ResearchPage(recipe)).setParentsHidden("THAUMIUM").registerResearchItem();
    }
    // Void Crowbar
    item = RailcraftItems.CROWBAR_VOID.item();
    if (item != null) {
        String researchTag = "RC_Crowbar_Void";
        IArcaneRecipe recipe = ThaumcraftApi.addArcaneCraftingRecipe(researchTag, new ItemStack(item), new AspectList().add(Aspect.ENTROPY, 50), " RI", "RIR", "IR ", 'I', ThaumcraftPlugin.ITEMS.get("ingots", 1), 'R', "dyeRed");
        AspectList aspects = new AspectList();
        aspects.add(Aspect.TOOL, 2).add(Aspect.MECHANISM, 4).add(Aspect.METAL, 2);
        ResearchItemRC voidCrowbar = new ResearchItemRC(researchTag, ThaumcraftPlugin.RESEARCH_CATEGORY, aspects, 0, 1, 3, new ItemStack(item));
        voidCrowbar.setPages(ThaumcraftPlugin.getResearchPage(researchTag), new ResearchPage(recipe)).setParents(researchTag).setParentsHidden("VOIDMETAL").registerResearchItem();
    }
}
Also used : Item(net.minecraft.item.Item) ResearchItem(thaumcraft.api.research.ResearchItem) AspectList(thaumcraft.api.aspects.AspectList) ResourceLocation(net.minecraft.util.ResourceLocation) IArcaneRecipe(thaumcraft.api.crafting.IArcaneRecipe) ResearchPage(thaumcraft.api.research.ResearchPage) ItemStack(net.minecraft.item.ItemStack) ResearchItem(thaumcraft.api.research.ResearchItem)

Example 100 with ResourceLocation

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

the class BlockItemListParser method parseBlock.

public static BlockKey parseBlock(String line) {
    String[] tokens = line.split("#");
    Block block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(tokens[0]));
    if (block == null)
        throw new IllegalArgumentException("Invalid Block Name while parsing config = " + line);
    int meta = tokens.length > 1 ? Integer.valueOf(tokens[1]) : -1;
    return new BlockKey(block.getStateFromMeta(meta));
}
Also used : ResourceLocation(net.minecraft.util.ResourceLocation) Block(net.minecraft.block.Block)

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