use of net.minecraft.item.crafting.ShapelessRecipes in project BluePower by Qmunity.
the class AlloyFurnaceRegistry method generateRecyclingRecipes.
@SuppressWarnings("unchecked")
public void generateRecyclingRecipes() {
Collections.addAll(blacklist, Config.alloyFurnaceBlacklist);
List<Item> blacklist = new ArrayList<Item>();
for (String configString : this.blacklist) {
Item item = GameData.getItemRegistry().getObject(configString);
if (item != null) {
blacklist.add(item);
} else {
BluePower.log.info("Config entry \"" + configString + "\" not an existing item/block name! Will not be added to the blacklist");
}
}
List<ItemStack> registeredRecycledItems = new ArrayList<ItemStack>();
List<ItemStack> registeredResultItems = new ArrayList<ItemStack>();
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
for (IRecipe recipe : recipes) {
int recyclingAmount = 0;
ItemStack currentlyRecycledInto = null;
for (ItemStack recyclingItem : bufferedRecyclingItems) {
try {
if (recipe instanceof ShapedRecipes) {
ShapedRecipes shaped = (ShapedRecipes) recipe;
if (shaped.recipeItems != null) {
for (ItemStack input : shaped.recipeItems) {
if (input != null && ItemStackUtils.isItemFuzzyEqual(input, recyclingItem)) {
ItemStack moltenDownItem = getRecyclingStack(recyclingItem);
if (currentlyRecycledInto == null || ItemStackUtils.isItemFuzzyEqual(currentlyRecycledInto, moltenDownItem)) {
currentlyRecycledInto = moltenDownItem;
recyclingAmount += moltenDownItem.stackSize;
}
}
}
}
} else if (recipe instanceof ShapelessRecipes) {
ShapelessRecipes shapeless = (ShapelessRecipes) recipe;
if (shapeless.recipeItems != null) {
for (ItemStack input : (List<ItemStack>) shapeless.recipeItems) {
if (input != null && ItemStackUtils.isItemFuzzyEqual(input, recyclingItem)) {
ItemStack moltenDownItem = getRecyclingStack(recyclingItem);
if (currentlyRecycledInto == null || ItemStackUtils.isItemFuzzyEqual(currentlyRecycledInto, moltenDownItem)) {
currentlyRecycledInto = moltenDownItem;
recyclingAmount += moltenDownItem.stackSize;
}
}
}
}
} else if (recipe instanceof ShapedOreRecipe) {
ShapedOreRecipe shapedOreRecipe = (ShapedOreRecipe) recipe;
if (shapedOreRecipe.getInput() != null) {
for (Object input : shapedOreRecipe.getInput()) {
if (input != null) {
List<ItemStack> itemList;
if (input instanceof ItemStack) {
itemList = new ArrayList<ItemStack>();
itemList.add((ItemStack) input);
} else {
itemList = (List<ItemStack>) input;
}
for (ItemStack item : itemList) {
if (item != null && ItemStackUtils.isItemFuzzyEqual(item, recyclingItem)) {
ItemStack moltenDownItem = getRecyclingStack(recyclingItem);
if (currentlyRecycledInto == null || ItemStackUtils.isItemFuzzyEqual(currentlyRecycledInto, moltenDownItem)) {
currentlyRecycledInto = moltenDownItem;
recyclingAmount += moltenDownItem.stackSize;
}
break;
}
}
}
}
}
} else if (recipe instanceof ShapelessOreRecipe) {
ShapelessOreRecipe shapeless = (ShapelessOreRecipe) recipe;
for (Object input : shapeless.getInput()) {
if (input != null) {
List<ItemStack> itemList;
if (input instanceof ItemStack) {
itemList = new ArrayList<ItemStack>();
itemList.add((ItemStack) input);
} else {
itemList = (List<ItemStack>) input;
}
for (ItemStack item : itemList) {
if (item != null && ItemStackUtils.isItemFuzzyEqual(item, recyclingItem)) {
ItemStack moltenDownItem = getRecyclingStack(recyclingItem);
if (currentlyRecycledInto == null || ItemStackUtils.isItemFuzzyEqual(currentlyRecycledInto, moltenDownItem)) {
currentlyRecycledInto = moltenDownItem;
recyclingAmount += moltenDownItem.stackSize;
}
break;
}
}
}
}
}
} catch (Throwable e) {
BluePower.log.error("Error when generating an Alloy Furnace recipe for item " + recyclingItem.getDisplayName() + ", recipe output: " + recipe.getRecipeOutput().getDisplayName());
e.printStackTrace();
}
}
if (recyclingAmount > 0 && recipe.getRecipeOutput().stackSize > 0) {
boolean shouldAdd = true;
for (int i = 0; i < registeredRecycledItems.size(); i++) {
if (ItemStackUtils.isItemFuzzyEqual(registeredRecycledItems.get(i), recipe.getRecipeOutput())) {
if (registeredResultItems.get(i).stackSize < recyclingAmount) {
shouldAdd = false;
break;
} else {
registeredResultItems.remove(i);
registeredRecycledItems.remove(i);
i--;
}
}
}
if (shouldAdd) {
if (blacklist.contains(recipe.getRecipeOutput().getItem())) {
BluePower.log.info("Skipped adding item/block " + recipe.getRecipeOutput().getDisplayName() + " to the Alloy Furnace recipes.");
continue;
}
ItemStack resultItem = new ItemStack(currentlyRecycledInto.getItem(), Math.min(64, recyclingAmount), currentlyRecycledInto.getItemDamage());
registeredResultItems.add(resultItem);
registeredRecycledItems.add(recipe.getRecipeOutput());
}
}
}
for (int i = 0; i < registeredResultItems.size(); i++) {
addRecipe(registeredResultItems.get(i), registeredRecycledItems.get(i));
}
}
use of net.minecraft.item.crafting.ShapelessRecipes in project MinecraftForge by MinecraftForge.
the class OreDictionary method initVanillaEntries.
private static void initVanillaEntries() {
if (!hasInit) {
// tree- and wood-related things
registerOre("logWood", new ItemStack(Blocks.LOG, 1, WILDCARD_VALUE));
registerOre("logWood", new ItemStack(Blocks.LOG2, 1, WILDCARD_VALUE));
registerOre("plankWood", new ItemStack(Blocks.PLANKS, 1, WILDCARD_VALUE));
registerOre("slabWood", new ItemStack(Blocks.WOODEN_SLAB, 1, WILDCARD_VALUE));
registerOre("stairWood", Blocks.OAK_STAIRS);
registerOre("stairWood", Blocks.SPRUCE_STAIRS);
registerOre("stairWood", Blocks.BIRCH_STAIRS);
registerOre("stairWood", Blocks.JUNGLE_STAIRS);
registerOre("stairWood", Blocks.ACACIA_STAIRS);
registerOre("stairWood", Blocks.DARK_OAK_STAIRS);
registerOre("stickWood", Items.STICK);
registerOre("treeSapling", new ItemStack(Blocks.SAPLING, 1, WILDCARD_VALUE));
registerOre("treeLeaves", new ItemStack(Blocks.LEAVES, 1, WILDCARD_VALUE));
registerOre("treeLeaves", new ItemStack(Blocks.LEAVES2, 1, WILDCARD_VALUE));
registerOre("vine", Blocks.VINE);
// Ores
registerOre("oreGold", Blocks.GOLD_ORE);
registerOre("oreIron", Blocks.IRON_ORE);
registerOre("oreLapis", Blocks.LAPIS_ORE);
registerOre("oreDiamond", Blocks.DIAMOND_ORE);
registerOre("oreRedstone", Blocks.REDSTONE_ORE);
registerOre("oreEmerald", Blocks.EMERALD_ORE);
registerOre("oreQuartz", Blocks.QUARTZ_ORE);
registerOre("oreCoal", Blocks.COAL_ORE);
// ingots/nuggets
registerOre("ingotIron", Items.IRON_INGOT);
registerOre("ingotGold", Items.GOLD_INGOT);
registerOre("ingotBrick", Items.BRICK);
registerOre("ingotBrickNether", Items.NETHERBRICK);
registerOre("nuggetGold", Items.GOLD_NUGGET);
registerOre("nuggetIron", Items.field_191525_da);
// gems and dusts
registerOre("gemDiamond", Items.DIAMOND);
registerOre("gemEmerald", Items.EMERALD);
registerOre("gemQuartz", Items.QUARTZ);
registerOre("gemPrismarine", Items.PRISMARINE_SHARD);
registerOre("dustPrismarine", Items.PRISMARINE_CRYSTALS);
registerOre("dustRedstone", Items.REDSTONE);
registerOre("dustGlowstone", Items.GLOWSTONE_DUST);
registerOre("gemLapis", new ItemStack(Items.DYE, 1, 4));
// storage blocks
registerOre("blockGold", Blocks.GOLD_BLOCK);
registerOre("blockIron", Blocks.IRON_BLOCK);
registerOre("blockLapis", Blocks.LAPIS_BLOCK);
registerOre("blockDiamond", Blocks.DIAMOND_BLOCK);
registerOre("blockRedstone", Blocks.REDSTONE_BLOCK);
registerOre("blockEmerald", Blocks.EMERALD_BLOCK);
registerOre("blockQuartz", Blocks.QUARTZ_BLOCK);
registerOre("blockCoal", Blocks.COAL_BLOCK);
// crops
registerOre("cropWheat", Items.WHEAT);
registerOre("cropPotato", Items.POTATO);
registerOre("cropCarrot", Items.CARROT);
registerOre("cropNetherWart", Items.NETHER_WART);
registerOre("sugarcane", Items.REEDS);
registerOre("blockCactus", Blocks.CACTUS);
// misc materials
registerOre("dye", new ItemStack(Items.DYE, 1, WILDCARD_VALUE));
registerOre("paper", new ItemStack(Items.PAPER));
// mob drops
registerOre("slimeball", Items.SLIME_BALL);
registerOre("enderpearl", Items.ENDER_PEARL);
registerOre("bone", Items.BONE);
registerOre("gunpowder", Items.GUNPOWDER);
registerOre("string", Items.STRING);
registerOre("netherStar", Items.NETHER_STAR);
registerOre("leather", Items.LEATHER);
registerOre("feather", Items.FEATHER);
registerOre("egg", Items.EGG);
// records
registerOre("record", Items.RECORD_13);
registerOre("record", Items.RECORD_CAT);
registerOre("record", Items.RECORD_BLOCKS);
registerOre("record", Items.RECORD_CHIRP);
registerOre("record", Items.RECORD_FAR);
registerOre("record", Items.RECORD_MALL);
registerOre("record", Items.RECORD_MELLOHI);
registerOre("record", Items.RECORD_STAL);
registerOre("record", Items.RECORD_STRAD);
registerOre("record", Items.RECORD_WARD);
registerOre("record", Items.RECORD_11);
registerOre("record", Items.RECORD_WAIT);
// blocks
registerOre("dirt", Blocks.DIRT);
registerOre("grass", Blocks.GRASS);
registerOre("stone", Blocks.STONE);
registerOre("cobblestone", Blocks.COBBLESTONE);
registerOre("gravel", Blocks.GRAVEL);
registerOre("sand", new ItemStack(Blocks.SAND, 1, WILDCARD_VALUE));
registerOre("sandstone", new ItemStack(Blocks.SANDSTONE, 1, WILDCARD_VALUE));
registerOre("sandstone", new ItemStack(Blocks.RED_SANDSTONE, 1, WILDCARD_VALUE));
registerOre("netherrack", Blocks.NETHERRACK);
registerOre("obsidian", Blocks.OBSIDIAN);
registerOre("glowstone", Blocks.GLOWSTONE);
registerOre("endstone", Blocks.END_STONE);
registerOre("torch", Blocks.TORCH);
registerOre("workbench", Blocks.CRAFTING_TABLE);
registerOre("blockSlime", Blocks.SLIME_BLOCK);
registerOre("blockPrismarine", new ItemStack(Blocks.PRISMARINE, 1, BlockPrismarine.EnumType.ROUGH.getMetadata()));
registerOre("blockPrismarineBrick", new ItemStack(Blocks.PRISMARINE, 1, BlockPrismarine.EnumType.BRICKS.getMetadata()));
registerOre("blockPrismarineDark", new ItemStack(Blocks.PRISMARINE, 1, BlockPrismarine.EnumType.DARK.getMetadata()));
registerOre("stoneGranite", new ItemStack(Blocks.STONE, 1, 1));
registerOre("stoneGranitePolished", new ItemStack(Blocks.STONE, 1, 2));
registerOre("stoneDiorite", new ItemStack(Blocks.STONE, 1, 3));
registerOre("stoneDioritePolished", new ItemStack(Blocks.STONE, 1, 4));
registerOre("stoneAndesite", new ItemStack(Blocks.STONE, 1, 5));
registerOre("stoneAndesitePolished", new ItemStack(Blocks.STONE, 1, 6));
registerOre("blockGlassColorless", Blocks.GLASS);
registerOre("blockGlass", Blocks.GLASS);
registerOre("blockGlass", new ItemStack(Blocks.STAINED_GLASS, 1, WILDCARD_VALUE));
//blockGlass{Color} is added below with dyes
registerOre("paneGlassColorless", Blocks.GLASS_PANE);
registerOre("paneGlass", Blocks.GLASS_PANE);
registerOre("paneGlass", new ItemStack(Blocks.STAINED_GLASS_PANE, 1, WILDCARD_VALUE));
//paneGlass{Color} is added below with dyes
// chests
registerOre("chest", Blocks.CHEST);
registerOre("chest", Blocks.ENDER_CHEST);
registerOre("chest", Blocks.TRAPPED_CHEST);
registerOre("chestWood", Blocks.CHEST);
registerOre("chestEnder", Blocks.ENDER_CHEST);
registerOre("chestTrapped", Blocks.TRAPPED_CHEST);
}
// Build our list of items to replace with ore tags
Map<ItemStack, String> replacements = new HashMap<ItemStack, String>();
// wood-related things
replacements.put(new ItemStack(Items.STICK), "stickWood");
replacements.put(new ItemStack(Blocks.PLANKS), "plankWood");
replacements.put(new ItemStack(Blocks.PLANKS, 1, WILDCARD_VALUE), "plankWood");
replacements.put(new ItemStack(Blocks.WOODEN_SLAB, 1, WILDCARD_VALUE), "slabWood");
// ingots/nuggets
replacements.put(new ItemStack(Items.GOLD_INGOT), "ingotGold");
replacements.put(new ItemStack(Items.IRON_INGOT), "ingotIron");
// gems and dusts
replacements.put(new ItemStack(Items.DIAMOND), "gemDiamond");
replacements.put(new ItemStack(Items.EMERALD), "gemEmerald");
replacements.put(new ItemStack(Items.PRISMARINE_SHARD), "gemPrismarine");
replacements.put(new ItemStack(Items.PRISMARINE_CRYSTALS), "dustPrismarine");
replacements.put(new ItemStack(Items.REDSTONE), "dustRedstone");
replacements.put(new ItemStack(Items.GLOWSTONE_DUST), "dustGlowstone");
// crops
replacements.put(new ItemStack(Items.REEDS), "sugarcane");
replacements.put(new ItemStack(Blocks.CACTUS), "blockCactus");
// misc materials
replacements.put(new ItemStack(Items.PAPER), "paper");
// mob drops
replacements.put(new ItemStack(Items.SLIME_BALL), "slimeball");
replacements.put(new ItemStack(Items.STRING), "string");
replacements.put(new ItemStack(Items.LEATHER), "leather");
replacements.put(new ItemStack(Items.ENDER_PEARL), "enderpearl");
replacements.put(new ItemStack(Items.GUNPOWDER), "gunpowder");
replacements.put(new ItemStack(Items.NETHER_STAR), "netherStar");
replacements.put(new ItemStack(Items.FEATHER), "feather");
replacements.put(new ItemStack(Items.BONE), "bone");
replacements.put(new ItemStack(Items.EGG), "egg");
// blocks
replacements.put(new ItemStack(Blocks.STONE), "stone");
replacements.put(new ItemStack(Blocks.COBBLESTONE), "cobblestone");
replacements.put(new ItemStack(Blocks.COBBLESTONE, 1, WILDCARD_VALUE), "cobblestone");
replacements.put(new ItemStack(Blocks.GLOWSTONE), "glowstone");
replacements.put(new ItemStack(Blocks.GLASS), "blockGlassColorless");
replacements.put(new ItemStack(Blocks.PRISMARINE), "prismarine");
replacements.put(new ItemStack(Blocks.STONE, 1, 1), "stoneGranite");
replacements.put(new ItemStack(Blocks.STONE, 1, 2), "stoneGranitePolished");
replacements.put(new ItemStack(Blocks.STONE, 1, 3), "stoneDiorite");
replacements.put(new ItemStack(Blocks.STONE, 1, 4), "stoneDioritePolished");
replacements.put(new ItemStack(Blocks.STONE, 1, 5), "stoneAndesite");
replacements.put(new ItemStack(Blocks.STONE, 1, 6), "stoneAndesitePolished");
// chests
replacements.put(new ItemStack(Blocks.CHEST), "chestWood");
replacements.put(new ItemStack(Blocks.ENDER_CHEST), "chestEnder");
replacements.put(new ItemStack(Blocks.TRAPPED_CHEST), "chestTrapped");
// Register dyes
String[] dyes = { "Black", "Red", "Green", "Brown", "Blue", "Purple", "Cyan", "LightGray", "Gray", "Pink", "Lime", "Yellow", "LightBlue", "Magenta", "Orange", "White" };
for (int i = 0; i < 16; i++) {
ItemStack dye = new ItemStack(Items.DYE, 1, i);
ItemStack block = new ItemStack(Blocks.STAINED_GLASS, 1, 15 - i);
ItemStack pane = new ItemStack(Blocks.STAINED_GLASS_PANE, 1, 15 - i);
if (!hasInit) {
registerOre("dye" + dyes[i], dye);
registerOre("blockGlass" + dyes[i], block);
registerOre("paneGlass" + dyes[i], pane);
}
replacements.put(dye, "dye" + dyes[i]);
replacements.put(block, "blockGlass" + dyes[i]);
replacements.put(pane, "paneGlass" + dyes[i]);
}
hasInit = true;
ItemStack[] replaceStacks = replacements.keySet().toArray(new ItemStack[replacements.keySet().size()]);
// Ignore recipes for the following items
ItemStack[] exclusions = new ItemStack[] { new ItemStack(Blocks.LAPIS_BLOCK), new ItemStack(Items.COOKIE), new ItemStack(Blocks.STONEBRICK), new ItemStack(Blocks.STONE_SLAB, 1, WILDCARD_VALUE), new ItemStack(Blocks.STONE_STAIRS), new ItemStack(Blocks.COBBLESTONE_WALL), new ItemStack(Blocks.OAK_FENCE), new ItemStack(Blocks.OAK_FENCE_GATE), new ItemStack(Blocks.OAK_STAIRS), new ItemStack(Blocks.SPRUCE_FENCE), new ItemStack(Blocks.SPRUCE_FENCE_GATE), new ItemStack(Blocks.SPRUCE_STAIRS), new ItemStack(Blocks.BIRCH_STAIRS), new ItemStack(Blocks.BIRCH_FENCE_GATE), new ItemStack(Blocks.BIRCH_STAIRS), new ItemStack(Blocks.JUNGLE_FENCE), new ItemStack(Blocks.JUNGLE_FENCE_GATE), new ItemStack(Blocks.JUNGLE_STAIRS), new ItemStack(Blocks.ACACIA_FENCE), new ItemStack(Blocks.ACACIA_FENCE_GATE), new ItemStack(Blocks.ACACIA_STAIRS), new ItemStack(Blocks.DARK_OAK_FENCE), new ItemStack(Blocks.DARK_OAK_FENCE_GATE), new ItemStack(Blocks.DARK_OAK_STAIRS), new ItemStack(Blocks.WOODEN_SLAB), new ItemStack(Blocks.GLASS_PANE), // Bone Block, to prevent conversion of dyes into bone meal.
new ItemStack(Blocks.BONE_BLOCK), new ItemStack(Items.BOAT), new ItemStack(Items.OAK_DOOR), //So the above can have a comma and we don't have to keep editing extra lines.
ItemStack.EMPTY };
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
List<IRecipe> recipesToRemove = new ArrayList<IRecipe>();
List<IRecipe> recipesToAdd = new ArrayList<IRecipe>();
// Search vanilla recipes for recipes to replace
for (Object obj : recipes) {
if (obj.getClass() == ShapedRecipes.class) {
ShapedRecipes recipe = (ShapedRecipes) obj;
ItemStack output = recipe.getRecipeOutput();
if (!output.isEmpty() && containsMatch(false, exclusions, output)) {
continue;
}
if (containsMatch(true, recipe.recipeItems, replaceStacks)) {
recipesToRemove.add(recipe);
recipesToAdd.add(new ShapedOreRecipe(recipe, replacements));
}
} else if (obj.getClass() == ShapelessRecipes.class) {
ShapelessRecipes recipe = (ShapelessRecipes) obj;
ItemStack output = recipe.getRecipeOutput();
if (!output.isEmpty() && containsMatch(false, exclusions, output)) {
continue;
}
if (containsMatch(true, recipe.recipeItems.toArray(new ItemStack[recipe.recipeItems.size()]), replaceStacks)) {
recipesToRemove.add((IRecipe) obj);
IRecipe newRecipe = new ShapelessOreRecipe(recipe, replacements);
recipesToAdd.add(newRecipe);
}
}
}
recipes.removeAll(recipesToRemove);
recipes.addAll(recipesToAdd);
if (recipesToRemove.size() > 0) {
FMLLog.info("Replaced %d ore recipes", recipesToRemove.size());
}
}
use of net.minecraft.item.crafting.ShapelessRecipes in project ImmersiveEngineering by BluSunrize.
the class IEContent method init.
public static void init() {
/**TILEENTITIES*/
registerTile(TileEntityIESlab.class);
registerTile(TileEntityBalloon.class);
registerTile(TileEntityStripCurtain.class);
registerTile(TileEntityCokeOven.class);
registerTile(TileEntityBlastFurnace.class);
registerTile(TileEntityBlastFurnaceAdvanced.class);
registerTile(TileEntityCoresample.class);
registerTile(TileEntityWoodenCrate.class);
registerTile(TileEntityWoodenBarrel.class);
registerTile(TileEntityModWorkbench.class);
registerTile(TileEntitySorter.class);
registerTile(TileEntityTurntable.class);
registerTile(TileEntityFluidSorter.class);
registerTile(TileEntityWatermill.class);
registerTile(TileEntityWindmill.class);
registerTile(TileEntityWindmillAdvanced.class);
registerTile(TileEntityWoodenPost.class);
registerTile(TileEntityWallmount.class);
registerTile(TileEntityLantern.class);
registerTile(TileEntityRazorWire.class);
registerTile(TileEntityToolbox.class);
registerTile(TileEntityConnectorLV.class);
registerTile(TileEntityRelayLV.class);
registerTile(TileEntityConnectorMV.class);
registerTile(TileEntityRelayMV.class);
registerTile(TileEntityConnectorHV.class);
registerTile(TileEntityRelayHV.class);
registerTile(TileEntityConnectorStructural.class);
registerTile(TileEntityTransformer.class);
registerTile(TileEntityTransformerHV.class);
registerTile(TileEntityBreakerSwitch.class);
registerTile(TileEntityRedstoneBreaker.class);
registerTile(TileEntityEnergyMeter.class);
registerTile(TileEntityConnectorRedstone.class);
registerTile(TileEntityCapacitorLV.class);
registerTile(TileEntityCapacitorMV.class);
registerTile(TileEntityCapacitorHV.class);
registerTile(TileEntityCapacitorCreative.class);
registerTile(TileEntityMetalBarrel.class);
registerTile(TileEntityFluidPump.class);
registerTile(TileEntityFluidPlacer.class);
registerTile(TileEntityBlastFurnacePreheater.class);
registerTile(TileEntityFurnaceHeater.class);
registerTile(TileEntityDynamo.class);
registerTile(TileEntityThermoelectricGen.class);
registerTile(TileEntityElectricLantern.class);
registerTile(TileEntityChargingStation.class);
registerTile(TileEntityFluidPipe.class);
registerTile(TileEntitySampleDrill.class);
registerTile(TileEntityTeslaCoil.class);
registerTile(TileEntityFloodlight.class);
registerTile(TileEntityTurret.class);
registerTile(TileEntityTurretChem.class);
registerTile(TileEntityTurretGun.class);
registerTile(TileEntityBelljar.class);
registerTile(TileEntityConveyorBelt.class);
registerTile(TileEntityConveyorVertical.class);
registerTile(TileEntityMetalPress.class);
registerTile(TileEntityCrusher.class);
registerTile(TileEntitySheetmetalTank.class);
registerTile(TileEntitySilo.class);
registerTile(TileEntityAssembler.class);
registerTile(TileEntityAutoWorkbench.class);
registerTile(TileEntityBottlingMachine.class);
registerTile(TileEntitySqueezer.class);
registerTile(TileEntityFermenter.class);
registerTile(TileEntityRefinery.class);
registerTile(TileEntityDieselGenerator.class);
registerTile(TileEntityBucketWheel.class);
registerTile(TileEntityExcavator.class);
registerTile(TileEntityArcFurnace.class);
registerTile(TileEntityLightningrod.class);
registerTile(TileEntityMixer.class);
//
// registerTile(TileEntitySkycrateDispenser.class);
// registerTile(TileEntityFloodlight.class);
//
registerTile(TileEntityFakeLight.class);
/**ENTITIES*/
int i = 0;
EntityRegistry.registerModEntity(EntityRevolvershot.class, "revolverShot", i++, ImmersiveEngineering.instance, 64, 1, true);
EntityRegistry.registerModEntity(EntitySkylineHook.class, "skylineHook", i++, ImmersiveEngineering.instance, 64, 1, true);
//EntityRegistry.registerModEntity(EntitySkycrate.class, "skylineCrate", 2, ImmersiveEngineering.instance, 64, 1, true);
EntityRegistry.registerModEntity(EntityRevolvershotHoming.class, "revolverShotHoming", i++, ImmersiveEngineering.instance, 64, 1, true);
EntityRegistry.registerModEntity(EntityWolfpackShot.class, "revolverShotWolfpack", i++, ImmersiveEngineering.instance, 64, 1, true);
EntityRegistry.registerModEntity(EntityChemthrowerShot.class, "chemthrowerShot", i++, ImmersiveEngineering.instance, 64, 1, true);
EntityRegistry.registerModEntity(EntityRailgunShot.class, "railgunShot", i++, ImmersiveEngineering.instance, 64, 5, true);
EntityRegistry.registerModEntity(EntityRevolvershotFlare.class, "revolverShotFlare", i++, ImmersiveEngineering.instance, 64, 1, true);
EntityRegistry.registerModEntity(EntityIEExplosive.class, "explosive", i++, ImmersiveEngineering.instance, 64, 1, true);
EntityRegistry.registerModEntity(EntityFluorescentTube.class, "fluorescentTube", i++, ImmersiveEngineering.instance, 64, 1, true);
CapabilityShader.register();
ShaderRegistry.itemShader = IEContent.itemShader;
ShaderRegistry.itemShaderBag = IEContent.itemShaderBag;
ShaderRegistry.itemExamples.add(new ItemStack(IEContent.itemRevolver));
ShaderRegistry.itemExamples.add(new ItemStack(IEContent.itemDrill));
ShaderRegistry.itemExamples.add(new ItemStack(IEContent.itemChemthrower));
ShaderRegistry.itemExamples.add(new ItemStack(IEContent.itemRailgun));
/**WOLFPACK BULLETS*/
if (!BulletHandler.homingCartridges.isEmpty()) {
BulletHandler.registerBullet("wolfpack", new WolfpackBullet());
BulletHandler.registerBullet("wolfpackPart", new WolfpackPartBullet());
}
/**SMELTING*/
IERecipes.initFurnaceRecipes();
/**CRAFTING*/
IERecipes.initCraftingRecipes();
/**BLUEPRINTS*/
IERecipes.initBlueprintRecipes();
/**POTIONS*/
IEPotions.init();
/**BANNERS*/
addBanner("hammer", "hmr", new ItemStack(itemTool, 1, 0));
addBanner("bevels", "bvl", "plateIron");
addBanner("ornate", "orn", "dustSilver");
addBanner("treatedwood", "twd", "plankTreatedWood");
addBanner("windmill", "wnd", new ItemStack[] { new ItemStack(blockWoodenDevice1, 1, BlockTypes_WoodenDevice1.WINDMILL.getMeta()), new ItemStack(blockWoodenDevice1, 1, BlockTypes_WoodenDevice1.WINDMILL_ADVANCED.getMeta()) });
if (!BulletHandler.homingCartridges.isEmpty()) {
ItemStack wolfpackCartridge = BulletHandler.getBulletStack("wolfpack");
addBanner("wolf_r", "wlfr", wolfpackCartridge, 1);
addBanner("wolf_l", "wlfl", wolfpackCartridge, -1);
addBanner("wolf", "wlf", wolfpackCartridge, 0, 0);
}
/**CONVEYORS*/
ConveyorHandler.registerMagnetSupression((entity, iConveyorTile) -> {
NBTTagCompound data = entity.getEntityData();
if (!data.getBoolean(Lib.MAGNET_PREVENT_NBT))
data.setBoolean(Lib.MAGNET_PREVENT_NBT, true);
}, (entity, iConveyorTile) -> {
entity.getEntityData().removeTag(Lib.MAGNET_PREVENT_NBT);
});
ConveyorHandler.registerConveyorHandler(new ResourceLocation(ImmersiveEngineering.MODID, "conveyor"), ConveyorBasic.class, (tileEntity) -> new ConveyorBasic());
ConveyorHandler.registerConveyorHandler(new ResourceLocation(ImmersiveEngineering.MODID, "uncontrolled"), ConveyorUncontrolled.class, (tileEntity) -> new ConveyorUncontrolled());
ConveyorHandler.registerConveyorHandler(new ResourceLocation(ImmersiveEngineering.MODID, "dropper"), ConveyorDrop.class, (tileEntity) -> new ConveyorDrop());
ConveyorHandler.registerConveyorHandler(new ResourceLocation(ImmersiveEngineering.MODID, "vertical"), ConveyorVertical.class, (tileEntity) -> new ConveyorVertical());
ConveyorHandler.registerConveyorHandler(new ResourceLocation(ImmersiveEngineering.MODID, "splitter"), ConveyorSplit.class, (tileEntity) -> new ConveyorSplit(tileEntity instanceof IConveyorTile ? ((IConveyorTile) tileEntity).getFacing() : EnumFacing.NORTH));
ConveyorHandler.registerConveyorHandler(new ResourceLocation(ImmersiveEngineering.MODID, "covered"), ConveyorCovered.class, (tileEntity) -> new ConveyorCovered());
/**ASSEMBLER RECIPE ADAPTERS*/
//Shaped
AssemblerHandler.registerRecipeAdapter(ShapedRecipes.class, new IRecipeAdapter<ShapedRecipes>() {
@Override
public RecipeQuery[] getQueriedInputs(ShapedRecipes recipe) {
AssemblerHandler.RecipeQuery[] query = new AssemblerHandler.RecipeQuery[recipe.recipeItems.length];
for (int i = 0; i < query.length; i++) query[i] = AssemblerHandler.createQuery(recipe.recipeItems[i]);
return query;
}
});
//Shapeless
AssemblerHandler.registerRecipeAdapter(ShapelessRecipes.class, new IRecipeAdapter<ShapelessRecipes>() {
@Override
public RecipeQuery[] getQueriedInputs(ShapelessRecipes recipe) {
AssemblerHandler.RecipeQuery[] query = new AssemblerHandler.RecipeQuery[recipe.recipeItems.size()];
for (int i = 0; i < query.length; i++) query[i] = AssemblerHandler.createQuery(recipe.recipeItems.get(i));
return query;
}
});
//ShapedOre
AssemblerHandler.registerRecipeAdapter(ShapedOreRecipe.class, new IRecipeAdapter<ShapedOreRecipe>() {
@Override
public RecipeQuery[] getQueriedInputs(ShapedOreRecipe recipe) {
AssemblerHandler.RecipeQuery[] query = new AssemblerHandler.RecipeQuery[recipe.getInput().length];
for (int i = 0; i < query.length; i++) query[i] = AssemblerHandler.createQuery(recipe.getInput()[i]);
return query;
}
});
//ShapelessOre
AssemblerHandler.registerRecipeAdapter(ShapelessOreRecipe.class, new IRecipeAdapter<ShapelessOreRecipe>() {
@Override
public RecipeQuery[] getQueriedInputs(ShapelessOreRecipe recipe) {
AssemblerHandler.RecipeQuery[] query = new AssemblerHandler.RecipeQuery[recipe.getInput().size()];
for (int i = 0; i < query.length; i++) query[i] = AssemblerHandler.createQuery(recipe.getInput().get(i));
return query;
}
});
//ShapedIngredient
AssemblerHandler.registerRecipeAdapter(RecipeShapedIngredient.class, new IRecipeAdapter<RecipeShapedIngredient>() {
@Override
public RecipeQuery[] getQueriedInputs(RecipeShapedIngredient recipe) {
AssemblerHandler.RecipeQuery[] query = new AssemblerHandler.RecipeQuery[recipe.getIngredients().length];
for (int i = 0; i < query.length; i++) query[i] = AssemblerHandler.createQuery(recipe.getIngredients()[i]);
return query;
}
});
//ShapelessIngredient
AssemblerHandler.registerRecipeAdapter(RecipeShapelessIngredient.class, new IRecipeAdapter<RecipeShapelessIngredient>() {
@Override
public RecipeQuery[] getQueriedInputs(RecipeShapelessIngredient recipe) {
AssemblerHandler.RecipeQuery[] query = new AssemblerHandler.RecipeQuery[recipe.getIngredients().size()];
for (int i = 0; i < query.length; i++) query[i] = AssemblerHandler.createQuery(recipe.getIngredients().get(i));
return query;
}
});
CokeOvenRecipe.addRecipe(new ItemStack(itemMaterial, 1, 6), new ItemStack(Items.COAL), 1800, 500);
CokeOvenRecipe.addRecipe(new ItemStack(blockStoneDecoration, 1, 3), "blockCoal", 1800 * 9, 5000);
CokeOvenRecipe.addRecipe(new ItemStack(Items.COAL, 1, 1), "logWood", 900, 250);
BlastFurnaceRecipe.addRecipe(new ItemStack(itemMetal, 1, 8), "ingotIron", 1200, new ItemStack(itemMaterial, 1, 7));
BlastFurnaceRecipe.addRecipe(new ItemStack(blockStorage, 1, 8), "blockIron", 1200 * 9, new ItemStack(itemMaterial, 9, 7));
BlastFurnaceRecipe.addBlastFuel("fuelCoke", 1200);
BlastFurnaceRecipe.addBlastFuel("blockFuelCoke", 1200 * 10);
BlastFurnaceRecipe.addBlastFuel("charcoal", 300);
BlastFurnaceRecipe.addBlastFuel("blockCharcoal", 300 * 10);
GameRegistry.registerFuelHandler(new IEFuelHandler());
IERecipes.initCrusherRecipes();
IERecipes.initArcSmeltingRecipes();
ItemStack shoddyElectrode = new ItemStack(itemGraphiteElectrode);
shoddyElectrode.setItemDamage(ItemGraphiteElectrode.electrodeMaxDamage / 2);
MetalPressRecipe.addRecipe(shoddyElectrode, "ingotHOPGraphite", new ItemStack(IEContent.itemMold, 1, 2), 4800).setInputSize(4);
DieselHandler.registerFuel(fluidBiodiesel, 125);
DieselHandler.registerFuel(FluidRegistry.getFluid("fuel"), 375);
DieselHandler.registerFuel(FluidRegistry.getFluid("diesel"), 175);
DieselHandler.registerDrillFuel(fluidBiodiesel);
DieselHandler.registerDrillFuel(FluidRegistry.getFluid("fuel"));
DieselHandler.registerDrillFuel(FluidRegistry.getFluid("diesel"));
blockFluidCreosote.setPotionEffects(new PotionEffect(IEPotions.flammable, 100, 0));
blockFluidEthanol.setPotionEffects(new PotionEffect(MobEffects.NAUSEA, 40, 0));
blockFluidBiodiesel.setPotionEffects(new PotionEffect(IEPotions.flammable, 100, 1));
blockFluidConcrete.setPotionEffects(new PotionEffect(MobEffects.SLOWNESS, 20, 3, false, false));
ChemthrowerHandler.registerEffect(FluidRegistry.WATER, new ChemthrowerEffect_Extinguish());
ChemthrowerHandler.registerEffect(fluidPotion, new ChemthrowerEffect() {
@Override
public void applyToEntity(EntityLivingBase target, @Nullable EntityPlayer shooter, ItemStack thrower, FluidStack fluid) {
if (fluid.tag != null) {
List<PotionEffect> effects = PotionUtils.getEffectsFromTag(fluid.tag);
for (PotionEffect e : effects) {
PotionEffect newEffect = new PotionEffect(e.getPotion(), (int) Math.ceil(e.getDuration() * .05), e.getAmplifier());
newEffect.setCurativeItems(new ArrayList(e.getCurativeItems()));
target.addPotionEffect(newEffect);
}
}
}
@Override
public void applyToEntity(EntityLivingBase target, @Nullable EntityPlayer shooter, ItemStack thrower, Fluid fluid) {
}
@Override
public void applyToBlock(World worldObj, RayTraceResult mop, @Nullable EntityPlayer shooter, ItemStack thrower, FluidStack fluid) {
}
@Override
public void applyToBlock(World worldObj, RayTraceResult mop, @Nullable EntityPlayer shooter, ItemStack thrower, Fluid fluid) {
}
});
ChemthrowerHandler.registerEffect(fluidCreosote, new ChemthrowerEffect_Potion(null, 0, IEPotions.flammable, 140, 0));
ChemthrowerHandler.registerFlammable(fluidCreosote);
ChemthrowerHandler.registerEffect(fluidBiodiesel, new ChemthrowerEffect_Potion(null, 0, IEPotions.flammable, 140, 1));
ChemthrowerHandler.registerFlammable(fluidBiodiesel);
ChemthrowerHandler.registerFlammable(fluidEthanol);
ChemthrowerHandler.registerEffect("oil", new ChemthrowerEffect_Potion(null, 0, new PotionEffect(IEPotions.flammable, 140, 0), new PotionEffect(MobEffects.BLINDNESS, 80, 1)));
ChemthrowerHandler.registerFlammable("oil");
ChemthrowerHandler.registerEffect("fuel", new ChemthrowerEffect_Potion(null, 0, IEPotions.flammable, 100, 1));
ChemthrowerHandler.registerFlammable("fuel");
ChemthrowerHandler.registerEffect("diesel", new ChemthrowerEffect_Potion(null, 0, IEPotions.flammable, 140, 1));
ChemthrowerHandler.registerFlammable("diesel");
ChemthrowerHandler.registerEffect("kerosene", new ChemthrowerEffect_Potion(null, 0, IEPotions.flammable, 100, 1));
ChemthrowerHandler.registerFlammable("kerosene");
ChemthrowerHandler.registerEffect("biofuel", new ChemthrowerEffect_Potion(null, 0, IEPotions.flammable, 140, 1));
ChemthrowerHandler.registerFlammable("biofuel");
ChemthrowerHandler.registerEffect("rocket_fuel", new ChemthrowerEffect_Potion(null, 0, IEPotions.flammable, 60, 2));
ChemthrowerHandler.registerFlammable("rocket_fuel");
RailgunHandler.registerProjectileProperties(new IngredientStack("stickIron"), 10, 1.25).setColourMap(new int[][] { { 0xd8d8d8, 0xd8d8d8, 0xd8d8d8, 0xa8a8a8, 0x686868, 0x686868 } });
RailgunHandler.registerProjectileProperties(new IngredientStack("stickAluminum"), 9, 1.05).setColourMap(new int[][] { { 0xd8d8d8, 0xd8d8d8, 0xd8d8d8, 0xa8a8a8, 0x686868, 0x686868 } });
RailgunHandler.registerProjectileProperties(new IngredientStack("stickSteel"), 12, 1.25).setColourMap(new int[][] { { 0xb4b4b4, 0xb4b4b4, 0xb4b4b4, 0x7a7a7a, 0x555555, 0x555555 } });
RailgunHandler.registerProjectileProperties(new ItemStack(itemGraphiteElectrode), 16, .9).setColourMap(new int[][] { { 0x242424, 0x242424, 0x242424, 0x171717, 0x171717, 0x0a0a0a } });
ExternalHeaterHandler.defaultFurnaceEnergyCost = IEConfig.Machines.heater_consumption;
ExternalHeaterHandler.defaultFurnaceSpeedupCost = IEConfig.Machines.heater_speedupConsumption;
ExternalHeaterHandler.registerHeatableAdapter(TileEntityFurnace.class, new DefaultFurnaceAdapter());
SqueezerRecipe.addRecipe(new FluidStack(fluidPlantoil, 80), null, Items.WHEAT_SEEDS, 6400);
SqueezerRecipe.addRecipe(new FluidStack(fluidPlantoil, 80), null, Items.PUMPKIN_SEEDS, 6400);
SqueezerRecipe.addRecipe(new FluidStack(fluidPlantoil, 80), null, Items.MELON_SEEDS, 6400);
SqueezerRecipe.addRecipe(new FluidStack(fluidPlantoil, 120), null, itemSeeds, 6400);
SqueezerRecipe.addRecipe(null, new ItemStack(itemMaterial, 1, 18), new ItemStack(itemMaterial, 8, 17), 19200);
Fluid fluidBlood = FluidRegistry.getFluid("blood");
if (fluidBlood != null)
SqueezerRecipe.addRecipe(new FluidStack(fluidBlood, 5), new ItemStack(Items.LEATHER), new ItemStack(Items.ROTTEN_FLESH), 6400);
FermenterRecipe.addRecipe(new FluidStack(fluidEthanol, 80), null, Items.REEDS, 6400);
FermenterRecipe.addRecipe(new FluidStack(fluidEthanol, 80), null, Items.MELON, 6400);
FermenterRecipe.addRecipe(new FluidStack(fluidEthanol, 80), null, Items.APPLE, 6400);
FermenterRecipe.addRecipe(new FluidStack(fluidEthanol, 80), null, "cropPotato", 6400);
RefineryRecipe.addRecipe(new FluidStack(fluidBiodiesel, 16), new FluidStack(fluidPlantoil, 8), new FluidStack(fluidEthanol, 8), 80);
MixerRecipe.addRecipe(new FluidStack(fluidConcrete, 500), new FluidStack(FluidRegistry.WATER, 500), new Object[] { "sand", "sand", Items.CLAY_BALL, "gravel" }, 3200);
BottlingMachineRecipe.addRecipe(new ItemStack(Blocks.SPONGE, 1, 1), new ItemStack(Blocks.SPONGE, 1, 0), new FluidStack(FluidRegistry.WATER, 1000));
BelljarHandler.DefaultPlantHandler hempBelljarHandler = new BelljarHandler.DefaultPlantHandler() {
private HashSet<ComparableItemStack> validSeeds = new HashSet<>();
@Override
protected HashSet<ComparableItemStack> getSeedSet() {
return validSeeds;
}
@Override
@SideOnly(Side.CLIENT)
public IBlockState[] getRenderedPlant(ItemStack seed, ItemStack soil, float growth, TileEntity tile) {
int age = Math.min(4, Math.round(growth * 4));
if (age == 4)
return new IBlockState[] { blockCrop.getStateFromMeta(age), blockCrop.getStateFromMeta(age + 1) };
return new IBlockState[] { blockCrop.getStateFromMeta(age) };
}
@Override
@SideOnly(Side.CLIENT)
public float getRenderSize(ItemStack seed, ItemStack soil, float growth, TileEntity tile) {
return .6875f;
}
};
BelljarHandler.registerHandler(hempBelljarHandler);
hempBelljarHandler.register(new ItemStack(itemSeeds), new ItemStack[] { new ItemStack(itemMaterial, 4, 4), new ItemStack(itemSeeds, 2) }, new ItemStack(Blocks.DIRT), blockCrop.getDefaultState());
ThermoelectricHandler.registerSourceInKelvin("blockIce", 273);
ThermoelectricHandler.registerSourceInKelvin("blockPackedIce", 200);
ThermoelectricHandler.registerSourceInKelvin("blockUranium", 2000);
ThermoelectricHandler.registerSourceInKelvin("blockYellorium", 2000);
ThermoelectricHandler.registerSourceInKelvin("blockPlutonium", 4000);
ThermoelectricHandler.registerSourceInKelvin("blockBlutonium", 4000);
ExcavatorHandler.mineralVeinCapacity = IEConfig.Machines.excavator_depletion;
ExcavatorHandler.mineralChance = IEConfig.Machines.excavator_chance;
ExcavatorHandler.defaultDimensionBlacklist = IEConfig.Machines.excavator_dimBlacklist;
ExcavatorHandler.addMineral("Iron", 25, .1f, new String[] { "oreIron", "oreNickel", "oreTin", "denseoreIron" }, new float[] { .5f, .25f, .20f, .05f });
ExcavatorHandler.addMineral("Magnetite", 25, .1f, new String[] { "oreIron", "oreGold" }, new float[] { .85f, .15f });
if (OreDictionary.doesOreNameExist("oreSulfur"))
ExcavatorHandler.addMineral("Pyrite", 20, .1f, new String[] { "oreIron", "oreSulfur" }, new float[] { .5f, .5f });
ExcavatorHandler.addMineral("Bauxite", 20, .2f, new String[] { "oreAluminum", "oreTitanium", "denseoreAluminum" }, new float[] { .90f, .05f, .05f });
ExcavatorHandler.addMineral("Copper", 30, .2f, new String[] { "oreCopper", "oreGold", "oreNickel", "denseoreCopper" }, new float[] { .65f, .25f, .05f, .05f });
if (OreDictionary.doesOreNameExist("oreTin"))
ExcavatorHandler.addMineral("Cassiterite", 15, .2f, new String[] { "oreTin", "denseoreTin" }, new float[] { .95f, .05f });
ExcavatorHandler.addMineral("Gold", 20, .3f, new String[] { "oreGold", "oreCopper", "oreNickel", "denseoreGold" }, new float[] { .65f, .25f, .05f, .05f });
ExcavatorHandler.addMineral("Nickel", 20, .3f, new String[] { "oreNickel", "orePlatinum", "oreIron", "denseoreNickel" }, new float[] { .85f, .05f, .05f, .05f });
if (OreDictionary.doesOreNameExist("orePlatinum"))
ExcavatorHandler.addMineral("Platinum", 5, .35f, new String[] { "orePlatinum", "oreNickel", "", "oreIridium", "denseorePlatinum" }, new float[] { .40f, .30f, .15f, .1f, .05f });
if (OreDictionary.doesOreNameExist("oreUranium") || OreDictionary.doesOreNameExist("oreYellorium"))
ExcavatorHandler.addMineral("Uranium", 10, .35f, new String[] { "oreUranium", "oreLead", "orePlutonium", "denseoreUranium" }, new float[] { .55f, .3f, .1f, .05f }).addReplacement("oreUranium", "oreYellorium");
ExcavatorHandler.addMineral("Quartzite", 5, .3f, new String[] { "oreQuartz", "oreCertusQuartz" }, new float[] { .6f, .4f });
ExcavatorHandler.addMineral("Galena", 15, .2f, new String[] { "oreLead", "oreSilver", "oreSulfur", "denseoreLead", "denseoreSilver" }, new float[] { .40f, .40f, .1f, .05f, .05f });
ExcavatorHandler.addMineral("Lead", 10, .15f, new String[] { "oreLead", "oreSilver", "denseoreLead" }, new float[] { .55f, .4f, .05f });
ExcavatorHandler.addMineral("Silver", 10, .2f, new String[] { "oreSilver", "oreLead", "denseoreSilver" }, new float[] { .55f, .4f, .05f });
ExcavatorHandler.addMineral("Lapis", 10, .2f, new String[] { "oreLapis", "oreIron", "oreSulfur", "denseoreLapis" }, new float[] { .65f, .275f, .025f, .05f });
ExcavatorHandler.addMineral("Coal", 25, .1f, new String[] { "oreCoal", "denseoreCoal", "oreDiamond", "oreEmerald" }, new float[] { .92f, .1f, .015f, .015f });
/**MULTIBLOCKS*/
MultiblockHandler.registerMultiblock(MultiblockCokeOven.instance);
MultiblockHandler.registerMultiblock(MultiblockBlastFurnace.instance);
MultiblockHandler.registerMultiblock(MultiblockBlastFurnaceAdvanced.instance);
MultiblockHandler.registerMultiblock(MultiblockMetalPress.instance);
MultiblockHandler.registerMultiblock(MultiblockCrusher.instance);
MultiblockHandler.registerMultiblock(MultiblockSheetmetalTank.instance);
MultiblockHandler.registerMultiblock(MultiblockSilo.instance);
MultiblockHandler.registerMultiblock(MultiblockAssembler.instance);
MultiblockHandler.registerMultiblock(MultiblockAutoWorkbench.instance);
MultiblockHandler.registerMultiblock(MultiblockBottlingMachine.instance);
MultiblockHandler.registerMultiblock(MultiblockSqueezer.instance);
MultiblockHandler.registerMultiblock(MultiblockFermenter.instance);
MultiblockHandler.registerMultiblock(MultiblockRefinery.instance);
MultiblockHandler.registerMultiblock(MultiblockDieselGenerator.instance);
MultiblockHandler.registerMultiblock(MultiblockExcavator.instance);
MultiblockHandler.registerMultiblock(MultiblockBucketWheel.instance);
MultiblockHandler.registerMultiblock(MultiblockArcFurnace.instance);
MultiblockHandler.registerMultiblock(MultiblockLightningrod.instance);
MultiblockHandler.registerMultiblock(MultiblockMixer.instance);
/**ACHIEVEMENTS*/
IEAchievements.init();
/**VILLAGE*/
VillagerRegistry villageRegistry = VillagerRegistry.instance();
if (IEConfig.villagerHouse) {
villageRegistry.registerVillageCreationHandler(new VillageEngineersHouse.VillageManager());
MapGenStructureIO.registerStructureComponent(VillageEngineersHouse.class, ImmersiveEngineering.MODID + ":EngineersHouse");
}
if (IEConfig.enableVillagers) {
villagerProfession_engineer = new VillagerRegistry.VillagerProfession(ImmersiveEngineering.MODID + ":engineer", "immersiveengineering:textures/models/villager_engineer.png", "immersiveengineering:textures/models/villager_engineer_zombie.png");
villageRegistry.register(villagerProfession_engineer);
VillagerRegistry.VillagerCareer career_engineer = new VillagerRegistry.VillagerCareer(villagerProfession_engineer, ImmersiveEngineering.MODID + ".engineer");
career_engineer.addTrade(1, new IEVillagerTrades.EmeraldForItemstack(new ItemStack(itemMaterial, 1, 0), new EntityVillager.PriceInfo(8, 16)), new IEVillagerTrades.ItemstackForEmerald(new ItemStack(blockWoodenDecoration, 1, 1), new EntityVillager.PriceInfo(-10, -6)), new IEVillagerTrades.ItemstackForEmerald(new ItemStack(blockClothDevice, 1, 1), new EntityVillager.PriceInfo(-3, -1)));
career_engineer.addTrade(2, new IEVillagerTrades.EmeraldForItemstack(new ItemStack(itemMaterial, 1, 1), new EntityVillager.PriceInfo(2, 6)), new IEVillagerTrades.ItemstackForEmerald(new ItemStack(blockMetalDecoration1, 1, 1), new EntityVillager.PriceInfo(-8, -4)), new IEVillagerTrades.ItemstackForEmerald(new ItemStack(blockMetalDecoration1, 1, 5), new EntityVillager.PriceInfo(-8, -4)));
career_engineer.addTrade(3, new IEVillagerTrades.EmeraldForItemstack(new ItemStack(itemMaterial, 1, 2), new EntityVillager.PriceInfo(2, 6)), new IEVillagerTrades.EmeraldForItemstack(new ItemStack(itemMaterial, 1, 7), new EntityVillager.PriceInfo(4, 8)), new IEVillagerTrades.ItemstackForEmerald(new ItemStack(blockStoneDecoration, 1, 5), new EntityVillager.PriceInfo(-6, -2)));
VillagerRegistry.VillagerCareer career_machinist = new VillagerRegistry.VillagerCareer(villagerProfession_engineer, ImmersiveEngineering.MODID + ".machinist");
career_machinist.addTrade(1, new IEVillagerTrades.EmeraldForItemstack(new ItemStack(itemMaterial, 1, 6), new EntityVillager.PriceInfo(8, 16)), new IEVillagerTrades.ItemstackForEmerald(new ItemStack(itemTool, 1, 0), new EntityVillager.PriceInfo(4, 7)));
career_machinist.addTrade(2, new IEVillagerTrades.EmeraldForItemstack(new ItemStack(itemMetal, 1, 0), new EntityVillager.PriceInfo(4, 6)), new IEVillagerTrades.EmeraldForItemstack(new ItemStack(itemMetal, 1, 1), new EntityVillager.PriceInfo(4, 6)), new IEVillagerTrades.ItemstackForEmerald(new ItemStack(itemMaterial, 1, 9), new EntityVillager.PriceInfo(1, 3)));
career_machinist.addTrade(3, new IEVillagerTrades.ItemstackForEmerald(new ItemStack(itemToolbox, 1, 0), new EntityVillager.PriceInfo(6, 8)), new IEVillagerTrades.ItemstackForEmerald(new ItemStack(itemMaterial, 1, 10), new EntityVillager.PriceInfo(1, 3)), new IEVillagerTrades.ItemstackForEmerald(ItemEngineersBlueprint.getTypedBlueprint("specialBullet"), new EntityVillager.PriceInfo(5, 9)));
career_machinist.addTrade(4, new IEVillagerTrades.ItemstackForEmerald(new ItemStack(itemDrillhead, 1, 0), new EntityVillager.PriceInfo(28, 40)), new IEVillagerTrades.ItemstackForEmerald(itemEarmuffs, new EntityVillager.PriceInfo(4, 9)));
career_machinist.addTrade(5, new IEVillagerTrades.ItemstackForEmerald(new ItemStack(itemDrillhead, 1, 1), new EntityVillager.PriceInfo(32, 48)), new IEVillagerTrades.ItemstackForEmerald(ItemEngineersBlueprint.getTypedBlueprint("electrode"), new EntityVillager.PriceInfo(12, 24)));
VillagerRegistry.VillagerCareer career_electrician = new VillagerRegistry.VillagerCareer(villagerProfession_engineer, ImmersiveEngineering.MODID + ".electrician");
career_electrician.addTrade(1, new IEVillagerTrades.EmeraldForItemstack(new ItemStack(itemMaterial, 1, 20), new EntityVillager.PriceInfo(8, 16)), new IEVillagerTrades.ItemstackForEmerald(new ItemStack(itemTool, 1, 1), new EntityVillager.PriceInfo(4, 7)), new IEVillagerTrades.ItemstackForEmerald(new ItemStack(itemWireCoil, 1, 0), new EntityVillager.PriceInfo(-4, -2)));
career_electrician.addTrade(2, new IEVillagerTrades.EmeraldForItemstack(new ItemStack(itemMaterial, 1, 21), new EntityVillager.PriceInfo(6, 12)), new IEVillagerTrades.ItemstackForEmerald(new ItemStack(itemTool, 1, 2), new EntityVillager.PriceInfo(4, 7)), new IEVillagerTrades.ItemstackForEmerald(new ItemStack(itemWireCoil, 1, 1), new EntityVillager.PriceInfo(-4, -1)));
career_electrician.addTrade(3, new IEVillagerTrades.EmeraldForItemstack(new ItemStack(itemMaterial, 1, 22), new EntityVillager.PriceInfo(4, 8)), new IEVillagerTrades.ItemstackForEmerald(new ItemStack(itemWireCoil, 1, 1), new EntityVillager.PriceInfo(-2, -1)), new IEVillagerTrades.ItemstackForEmerald(new ItemStack(itemToolUpgrades, 1, 6), new EntityVillager.PriceInfo(8, 12)));
career_electrician.addTrade(4, new IEVillagerTrades.ItemstackForEmerald(new ItemStack(itemToolUpgrades, 1, 9), new EntityVillager.PriceInfo(8, 12)), new IEVillagerTrades.ItemstackForEmerald(new ItemStack(itemFluorescentTube), new EntityVillager.PriceInfo(8, 12)), new IEVillagerTrades.ItemstackForEmerald(new ItemStack(itemsFaradaySuit[0]), new EntityVillager.PriceInfo(5, 7)), new IEVillagerTrades.ItemstackForEmerald(new ItemStack(itemsFaradaySuit[1]), new EntityVillager.PriceInfo(9, 11)), new IEVillagerTrades.ItemstackForEmerald(new ItemStack(itemsFaradaySuit[2]), new EntityVillager.PriceInfo(5, 7)), new IEVillagerTrades.ItemstackForEmerald(new ItemStack(itemsFaradaySuit[3]), new EntityVillager.PriceInfo(11, 15)));
VillagerRegistry.VillagerCareer career_outfitter = new VillagerRegistry.VillagerCareer(villagerProfession_engineer, ImmersiveEngineering.MODID + ".outfitter");
ItemStack bag_common = new ItemStack(IEContent.itemShaderBag);
ItemNBTHelper.setString(bag_common, "rarity", EnumRarity.COMMON.toString());
ItemStack bag_uncommon = new ItemStack(IEContent.itemShaderBag);
ItemNBTHelper.setString(bag_uncommon, "rarity", EnumRarity.UNCOMMON.toString());
ItemStack bag_rare = new ItemStack(IEContent.itemShaderBag);
ItemNBTHelper.setString(bag_rare, "rarity", EnumRarity.RARE.toString());
career_outfitter.addTrade(1, new IEVillagerTrades.EmeraldForItemstack(bag_common, new EntityVillager.PriceInfo(8, 16)));
career_outfitter.addTrade(2, new IEVillagerTrades.EmeraldForItemstack(bag_uncommon, new EntityVillager.PriceInfo(12, 20)));
career_outfitter.addTrade(3, new IEVillagerTrades.EmeraldForItemstack(bag_rare, new EntityVillager.PriceInfo(16, 24)));
}
/**LOOT*/
if (IEConfig.villagerHouse)
LootTableList.register(VillageEngineersHouse.woodenCrateLoot);
for (ResourceLocation rl : EventHandler.lootInjections) LootTableList.register(rl);
// //Railcraft Compat
// if(Loader.isModLoaded("Railcraft"))
// {
// Block rcCube = GameRegistry.findBlock("Railcraft", "cube");
// if(rcCube!=null)
// OreDictionary.registerOre("blockFuelCoke", new ItemStack(rcCube,1,0));
// }
}
use of net.minecraft.item.crafting.ShapelessRecipes in project ArsMagica2 by Mithion.
the class RecipeUtilities method addShapelessRecipeFirst.
public static void addShapelessRecipeFirst(List recipeList, ItemStack par1ItemStack, Object... par2ArrayOfObj) {
ArrayList arraylist = new ArrayList();
Object[] aobject = par2ArrayOfObj;
int i = par2ArrayOfObj.length;
for (int j = 0; j < i; ++j) {
Object object1 = aobject[j];
if (object1 instanceof ItemStack) {
arraylist.add(((ItemStack) object1).copy());
} else if (object1 instanceof Item) {
arraylist.add(new ItemStack((Item) object1));
} else {
if (!(object1 instanceof Block)) {
throw new RuntimeException("Invalid shapeless recipy!");
}
arraylist.add(new ItemStack((Block) object1));
}
}
recipeList.add(0, new ShapelessRecipes(par1ItemStack, arraylist));
}
use of net.minecraft.item.crafting.ShapelessRecipes in project Skree by Skelril.
the class MarketVerifyCommand method execute.
@Override
public CommandResult execute(CommandSource src, CommandContext args) throws CommandException {
Optional<MarketService> optService = Sponge.getServiceManager().provide(MarketService.class);
if (!optService.isPresent()) {
src.sendMessage(Text.of(TextColors.DARK_RED, "The market service is not currently running."));
return CommandResult.empty();
}
MarketService service = optService.get();
Task.builder().async().execute(() -> {
PaginationService pagination = Sponge.getServiceManager().provideUnchecked(PaginationService.class);
List<Clause<String, BigDecimal>> profitMargins = new ArrayList<>();
for (IRecipe recipe : CraftingManager.getInstance().getRecipeList()) {
ItemStack output = recipe.getRecipeOutput();
if (output == null) {
continue;
}
Optional<BigDecimal> optResultPrice = service.getPrice(tf(output));
if (!optResultPrice.isPresent()) {
continue;
}
String name = service.getAlias(tf(output)).orElse(output.getItem().getRegistryName().toString());
Collection<ItemStack> items = new ArrayList<>();
if (recipe instanceof ShapedRecipes) {
items.addAll(Lists.newArrayList(((ShapedRecipes) recipe).recipeItems));
} else if (recipe instanceof ShapelessRecipes) {
items.addAll(((ShapelessRecipes) recipe).recipeItems);
} else {
src.sendMessage(Text.of(TextColors.RED, "Unsupported recipe for " + name));
continue;
}
items.removeAll(Collections.singleton(null));
BigDecimal creationCost = BigDecimal.ZERO;
try {
for (ItemStack stack : items) {
creationCost = creationCost.add(service.getPrice(tf(stack)).orElse(BigDecimal.ZERO));
}
} catch (Exception ex) {
src.sendMessage(Text.of(TextColors.RED, "Couldn't complete checks for " + name));
continue;
}
if (creationCost.equals(BigDecimal.ZERO)) {
src.sendMessage(Text.of(TextColors.RED, "No ingredients found on market for " + name));
continue;
}
BigDecimal sellPrice = optResultPrice.get();
sellPrice = sellPrice.multiply(service.getSellFactor(sellPrice));
profitMargins.add(new Clause<>(name, sellPrice.subtract(creationCost)));
}
List<Text> result = profitMargins.stream().sorted((a, b) -> b.getValue().subtract(a.getValue()).intValue()).map(a -> {
boolean profitable = a.getValue().compareTo(BigDecimal.ZERO) >= 0;
return Text.of(profitable ? TextColors.RED : TextColors.GREEN, a.getKey().toUpperCase(), " has a profit margin of ", profitable ? "+" : "", MarketImplUtil.format(a.getValue()));
}).collect(Collectors.toList());
pagination.builder().contents(result).title(Text.of(TextColors.GOLD, "Profit Margin Report")).padding(Text.of(" ")).sendTo(src);
}).submit(SkreePlugin.inst());
src.sendMessage(Text.of(TextColors.YELLOW, "Verification in progress..."));
return CommandResult.success();
}
Aggregations