use of betterwithaddons.crafting.recipes.infuser.TransmutationRecipe in project BetterWithAddons by DaedalusGame.
the class InteractionEriottoMod method init.
@Override
public void init() {
ModBlocks.mulberrySapling.setLeaves(ModBlocks.mulberryLeaves.getDefaultState()).setLog(ModBlocks.mulberryLog.getDefaultState());
ModBlocks.mulberryLeaves.setSapling(new ItemStack(ModBlocks.mulberrySapling));
ModBlocks.sakuraSapling.setLeaves(ModBlocks.sakuraLeaves.getDefaultState()).setLog(ModBlocks.sakuraLog.getDefaultState()).setBig(true);
ModBlocks.sakuraLeaves.setSapling(new ItemStack(ModBlocks.sakuraSapling));
ModBlocks.connectPanes(ModBlocks.shoji, ModBlocks.fusuma);
CraftingManagerSandNet.getInstance().addRecipe(new ItemStack[] { new ItemStack(ModBlocks.ironSand, 1) }, new OreIngredient("blockIron"), 8);
CraftingManagerWaterNet.getInstance().addRecipe(new ItemStack[] { new ItemStack(Blocks.IRON_BLOCK, 1), new ItemStack(Blocks.SAND, 8) }, IngredientSized.fromBlock(ModBlocks.ironSand, 1), 0);
CraftingManagerWaterNet.getInstance().addRecipe(new ItemStack[] { ItemStack.EMPTY, new ItemStack(ModItems.sashimi, 3) }, IngredientSized.fromStacks(new ItemStack(Items.FISH, 1)), 0);
CraftingManagerWaterNet.getInstance().addRecipe(new ItemStack[] { new ItemStack(ModItems.fuguSac, 1), new ItemStack(ModItems.preparedPuffer, 3) }, Ingredient.fromStacks(new ItemStack(Items.FISH, 1, ItemFishFood.FishType.PUFFERFISH.getMetadata())), 0);
CraftingManagerFireNet.getInstance().addRecipe(new ItemStack[] { ModItems.materialJapan.getMaterial("iron_scales", 27) }, Ingredient.fromStacks(new ItemStack(ModBlocks.ironSand, 1)));
CraftingManagerWaterNet.getInstance().addRecipe(new ItemStack[] { ItemStack.EMPTY, ModItems.materialJapan.getMaterial("washi", 9) }, Ingredient.fromStacks(ModItems.materialJapan.getMaterial("mulberry_sheet")), 0);
// I'll beat the shit out of HarvestCraft
OreDictionary.registerOre("seed", new ItemStack(Items.WHEAT_SEEDS));
OreDictionary.registerOre("seed", new ItemStack(Items.PUMPKIN_SEEDS));
OreDictionary.registerOre("seed", new ItemStack(Items.MELON_SEEDS));
OreDictionary.registerOre("seed", new ItemStack(Items.BEETROOT_SEEDS));
if (ModInteractions.bwm.isActive())
OreDictionary.registerOre("seed", new ItemStack(BWMBlocks.HEMP));
OreDictionary.registerOre("seed", new ItemStack(ModBlocks.rice));
OreDictionary.registerOre("seed", new ItemStack(ModBlocks.rush));
OreDictionary.registerOre("cropRice", ModItems.materialJapan.getMaterial("rice"));
OreDictionary.registerOre("seedRice", new ItemStack(ModBlocks.rice));
OreDictionary.registerOre("cropRush", ModItems.materialJapan.getMaterial("rush"));
OreDictionary.registerOre("seedRush", new ItemStack(ModBlocks.rush));
OreDictionary.registerOre("materialBamboo", new ItemStack(ModBlocks.bamboo));
OreDictionary.registerOre("treeSapling", ModBlocks.sakuraSapling);
OreDictionary.registerOre("treeSapling", ModBlocks.mulberrySapling);
OreDictionary.registerOre("logWood", ModBlocks.sakuraLog);
OreDictionary.registerOre("logWood", ModBlocks.mulberryLog);
OreDictionary.registerOre("plankWood", ModBlocks.sakuraPlanks);
OreDictionary.registerOre("plankWood", ModBlocks.mulberryPlanks);
OreDictionary.registerOre("barkWood", ModItems.materialJapan.getMaterial("bark_mulberry"));
OreDictionary.registerOre("barkWood", ModItems.materialJapan.getMaterial("bark_sakura"));
OreDictionary.registerOre("ingotTamahagane", ModItems.materialJapan.getMaterial("tamahagane_finished"));
OreDictionary.registerOre("ingotHochoTetsu", ModItems.materialJapan.getMaterial("hocho_tetsu_finished"));
BWOreDictionary.woods.add(new Wood(new ItemStack(ModBlocks.sakuraLog), new ItemStack(ModBlocks.sakuraPlanks), ModItems.materialJapan.getMaterial("bark_sakura")));
BWOreDictionary.woods.add(new Wood(new ItemStack(ModBlocks.mulberryLog), new ItemStack(ModBlocks.mulberryPlanks), ModItems.materialJapan.getMaterial("bark_mulberry")) {
@Override
public ItemStack getPlank(int count) {
ItemStack copy = new ItemStack(ModBlocks.mulberryPlanks);
copy.setCount((int) Math.ceil(count / (float) HCLumber.axePlankAmount));
return copy;
}
});
CauldronManager.getInstance().addRecipe(new ItemStack(ModItems.rice), new Object[] { ModItems.materialJapan.getMaterial("soaked_rice") });
CauldronManager.getInstance().addRecipe(new ItemStack(ModItems.laxative), new Object[] { new ItemStack(ModItems.mulberry, 3), new ItemStack(Items.SUGAR), BlockRawPastry.getStack(BlockRawPastry.EnumType.BREAD) });
GameRegistry.addSmelting(new ItemStack(ModItems.preparedPuffer), new ItemStack(ModItems.preparedCookedPuffer), 0.35f);
GameRegistry.addSmelting(ModItems.materialJapan.getMaterial("soaked_rice"), new ItemStack(ModItems.rice), 0.35f);
// if (GRASS_DROPS_SEEDS) {
// MinecraftForge.addGrassSeed(new ItemStack(ModBlocks.rice), 2);
// MinecraftForge.addGrassSeed(new ItemStack(ModBlocks.rush), 2);
// }
GameRegistry.addSmelting(ModItems.materialJapan.getMaterial("rice_stalk"), ModItems.materialJapan.getMaterial("rice_ash"), 0.1f);
CraftingManagerInfuser.getInstance().addRecipe(new ShapedOreRecipe(new ResourceLocation(Reference.MOD_ID, "katana"), new ItemStack(ModItems.katana), "l", "l", "w", 'l', ModItems.materialJapan.getMaterial("half_katana_blade"), 'w', ModItems.materialJapan.getMaterial("tsuka")), 8);
CraftingManagerInfuser.getInstance().addRecipe(new ShapedOreRecipe(new ResourceLocation(Reference.MOD_ID, "wakizashi"), new ItemStack(ModItems.wakizashi), "l", "l", "w", 'l', "ingotTamahagane", 'w', ModItems.materialJapan.getMaterial("tsuka")), 6);
CraftingManagerInfuser.getInstance().addRecipe(new ShapedOreRecipe(new ResourceLocation(Reference.MOD_ID, "tanto"), new ItemStack(ModItems.tanto), "l", "w", 'l', "ingotTamahagane", 'w', ModItems.materialJapan.getMaterial("tsuka")), 4);
CraftingManagerInfuser.getInstance().addRecipe(new ShapedOreRecipe(new ResourceLocation(Reference.MOD_ID, "shinai"), new ItemStack(ModItems.shinai), "l", "l", "w", 'l', ModItems.materialJapan.getMaterial("bamboo_slats"), 'w', ModItems.materialJapan.getMaterial("tsuka")), 2);
CraftingManagerInfuser.getInstance().addRecipe(new ShapedOreRecipe(new ResourceLocation(Reference.MOD_ID, "ya"), new ItemStack(ModItems.ya, 12), "h", "l", "f", 'h', ModItems.materialJapan.getMaterial("ya_head"), 'l', ModItems.materialJapan.getMaterial("bamboo_slats"), 'f', new ItemStack(Items.FEATHER)), 2);
CraftingManagerInfuser.getInstance().addRecipe(new ShapedOreRecipe(new ResourceLocation(Reference.MOD_ID, "yumi"), new ItemStack(ModItems.yumi), " ns", "l s", " us", 'n', ModItems.materialJapan.getMaterial("yumi_top"), 'u', ModItems.materialJapan.getMaterial("yumi_bottom"), 'l', new ItemStack(Items.LEATHER), 's', new ItemStack(Items.STRING)), 5);
addArmorFinishRecipe("samurai_helmet", new ItemStack(ModItems.samuraiHelm), ModItems.materialJapan.getMaterial("helmet_undecorated"), 5);
addArmorFinishRecipe("samurai_chestplate", new ItemStack(ModItems.samuraiChestplate), ModItems.materialJapan.getMaterial("chest_undecorated"), 8);
addArmorFinishRecipe("samurai_leggings", new ItemStack(ModItems.samuraiLeggings), ModItems.materialJapan.getMaterial("legs_undecorated"), 7);
addArmorFinishRecipe("samurai_boots", new ItemStack(ModItems.samuraiBoots), ModItems.materialJapan.getMaterial("boots_undecorated"), 4);
CraftingManagerInfuser.getInstance().addRecipe(new ShapedOreRecipe(new ResourceLocation(Reference.MOD_ID, "netted_screen"), new ItemStack(ModBlocks.nettedScreen), "bsb", "sss", "bsb", 's', new ItemStack(Items.STRING), 'b', ModItems.materialJapan.getMaterial("bamboo_slats")), 2);
CraftingManagerInfuser.getInstance().addRecipe(new ShapedOreRecipe(new ResourceLocation(Reference.MOD_ID, "tatara"), new ItemStack(ModBlocks.tatara), "idi", "g g", "ini", 'i', new ItemStack(Items.IRON_INGOT), 'g', new ItemStack(Items.GOLD_INGOT), 'd', new ItemStack(Items.DIAMOND), 'n', new ItemStack(Blocks.NETHERRACK)), 4);
CraftingManagerInfuser.getInstance().addRecipe(new ShapedOreRecipe(new ResourceLocation(Reference.MOD_ID, "soaking_unit"), new ItemStack(ModBlocks.cherrybox, 1, 0), "pxp", "x x", "pxp", 'p', new ItemStack(ModBlocks.sakuraPlanks), 'x', new ItemStack(Blocks.IRON_BARS)), 1);
CraftingManagerInfuser.getInstance().addRecipe(new ShapedOreRecipe(new ResourceLocation(Reference.MOD_ID, "drying_unit"), new ItemStack(ModBlocks.cherrybox, 1, 1), "pxp", "p p", "ppp", 'p', new ItemStack(ModBlocks.sakuraPlanks), 'x', new ItemStack(Blocks.GLASS_PANE)), 1);
// Random seeds
CraftingManagerInfuserTransmutation.getInstance().addRecipe(new TransmutationRecipe(new OreIngredient("seed"), 1, ItemStack.EMPTY) {
Random random = new Random();
@Override
public ItemStack getOutput(ItemStack input) {
if (random.nextInt(2) == 0)
return new ItemStack(ModBlocks.rice);
else
return new ItemStack(ModBlocks.rush);
}
@Override
public boolean matchesInput(ItemStack item) {
if (item.getItem() == Item.getItemFromBlock(ModBlocks.rice) || item.getItem() == Item.getItemFromBlock(ModBlocks.rush))
return false;
return super.matchesInput(item);
}
@Override
public List<ItemStack> getRecipeOutputs() {
return Lists.newArrayList(new ItemStack(ModBlocks.rice), new ItemStack(ModBlocks.rush));
}
});
// Random saplings
CraftingManagerInfuserTransmutation.getInstance().addRecipe(new TransmutationRecipe(new OreIngredient("treeSapling"), 1, ItemStack.EMPTY) {
Random random = new Random();
@Override
public ItemStack getOutput(ItemStack input) {
if (random.nextInt(2) == 0)
return new ItemStack(ModBlocks.sakuraSapling);
else
return new ItemStack(ModBlocks.mulberrySapling);
}
@Override
public boolean matchesInput(ItemStack item) {
if (item.getItem() == Item.getItemFromBlock(ModBlocks.sakuraSapling) || item.getItem() == Item.getItemFromBlock(ModBlocks.mulberrySapling))
return false;
return super.matchesInput(item);
}
@Override
public List<ItemStack> getRecipeOutputs() {
return Lists.newArrayList(new ItemStack(ModBlocks.sakuraSapling), new ItemStack(ModBlocks.mulberrySapling));
}
});
// Bamboo
CraftingManagerInfuserTransmutation.getInstance().addRecipe(new OreIngredient("sugarcane"), 1, new ItemStack(ModBlocks.bamboo));
// Repair tools and armor
if (INFUSER_REPAIRS)
CraftingManagerInfuserTransmutation.getInstance().addRecipe(new TransmutationRecipe(Ingredient.fromItem(ModItems.katana), 2, ItemStack.EMPTY) {
@Override
public boolean matchesInput(ItemStack item) {
return isRepairableTool(item);
}
@Override
public List<ItemStack> getRecipeInputs() {
ArrayList<ItemStack> inputs = new ArrayList<>();
for (Item tool : REPAIRABLE_TOOLS) {
ItemStack basestack = new ItemStack(tool);
if (tool.isDamageable()) {
int maxdamage = basestack.getMaxDamage();
int durability = maxdamage / 20;
for (int i = 20; i >= 1; i--) {
ItemStack damaged = new ItemStack(tool, 1, Math.min(durability * i, maxdamage - 1));
inputs.add(damaged);
}
}
}
return inputs;
}
@Override
public ItemStack getOutput(ItemStack input) {
if (input.isItemStackDamageable())
input.setItemDamage(Math.max(0, input.getItemDamage() - input.getMaxDamage() / 20));
return input;
}
});
CraftingManagerSoakingBox.instance().addRecipe(Ingredient.fromStacks(new ItemStack(ModBlocks.bamboo)), ModItems.materialJapan.getMaterial("soaked_bamboo"));
CraftingManagerSoakingBox.instance().addRecipe(Ingredient.fromStacks(ModItems.materialJapan.getMaterial("rice")), ModItems.materialJapan.getMaterial("soaked_rice"));
if (ModInteractions.bwm.isActive())
CraftingManagerSoakingBox.instance().addRecipe(Ingredient.fromStacks(ModItems.materialJapan.getMaterial("bark_mulberry")), ModItems.materialJapan.getMaterial("soaked_mulberry"));
CraftingManagerSoakingBox.instance().addRecipe(Ingredient.fromStacks(new ItemStack(ModBlocks.mulberryLog)), ModItems.materialJapan.getMaterial("soaked_mulberry"));
CraftingManagerSoakingBox.instance().addRecipe(Ingredient.fromStacks(new ItemStack(Blocks.SPONGE, 1, 0)), new ItemStack(Blocks.SPONGE, 1, 1));
CraftingManagerDryingBox.instance().addRecipe(Ingredient.fromStacks(ModItems.materialJapan.getMaterial("rice_stalk")), ModItems.materialJapan.getMaterial("rice_hay"));
CraftingManagerDryingBox.instance().addRecipe(Ingredient.fromStacks(ModItems.materialJapan.getMaterial("soaked_mulberry")), ModItems.materialJapan.getMaterial("mulberry_paste"));
CraftingManagerDryingBox.instance().addRecipe(Ingredient.fromStacks(ModItems.materialJapan.getMaterial("soaked_bamboo")), ModItems.materialJapan.getMaterial("bamboo_slats"));
CraftingManagerDryingBox.instance().addRecipe(Ingredient.fromStacks(new ItemStack(Blocks.SPONGE, 1, 1)), new ItemStack(Blocks.SPONGE, 1, 0));
CraftingManagerTatara.instance().addRecipe(Ingredient.fromStacks(new ItemStack(ModBlocks.ironSand)), new ItemStack(ModBlocks.kera));
CraftingManagerTatara.instance().addRecipe(Ingredient.fromStacks(ModItems.materialJapan.getMaterial("tamahagane")), ModItems.materialJapan.getMaterial("tamahagane_heated"));
CraftingManagerTatara.instance().addRecipe(Ingredient.fromStacks(ModItems.materialJapan.getMaterial("tamahagane_wrapped")), ModItems.materialJapan.getMaterial("tamahagane_reheated"));
CraftingManagerTatara.instance().addRecipe(Ingredient.fromStacks(ModItems.materialJapan.getMaterial("hocho_tetsu")), ModItems.materialJapan.getMaterial("hocho_tetsu_heated"));
}
use of betterwithaddons.crafting.recipes.infuser.TransmutationRecipe in project BetterWithAddons by DaedalusGame.
the class CraftingManagerInfuserTransmutation method getSmeltingRecipe.
public TransmutationRecipe getSmeltingRecipe(ItemStack input, int spirits) {
Iterator<TransmutationRecipe> var2 = this.recipes.iterator();
TransmutationRecipe entry;
do {
if (!var2.hasNext()) {
return null;
}
entry = var2.next();
} while (!entry.matchesInput(input, spirits));
return entry;
}
use of betterwithaddons.crafting.recipes.infuser.TransmutationRecipe in project BetterWithAddons by DaedalusGame.
the class TileEntityInfuser method update.
@Override
public void update() {
animLife++;
activeGlowLast = activeGlow;
activeGlow = MathHelper.clamp(activeGlow + (isValid() ? 0.05f : -0.05f), 0, 1);
if (world.isRemote)
return;
AxisAlignedBB aabb = new AxisAlignedBB(pos).offset(0, 0.5, 0);
List<EntityItem> items = world.getEntitiesWithinAABB(EntityItem.class, aabb);
int spirits = getSpirits();
if (spirits > 0)
for (EntityItem item : items) {
if (item.cannotPickup())
continue;
ItemStack stack = item.getItem();
TransmutationRecipe recipe = CraftingManagerInfuserTransmutation.getInstance().getSmeltingRecipe(stack, spirits);
if (recipe != null) {
int consumed = recipe.getRequiredSpirit(stack);
ItemStack output = recipe.getOutput(stack);
if (output.isEmpty())
continue;
if (recipe.getInputCount() == stack.getCount())
stack = output;
else {
EntityItem result = new EntityItem(world, item.posX, item.posY, item.posZ, output.copy());
result.setDefaultPickupDelay();
world.spawnEntity(result);
stack.shrink(recipe.getInputCount());
}
item.setItem(stack);
if (stack.isEmpty())
item.setDead();
consumeSpirits(consumed);
break;
}
}
}
Aggregations