Search in sources :

Example 56 with ResourceLocation

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

the class ModCrafting method initMachineRecipes.

private static void initMachineRecipes() {
    Block machineFrame = ForgeRegistries.BLOCKS.getValue(new ResourceLocation("rftools", "machine_frame"));
    ItemStack inkSac = new ItemStack(Items.DYE, 1, 0);
    Item dimensionalShard = ForgeRegistries.ITEMS.getValue(new ResourceLocation("rftools", "dimensional_shard"));
    GameRegistry.addRecipe(new ItemStack(ModBlocks.activityProbeBlock), "sss", "oMo", "sss", 'o', Items.ENDER_PEARL, 's', dimensionalShard, 'M', machineFrame);
    GameRegistry.addRecipe(new ItemStack(ModBlocks.dimensionEnscriberBlock), "rpr", "bMb", "iii", 'r', Items.REDSTONE, 'p', Items.PAPER, 'b', inkSac, 'M', machineFrame, 'i', Items.IRON_INGOT);
    GameRegistry.addRecipe(new ItemStack(ModBlocks.dimletWorkbenchBlock), "gug", "cMc", "grg", 'M', machineFrame, 'u', ModItems.dimletBaseItem, 'c', Blocks.CRAFTING_TABLE, 'r', Items.REDSTONE, 'g', Items.GOLD_NUGGET);
    if (GeneralConfiguration.enableDimensionBuilderRecipe) {
        GameRegistry.addRecipe(new ItemStack(ModBlocks.dimensionBuilderBlock), "oEo", "DMD", "ggg", 'o', Items.ENDER_PEARL, 'E', Items.EMERALD, 'D', Items.DIAMOND, 'M', machineFrame, 'g', Items.GOLD_INGOT);
    }
    GameRegistry.addRecipe(new ItemStack(ModBlocks.dimensionEditorBlock), "oEo", "DMD", "ggg", 'o', Items.REDSTONE, 'E', Items.EMERALD, 'D', Items.DIAMOND, 'M', machineFrame, 'g', Items.GOLD_INGOT);
    GameRegistry.addRecipe(new ItemStack(ModBlocks.energyExtractorBlock), "RoR", "sMs", "RsR", 'o', Items.ENDER_PEARL, 's', dimensionalShard, 'M', machineFrame, 'R', Blocks.REDSTONE_BLOCK);
//        GameRegistry.addRecipe(new ItemStack(ModBlocks.essencePainterBlock), "ppp", "iMi", "ppp", 'p', Items.PAPER, 'i', inkSac, 'M', machineFrame);
}
Also used : Item(net.minecraft.item.Item) ResourceLocation(net.minecraft.util.ResourceLocation) Block(net.minecraft.block.Block) ItemStack(net.minecraft.item.ItemStack)

Example 57 with ResourceLocation

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

the class GenericWorldGenerator method generateLootSpawners.

private void generateLootSpawners(Random random, int chunkX, int chunkZ, World world) {
    BuildingInfo info = new BuildingInfo(chunkX, chunkZ, world.getSeed());
    int buildingtop = 0;
    boolean building = info.hasBuilding;
    if (building) {
        buildingtop = 69 + info.floors * 6;
    }
    int height = 63 - info.floorsBelowGround * 6;
    while (height < buildingtop) {
        int f = LostCitiesTerrainGenerator.getFloor(height);
        if (f == 0) {
            BlockPos floorpos = new BlockPos(chunkX * 16, height, chunkZ * 16);
            int floortype = info.floorTypes[LostCitiesTerrainGenerator.getLevel(height) + info.floorsBelowGround];
            GenInfo getInfo = LostCitiesTerrainGenerator.getGenInfos().get(Pair.of(info.getGenInfoIndex(), floortype));
            for (BlockPos p : getInfo.getChest()) {
                BlockPos pos = floorpos.add(p);
                if (!world.isAirBlock(pos)) {
                    createLootChest(random, world, pos);
                }
            }
            for (BlockPos p : getInfo.getRandomFeatures()) {
                BlockPos pos = floorpos.add(p);
                if (!world.isAirBlock(pos)) {
                    createRandomFeature(random, world, pos);
                }
            }
            for (BlockPos p : getInfo.getModularStorages()) {
                BlockPos pos = floorpos.add(p);
                if (!world.isAirBlock(pos)) {
                    createModularStorage(random, world, pos);
                }
            }
            for (BlockPos p : getInfo.getRandomRFToolsMachines()) {
                BlockPos pos = floorpos.add(p);
                if (!world.isAirBlock(pos)) {
                    createRFToolsMachine(random, world, pos);
                }
            }
            for (Map.Entry<BlockPos, Integer> entry : getInfo.getSpawnerType().entrySet()) {
                BlockPos pos = floorpos.add(entry.getKey());
                if (!world.isAirBlock(pos)) {
                    world.setBlockState(pos, Blocks.MOB_SPAWNER.getDefaultState());
                    TileEntity tileentity = world.getTileEntity(pos);
                    if (tileentity instanceof TileEntityMobSpawner) {
                        TileEntityMobSpawner spawner = (TileEntityMobSpawner) tileentity;
                        switch(entry.getValue()) {
                            case 1:
                                EntityTools.setSpawnerEntity(world, spawner, new ResourceLocation("minecraft:zombie"), "Zombie");
                                break;
                            case 2:
                                EntityTools.setSpawnerEntity(world, spawner, new ResourceLocation("minecraft:skeleton"), "Skeleton");
                                break;
                            case 3:
                                EntityTools.setSpawnerEntity(world, spawner, new ResourceLocation("minecraft:spider"), "Spider");
                                break;
                            case 4:
                                EntityTools.setSpawnerEntity(world, spawner, new ResourceLocation("minecraft:blaze"), "Blaze");
                                break;
                        }
                    }
                }
            }
        }
        height++;
    }
}
Also used : ModularStorageTileEntity(mcjty.rftools.blocks.storage.ModularStorageTileEntity) TileEntity(net.minecraft.tileentity.TileEntity) BuildingInfo(mcjty.rftoolsdim.dimensions.world.terrain.lost.BuildingInfo) ResourceLocation(net.minecraft.util.ResourceLocation) BlockPos(net.minecraft.util.math.BlockPos) GenInfo(mcjty.rftoolsdim.dimensions.world.terrain.lost.GenInfo) TileEntityMobSpawner(net.minecraft.tileentity.TileEntityMobSpawner) Map(java.util.Map)

Example 58 with ResourceLocation

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

the class GenericWorldGenerator method randomLoot.

private ItemStack randomLoot(Random rand) {
    switch(rand.nextInt(10)) {
        case 0:
            return DimletRandomizer.getRandomPart(rand);
        case 1:
            return DimletRandomizer.getRandomPart(rand);
        case 2:
            RarityRandomSelector.Distribution<Integer> bestDistribution = DimletRandomizer.getRandomDimlets().createDistribution(0.2f);
            DimletKey key = DimletRandomizer.getRandomDimlets().select(bestDistribution, rand);
            if (key != null) {
                return KnownDimletConfiguration.getDimletStack(key);
            } else {
                return ItemStackTools.getEmptyStack();
            }
        case 3:
            return new ItemStack(ModItems.dimletParcelItem, 1 + rand.nextInt(3));
        default:
            return new ItemStack(ForgeRegistries.ITEMS.getValue(new ResourceLocation("rftools", "dimensional_shard")), rand.nextInt(20) + 10);
    }
}
Also used : RarityRandomSelector(mcjty.rftoolsdim.varia.RarityRandomSelector) ResourceLocation(net.minecraft.util.ResourceLocation) DimletKey(mcjty.rftoolsdim.dimensions.dimlets.DimletKey) ItemStack(net.minecraft.item.ItemStack)

Example 59 with ResourceLocation

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

the class IEApi method getPreferredStackbyMod.

public static ItemStack getPreferredStackbyMod(List<ItemStack> list) {
    ItemStack preferredStack = null;
    int lastPref = -1;
    for (ItemStack stack : list) if (stack != null && stack.getItem() != null) {
        ResourceLocation rl = GameData.getItemRegistry().getNameForObject(stack.getItem());
        if (rl != null) {
            String modId = rl.getResourceDomain();
            int idx = modId == null || modId.isEmpty() ? -1 : modPreference.indexOf(modId);
            if (preferredStack == null || (idx >= 0 && (lastPref < 0 || idx < lastPref))) {
                preferredStack = stack;
                lastPref = idx;
            }
        }
    }
    return preferredStack != null ? preferredStack.copy() : null;
}
Also used : ResourceLocation(net.minecraft.util.ResourceLocation) ItemStack(net.minecraft.item.ItemStack)

Example 60 with ResourceLocation

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

the class ShaderRegistry method registerShader_Railgun.

/**
	 * Method to register a default implementation of Railgun Shaders
	 * @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 additionalTexture additional overlay texture. Null if not needed.
	 * @param colourAddtional colour for the additional texture, if present
	 * @return the registered ShaderCase
	 */
public static ShaderCaseRailgun registerShader_Railgun(String name, String overlayType, EnumRarity rarity, int colour0, int colour1, int colour2, String additionalTexture, int colourAddtional) {
    ArrayList<ShaderLayer> list = new ArrayList();
    list.add(new ShaderLayer(new ResourceLocation("immersiveengineering:items/shaders/railgun_0"), colour0));
    list.add(new ShaderLayer(new ResourceLocation("immersiveengineering:items/shaders/railgun_0"), colour1));
    list.add(new ShaderLayer(new ResourceLocation("immersiveengineering:items/shaders/railgun_1_" + overlayType), colour2));
    if (additionalTexture != null) {
        ResourceLocation rl = new ResourceLocation("immersiveengineering:items/shaders/railgun_" + additionalTexture);
        list.add(new ShaderLayer(rl, colourAddtional).setTextureBounds(defaultLayerBounds.get(rl)));
    }
    list.add(new ShaderLayer(new ResourceLocation("immersiveengineering:items/shaders/railgun_uncoloured"), 0xffffffff));
    ShaderCaseRailgun shader = new ShaderCaseRailgun(list);
    return registerShaderCase(name, shader, rarity);
}
Also used : ShaderLayer(blusunrize.immersiveengineering.api.shader.ShaderCase.ShaderLayer) ResourceLocation(net.minecraft.util.ResourceLocation)

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