Search in sources :

Example 46 with ResourceLocation

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

the class BotaniaHelper method init.

@Override
public void init() {
    BlueprintCraftingRecipe.addRecipe("specialBullet", BulletHandler.getBulletStack("terrasteel"), new ItemStack(IEContent.itemBullet, 1, 0), Items.GUNPOWDER, "nuggetTerrasteel", "nuggetTerrasteel");
    try {
        Class c_BotaniaAPI = Class.forName("vazkii.botania.api.BotaniaAPI");
        Method m_blacklistBlockFromMagnet = c_BotaniaAPI.getDeclaredMethod("blacklistBlockFromMagnet", Block.class, int.class);
        m_blacklistBlockFromMagnet.invoke(null, IEContent.blockConveyor, 0);
    } catch (Exception e) {
        IELogger.error("[Botania] Failed to protect IE conveyors against Botania's magnets");
        e.printStackTrace();
    }
    rariryRelic = EnumRarity.valueOf("RELIC");
    if (rariryRelic != null) {
        ShaderRegistry.rarityWeightMap.put(rariryRelic, 2);
        makeShaderRelic("The Kindled");
        makeShaderRelic("Dark Fire");
        ShaderRegistryEntry entry = ItemShader.addShader("Terra", 1, rariryRelic, 0xff3e2d14, 0xff2b1108, 0xff41bd1a, 0xff2e120a).setInfo(null, "Botania", "terra");
        entry.getCase("immersiveengineering:revolver").addLayers(new ShaderLayer(new ResourceLocation("botania:blocks/livingwood5"), 0xffffffff).setTextureBounds(17 / 128d, 24 / 128d, 33 / 128d, 40 / 128d));
        entry.getCase("immersiveengineering:drill").addLayers(new ShaderLayer(new ResourceLocation("botania:blocks/alfheimPortalInside"), 0xffffffff).setTextureBounds(14 / 64d, 10 / 64d, 26 / 64d, 22 / 64d));
        entry.getCase("immersiveengineering:railgun").addLayers(new ShaderLayer(new ResourceLocation("botania:blocks/storage1"), 0xff9e83eb).setTextureBounds(55 / 64d, 42 / 64d, 1, 58 / 64d).setCutoutBounds(.1875, 0, .75, 1));
    }
    if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
        MinecraftForge.EVENT_BUS.register(this);
}
Also used : ShaderRegistryEntry(blusunrize.immersiveengineering.api.shader.ShaderRegistry.ShaderRegistryEntry) ShaderLayer(blusunrize.immersiveengineering.api.shader.ShaderCase.ShaderLayer) ResourceLocation(net.minecraft.util.ResourceLocation) Method(java.lang.reflect.Method) ItemStack(net.minecraft.item.ItemStack)

Example 47 with ResourceLocation

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

the class AdditionalBiomeManager method init.

public static void init(File directory) {
    try {
        if (!directory.exists()) {
            directory.mkdir();
        }
        LOGGER.info("Copying the Biome List Directory to the config folder.");
        if (NetherEx.IS_DEV_ENV) {
            FileUtils.copyDirectory(new File(NetherEx.class.getResource("/assets/nex/biome_lists").getFile()), directory);
        } else {
            FileUtil.extractFromJar("/assets/nex/biome_lists", directory.getPath());
        }
    } catch (IOException e) {
        LOGGER.fatal("The attempt to copy the Biome List Directory to the config folder was unsuccessful.");
        LOGGER.fatal(e);
    }
    Gson gson = new Gson();
    List<File> additionalBiomeFiles = Lists.newArrayList(directory.listFiles());
    try {
        for (File additionalBiomeFile : additionalBiomeFiles) {
            String jsonText = Files.toString(additionalBiomeFile, Charsets.UTF_8);
            AdditionalBiomeList biomeList = gson.fromJson(jsonText, AdditionalBiomeList.class);
            LOGGER.info("Adding biomes from the " + biomeList.getName() + ".");
            for (AdditionalBiomeMod biomeMod : biomeList.getMods()) {
                for (AdditionalBiome additionalBiome : biomeMod.getBiomes()) {
                    ResourceLocation biomeRegistryName = new ResourceLocation(biomeMod.getName() + ":" + additionalBiome.getName());
                    Biome biome = Biome.REGISTRY.getObject(biomeRegistryName);
                    if (biome == null) {
                        continue;
                    }
                    int weight = additionalBiome.getWeight();
                    AdditionalBiome.OceanBlock oceanBlock = additionalBiome.getOceanBlock();
                    if (oceanBlock == null) {
                        oceanBlock = new AdditionalBiome.OceanBlock("minecraft:air", 0);
                    }
                    Block block = Block.getBlockFromName(oceanBlock.getName().isEmpty() ? "minecraft:air" : oceanBlock.getName());
                    int meta = oceanBlock.getMeta();
                    IBlockState state = block.getStateFromMeta(meta);
                    NetherExBiomeType type = NetherExBiomeType.getFromString(additionalBiome.getType());
                    NetherExBiomes.addBiome(biome, weight, state, type);
                    LOGGER.info("The " + biome.getBiomeName() + " biome from the " + biomeList.getName() + " was added to the Nether.");
                }
            }
        }
    } catch (IOException e) {
        LOGGER.fatal("NetherEx was unable to read the Biome lists.");
        LOGGER.fatal(e);
    }
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) NetherEx(nex.NetherEx) Gson(com.google.gson.Gson) IOException(java.io.IOException) NetherExBiomeType(nex.world.biome.NetherExBiomeType) Biome(net.minecraft.world.biome.Biome) ResourceLocation(net.minecraft.util.ResourceLocation) Block(net.minecraft.block.Block) File(java.io.File)

Example 48 with ResourceLocation

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

the class SkyRenderer method registerSkybox.

public static void registerSkybox(GenericWorldProvider provider, final SkyType skyType) {
    provider.setSkyRenderer(new IRenderHandler() {

        @Override
        public void render(float partialTicks, WorldClient world, Minecraft mc) {
            ResourceLocation sky;
            ResourceLocation sky2 = null;
            int type = SKYTYPE_DARKTOP;
            switch(skyType) {
                case SKY_INFERNO:
                    sky = locationPlasmaSkyPng;
                    type = SKYTYPE_DARKTOP;
                    break;
                case SKY_STARS1:
                    sky = locationStars1;
                    sky2 = locationStars1a;
                    type = SKYTYPE_ALTERNATING;
                    break;
                case SKY_STARS2:
                    sky = locationStars2;
                    type = SKYTYPE_ALL;
                    break;
                case SKY_STARS3:
                    sky = locationStars3;
                    sky2 = locationStars3a;
                    type = SKYTYPE_ALLHORIZONTAL;
                    break;
                default:
                    return;
            }
            SkyRenderer.renderSkyTexture(sky, sky2, type);
        }
    });
    provider.setCloudRenderer(new IRenderHandler() {

        @Override
        public void render(float partialTicks, WorldClient world, Minecraft mc) {
        }
    });
}
Also used : IRenderHandler(net.minecraftforge.client.IRenderHandler) ResourceLocation(net.minecraft.util.ResourceLocation) WorldClient(net.minecraft.client.multiplayer.WorldClient) Minecraft(net.minecraft.client.Minecraft)

Example 49 with ResourceLocation

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

the class BlockConveyor method onIEBlockPlacedBy.

@Override
public void onIEBlockPlacedBy(World world, BlockPos pos, IBlockState state, EnumFacing side, float hitX, float hitY, float hitZ, EntityLivingBase placer, ItemStack stack) {
    super.onIEBlockPlacedBy(world, pos, state, side, hitX, hitY, hitZ, placer, stack);
    TileEntity tile = world.getTileEntity(pos);
    if (tile instanceof TileEntityConveyorBelt && !(tile instanceof TileEntityConveyorVertical)) {
        TileEntityConveyorBelt conveyor = (TileEntityConveyorBelt) tile;
        EnumFacing f = conveyor.facing;
        ResourceLocation rl = new ResourceLocation(ItemNBTHelper.getString(stack, "conveyorType"));
        IConveyorBelt subType = ConveyorHandler.getConveyor(rl, conveyor);
        conveyor.setConveyorSubtype(subType);
        tile = world.getTileEntity(pos.offset(f));
        TileEntity tileUp = world.getTileEntity(pos.offset(f).add(0, 1, 0));
        if (subType != null && (!(tile instanceof IConveyorTile) || ((IConveyorTile) tile).getFacing() == f.getOpposite()) && tileUp instanceof IConveyorTile && ((IConveyorTile) tileUp).getFacing() != f.getOpposite() && world.isAirBlock(pos.add(0, 1, 0)))
            subType.setConveyorDirection(ConveyorDirection.UP);
        tile = world.getTileEntity(pos.offset(f.getOpposite()).add(0, 1, 0));
    //			if(tile instanceof TileEntityConveyorBelt&&!(tile instanceof TileEntityConveyorVertical) && ((TileEntityConveyorBelt)tile).facing==f)
    //				conveyor.transportDown = true;
    //			if(conveyor.transportUp && conveyor.transportDown)
    //				conveyor.transportDown = false;
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) EnumFacing(net.minecraft.util.EnumFacing) ResourceLocation(net.minecraft.util.ResourceLocation) IConveyorBelt(blusunrize.immersiveengineering.api.tool.ConveyorHandler.IConveyorBelt) IConveyorTile(blusunrize.immersiveengineering.api.tool.ConveyorHandler.IConveyorTile)

Example 50 with ResourceLocation

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

the class BlockConveyor method getSubBlocks.

@Override
public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list) {
    for (ResourceLocation key : ConveyorHandler.classRegistry.keySet()) {
        ItemStack stack = new ItemStack(this);
        ItemNBTHelper.setString(stack, "conveyorType", key.toString());
        list.add(stack);
    }
}
Also used : ResourceLocation(net.minecraft.util.ResourceLocation) ItemStack(net.minecraft.item.ItemStack)

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