Search in sources :

Example 61 with ResourceLocation

use of net.minecraft.util.ResourceLocation in project ImmersiveEngineering by BluSunrize.

the class ShaderRegistry method registerShader_Revolver.

/**
	 * Method to register a default implementation of Chemthrower Shaders<br>
	 * @param name name of the shader
	 * @param overlayType uses IE's existing overlays. To use custom ones, you'll need your own method.
	 * @param rarity Rarity of the shader item
	 * @param colour0 grip colour
	 * @param colour1 base colour
	 * @param colour2 design colour
	 * @param colourBlade colour of the bayonet blade
	 * @param additionalTexture additional overlay texture. Null if not needed.
	 * @param colourAddtional colour for the additional texture, if present
	 * @return the registered ShaderCase
	 */
public static ShaderCaseRevolver registerShader_Revolver(String name, String overlayType, EnumRarity rarity, int colour0, int colour1, int colour2, int colourBlade, String additionalTexture, int colourAddtional) {
    ArrayList<ShaderLayer> list = new ArrayList();
    list.add(new ShaderLayer(new ResourceLocation("immersiveengineering:revolvers/shaders/revolver_grip"), colour0));
    list.add(new ShaderLayer(new ResourceLocation("immersiveengineering:revolvers/shaders/revolver_0"), colour1));
    list.add(new ShaderLayer(new ResourceLocation("immersiveengineering:revolvers/shaders/revolver_0"), colourBlade));
    list.add(new ShaderLayer(new ResourceLocation("immersiveengineering:revolvers/shaders/revolver_1_" + overlayType), colour2));
    if (additionalTexture != null) {
        ResourceLocation rl = new ResourceLocation("immersiveengineering:revolvers/shaders/revolver_" + additionalTexture);
        list.add(new ShaderLayer(rl, colourAddtional).setTextureBounds(defaultLayerBounds.get(rl)));
    }
    list.add(new ShaderLayer(new ResourceLocation("immersiveengineering:revolvers/shaders/revolver_uncoloured"), 0xffffffff));
    ShaderCaseRevolver shader = new ShaderCaseRevolver(list);
    return registerShaderCase(name, shader, rarity);
}
Also used : ShaderLayer(blusunrize.immersiveengineering.api.shader.ShaderCase.ShaderLayer) ResourceLocation(net.minecraft.util.ResourceLocation)

Example 62 with ResourceLocation

use of net.minecraft.util.ResourceLocation in project NetherEx by LogicTechCorp.

the class RemapHandler method remapRegistryName.

private static boolean remapRegistryName(FMLMissingMappingsEvent.MissingMapping mapping) {
    String missingPath = mapping.resourceLocation.getResourcePath();
    if (!customNames.containsKey(missingPath)) {
        return false;
    }
    String newPath = customNames.get(missingPath);
    ResourceLocation registryName = new ResourceLocation(mapping.resourceLocation.getResourceDomain() + newPath);
    return attemptRemap(mapping, registryName);
}
Also used : ResourceLocation(net.minecraft.util.ResourceLocation)

Example 63 with ResourceLocation

use of net.minecraft.util.ResourceLocation in project RFToolsDimensions by McJty.

the class KnownDimletConfiguration method initMaterialDimlet.

private static void initMaterialDimlet(Block block) {
    if (block instanceof BlockLiquid) {
        return;
    }
    Set<Filter.Feature> features = getBlockFeatures(block);
    ResourceLocation nameForObject = Block.REGISTRY.getNameForObject(block);
    String mod = nameForObject.getResourceDomain();
    for (IBlockState state : block.getBlockState().getValidStates()) {
        int meta = state.getBlock().getMetaFromState(state);
        ItemStack stack = new ItemStack(state.getBlock(), 1, state.getBlock().getMetaFromState(state));
        if (stack.getItem() != null) {
            // Protection
            List<IProperty<?>> propertyNames = new ArrayList<>(CompatBlock.getPropertyKeys(state));
            propertyNames.sort((o1, o2) -> o1.getName().compareTo(o2.getName()));
            ImmutableMap<IProperty<?>, Comparable<?>> properties = state.getProperties();
            Map<String, String> props = new HashMap<>();
            for (Map.Entry<IProperty<?>, Comparable<?>> entry : properties.entrySet()) {
                props.put(entry.getKey().getName(), entry.getValue().toString());
            }
            DimletKey key = new DimletKey(DimletType.DIMLET_MATERIAL, block.getRegistryName() + "@" + meta);
            Settings settings = DimletRules.getSettings(key, mod, features, props);
            if (!settings.isBlacklisted()) {
                knownDimlets.put(key, settings);
            }
        }
    }
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) BlockLiquid(net.minecraft.block.BlockLiquid) IProperty(net.minecraft.block.properties.IProperty) ResourceLocation(net.minecraft.util.ResourceLocation) ItemStack(net.minecraft.item.ItemStack) ImmutableMap(com.google.common.collect.ImmutableMap) Settings(mcjty.rftoolsdim.config.Settings)

Example 64 with ResourceLocation

use of net.minecraft.util.ResourceLocation in project RFToolsDimensions by McJty.

the class DimletObjectMapping method getFluid.

public static Block getFluid(DimletKey dimlet) {
    if (DimletType.DIMLET_LIQUID.equals(dimlet.getType())) {
        String id = dimlet.getId();
        // @todo temporary for people who accidently got an old Default dimlet
        if (DimletObjectMapping.DEFAULT_ID.equals(id)) {
            return Blocks.WATER;
        }
        int lastIndexOf = StringUtils.lastIndexOf(id, "@");
        String blockid;
        if (lastIndexOf == -1) {
            blockid = id;
        } else {
            blockid = id.substring(0, lastIndexOf);
        }
        //            int meta = Integer.parseInt(id.substring(lastIndexOf+1));
        Block block = Block.REGISTRY.getObject(new ResourceLocation(blockid));
        if (block == null) {
            return null;
        }
        return block;
    }
    return null;
}
Also used : ResourceLocation(net.minecraft.util.ResourceLocation) Block(net.minecraft.block.Block)

Example 65 with ResourceLocation

use of net.minecraft.util.ResourceLocation in project RFToolsDimensions by McJty.

the class KnownDimletConfiguration method initFluidDimlet.

private static void initFluidDimlet(Map.Entry<String, Fluid> me) {
    if (me.getValue().canBePlacedInWorld()) {
        String name = me.getKey();
        if (name != null && !name.isEmpty()) {
            Block block = me.getValue().getBlock();
            if (block != null) {
                ResourceLocation nameForObject = Block.REGISTRY.getNameForObject(block);
                if (nameForObject != null) {
                    String mod = nameForObject.getResourceDomain();
                    DimletKey key = new DimletKey(DimletType.DIMLET_LIQUID, block.getRegistryName() + "@0");
                    initDimlet(key, mod);
                }
            }
        }
    }
}
Also used : ResourceLocation(net.minecraft.util.ResourceLocation) Block(net.minecraft.block.Block) CompatBlock(mcjty.lib.compat.CompatBlock)

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