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);
}
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++;
}
}
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);
}
}
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;
}
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);
}
Aggregations