From 820f097c12f9f7dd2f8cf9ca43ff42293df3d6af Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 13 Sep 2016 20:40:26 +0200 Subject: [PATCH] Added recipe for empowered oil --- .../actuallyadditions/mod/items/ItemMisc.java | 21 +++++++++++-------- .../mod/items/metalists/TheMiscItems.java | 1 + .../mod/recipe/EmpowererHandler.java | 3 +++ .../assets/actuallyadditions/lang/en_US.lang | 1 + 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMisc.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMisc.java index 0af3b3ea3..596cf016d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMisc.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMisc.java @@ -78,16 +78,19 @@ public class ItemMisc extends ItemBase{ public boolean onEntityItemUpdate(EntityItem entity){ if(!entity.worldObj.isRemote){ ItemStack stack = entity.getEntityItem(); - if(stack != null && stack.getItemDamage() == TheMiscItems.CRYSTALLIZED_CANOLA_SEED.ordinal()){ - BlockPos pos = entity.getPosition(); - IBlockState state = entity.worldObj.getBlockState(pos); - Block block = state.getBlock(); + if(stack != null){ + boolean isEmpowered = stack.getItemDamage() == TheMiscItems.EMPOWERED_CANOLA_SEED.ordinal(); + if(stack.getItemDamage() == TheMiscItems.CRYSTALLIZED_CANOLA_SEED.ordinal() || isEmpowered){ + BlockPos pos = entity.getPosition(); + IBlockState state = entity.worldObj.getBlockState(pos); + Block block = state.getBlock(); - if(block instanceof IFluidBlock && block.getMetaFromState(state) == 0){ - Fluid fluid = ((IFluidBlock)block).getFluid(); - if(fluid != null && fluid == InitFluids.fluidOil){ - entity.setDead(); - entity.worldObj.setBlockState(pos, InitFluids.blockCrystalOil.getDefaultState()); + if(block instanceof IFluidBlock && block.getMetaFromState(state) == 0){ + Fluid fluid = ((IFluidBlock)block).getFluid(); + if(fluid != null && fluid == (isEmpowered ? InitFluids.fluidCrystalOil : InitFluids.fluidOil)){ + entity.setDead(); + entity.worldObj.setBlockState(pos, (isEmpowered ? InitFluids.blockEmpoweredOil : InitFluids.blockCrystalOil).getDefaultState()); + } } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/TheMiscItems.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/TheMiscItems.java index d3fb3635e..4289e6442 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/TheMiscItems.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/TheMiscItems.java @@ -39,6 +39,7 @@ public enum TheMiscItems{ BIOMASS("Biomass", EnumRarity.UNCOMMON), BIOCOAL("Biocoal", EnumRarity.RARE), CRYSTALLIZED_CANOLA_SEED("CrystallizedCanolaSeed", EnumRarity.UNCOMMON), + EMPOWERED_CANOLA_SEED("EmpoweredCanolaSeed", EnumRarity.RARE), YOUTUBE_ICON("YoutubeIcon", Util.FALLBACK_RARITY); public final String name; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/EmpowererHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/EmpowererHandler.java index e1973ac59..4ac5aabd7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/EmpowererHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/recipe/EmpowererHandler.java @@ -43,6 +43,9 @@ public final class EmpowererHandler{ for(ItemStack ball : balls){ addCrystalEmpowering(TheCrystals.EMERALD, new ItemStack(Items.DYE, 1, EnumDyeColor.LIME.getDyeDamage()), new ItemStack(Blocks.TALLGRASS, 1, 1), new ItemStack(Blocks.SAPLING), ball.copy()); } + + ItemStack seed = new ItemStack(InitItems.itemCanolaSeed); + ActuallyAdditionsAPI.addEmpowererRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CRYSTALLIZED_CANOLA_SEED.ordinal()), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.EMPOWERED_CANOLA_SEED.ordinal()), seed, seed, seed, seed, 1000, 30, new float[]{1F, 91F/255F, 76F/255F}); } private static void addCrystalEmpowering(TheCrystals type, ItemStack modifier1, ItemStack modifier2, ItemStack modifier3, ItemStack modifier4){ diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index 93a64aecc..2aa7e31ef 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -505,6 +505,7 @@ item.actuallyadditions.itemWorm.name=Worm item.actuallyadditions.itemBag.name=Traveler's Sack item.actuallyadditions.itemVoidBag.name=Void Sack item.actuallyadditions.itemMiscCrystallizedCanolaSeed.name=Crystallized Canola Seed +item.actuallyadditions.itemMiscEmpoweredCanolaSeed.name=Empowered Canola Seed #Tooltips tooltip.actuallyadditions.onSuffix.desc=On