diff --git a/lang b/lang index 50cc3f6cf..2a4b65a20 160000 --- a/lang +++ b/lang @@ -1 +1 @@ -Subproject commit 50cc3f6cfccce773a97d944bf8c7539b5b0780d5 +Subproject commit 2a4b65a20c3153f71cea5d323da843524e358695 diff --git a/src/main/java/forestry/apiculture/PluginApiculture.java b/src/main/java/forestry/apiculture/PluginApiculture.java index a8aa8455b..f0e7d63b4 100644 --- a/src/main/java/forestry/apiculture/PluginApiculture.java +++ b/src/main/java/forestry/apiculture/PluginApiculture.java @@ -275,9 +275,18 @@ public class PluginApiculture extends BlankForestryPlugin { villagerRegistry.register(villagerApiarist); ItemStack wildcardPrincess = new ItemStack(items.beePrincessGE, 1); + ItemStack wildcardDrone = new ItemStack(items.beeDroneGE, 1); ItemStack apiary = new ItemStack(blocks.apiary); ItemStack provenFrames = items.frameProven.getItemStack(); ItemStack monasticDrone = BeeDefinition.MONASTIC.getMemberStack(EnumBeeType.DRONE); + ItemStack endDrone = BeeDefinition.ENDED.getMemberStack(EnumBeeType.DRONE); + ItemStack propolis = new ItemStack(PluginApiculture.items.propolis,1); + ItemStack forestDrone = BeeDefinition.FOREST.getMemberStack(EnumBeeType.DRONE); + ItemStack meadowsDrone = BeeDefinition.MEADOWS.getMemberStack(EnumBeeType.DRONE); + ItemStack modestDrone = BeeDefinition.MODEST.getMemberStack(EnumBeeType.DRONE); + ItemStack tropicalDrone = BeeDefinition.TROPICAL.getMemberStack(EnumBeeType.DRONE); + ItemStack wintryDrone = BeeDefinition.WINTRY.getMemberStack(EnumBeeType.DRONE); + ItemStack marshyDrone = BeeDefinition.MARSHY.getMemberStack(EnumBeeType.DRONE); VillagerRegistry.VillagerCareer apiaristCareer = new VillagerRegistry.VillagerCareer(villagerApiarist, "apiarist"); apiaristCareer.addTrade(1, @@ -291,10 +300,17 @@ public class PluginApiculture extends BlankForestryPlugin { ); apiaristCareer.addTrade(3, new VillagerTradeLists.GiveEmeraldForItems(wildcardPrincess, null), - new VillagerTradeLists.GiveItemForEmeralds(new EntityVillager.PriceInfo(1, 2), provenFrames, new EntityVillager.PriceInfo(1, 6)) + new VillagerTradeLists.GiveItemForEmeralds(new EntityVillager.PriceInfo(1, 2), provenFrames, new EntityVillager.PriceInfo(1, 6)), + new VillagerTradeLists.GiveItemForTwoItems(propolis, null, wildcardDrone, new EntityVillager.PriceInfo(2, 4), forestDrone, null), + new VillagerTradeLists.GiveItemForTwoItems(propolis, null, wildcardDrone, new EntityVillager.PriceInfo(2, 4), meadowsDrone, null), + new VillagerTradeLists.GiveItemForTwoItems(propolis, null, wildcardDrone, new EntityVillager.PriceInfo(2, 4), modestDrone, null), + new VillagerTradeLists.GiveItemForTwoItems(propolis, null, wildcardDrone, new EntityVillager.PriceInfo(2, 4), tropicalDrone, null), + new VillagerTradeLists.GiveItemForTwoItems(propolis, null, wildcardDrone, new EntityVillager.PriceInfo(2, 4), wintryDrone, null), + new VillagerTradeLists.GiveItemForTwoItems(propolis, null, wildcardDrone, new EntityVillager.PriceInfo(2, 4), marshyDrone, null) ); apiaristCareer.addTrade(4, - new VillagerTradeLists.GiveItemForItemAndEmerald(wildcardPrincess, null, new EntityVillager.PriceInfo(10, 64), monasticDrone, null) + new VillagerTradeLists.GiveItemForItemAndEmerald(wildcardPrincess, null, new EntityVillager.PriceInfo(10, 64), monasticDrone, null), + new VillagerTradeLists.GiveItemForTwoItems(wildcardPrincess, null,new ItemStack(Items.ENDER_EYE),new EntityVillager.PriceInfo(12, 16),endDrone, null) ); } diff --git a/src/main/java/forestry/core/utils/VillagerTradeLists.java b/src/main/java/forestry/core/utils/VillagerTradeLists.java index 92b613c0f..6a1b832e9 100644 --- a/src/main/java/forestry/core/utils/VillagerTradeLists.java +++ b/src/main/java/forestry/core/utils/VillagerTradeLists.java @@ -174,4 +174,59 @@ public class VillagerTradeLists { recipeList.add(new MerchantRecipe(randomLog, new ItemStack(Items.EMERALD, emeraldsAmount), itemToSell)); } } + public static class GiveItemForTwoItems implements EntityVillager.ITradeList { + @Nonnull + public ItemStack buyingItemStack; + @Nullable + public EntityVillager.PriceInfo buyingPriceInfo; + @Nonnull + public ItemStack buyingItemStackTwo; + @Nullable + public EntityVillager.PriceInfo buyingItemTwoInfo; + @Nonnull + public ItemStack sellingItemstack; + @Nullable + public EntityVillager.PriceInfo sellingPriceInfo; + + public GiveItemForTwoItems( + @Nonnull ItemStack buyingItemStack, + @Nullable EntityVillager.PriceInfo buyingPriceInfo, + @Nonnull ItemStack buyingItemStackTwo, + @Nullable EntityVillager.PriceInfo buyingItemTwoInfo, + @Nonnull ItemStack sellingItemstack, + @Nullable EntityVillager.PriceInfo sellingPriceInfo) { + this.buyingItemStack = buyingItemStack; + this.buyingPriceInfo = buyingPriceInfo; + this.buyingItemStackTwo = buyingItemStackTwo; + this.buyingItemTwoInfo = buyingItemTwoInfo; + this.sellingItemstack = sellingItemstack; + this.sellingPriceInfo = sellingPriceInfo; + } + + @Override + public void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random random) { + int buyAmount = 1; + if (this.buyingPriceInfo != null) { + buyAmount = this.buyingPriceInfo.getPrice(random); + } + + int buyTwoAmount = 1; + if (this.buyingItemTwoInfo != null) { + buyTwoAmount = this.buyingItemTwoInfo.getPrice(random); + } + + int sellAmount = 1; + if (this.sellingPriceInfo != null) { + sellAmount = this.sellingPriceInfo.getPrice(random); + } + + ItemStack buyItemStack = this.buyingItemStack.copy(); + buyItemStack.stackSize = buyAmount; + ItemStack buyItemStackTwo = this.buyingItemStackTwo.copy(); + buyItemStackTwo.stackSize = buyTwoAmount; + ItemStack sellItemStack = this.sellingItemstack.copy(); + sellItemStack.stackSize = sellAmount; + recipeList.add(new MerchantRecipe(buyItemStack, buyItemStackTwo, sellItemStack)); + } + } } diff --git a/src/main/java/forestry/plugins/ForestryPluginUids.java b/src/main/java/forestry/plugins/ForestryPluginUids.java index a1734534a..ffcfa7476 100644 --- a/src/main/java/forestry/plugins/ForestryPluginUids.java +++ b/src/main/java/forestry/plugins/ForestryPluginUids.java @@ -21,4 +21,5 @@ public class ForestryPluginUids { public static final String BUILDCRAFT_TRANSPORT = "forestry.buildcraft.transport"; public static final String CHISEL = "forestry.chisel"; public static final String NATURA = "forestry.natura"; + public static final String INDUSTRIALCRAFT2 = "forestry.industrialcraft2"; } diff --git a/src/main/java/forestry/plugins/compat/PluginIC2.java b/src/main/java/forestry/plugins/compat/PluginIC2.java index aaa2424a7..7d083f49c 100644 --- a/src/main/java/forestry/plugins/compat/PluginIC2.java +++ b/src/main/java/forestry/plugins/compat/PluginIC2.java @@ -67,7 +67,7 @@ import ic2.api.item.IC2Items; import ic2.api.recipe.RecipeInputItemStack; import ic2.api.recipe.Recipes; -@ForestryPlugin(pluginID = "IC2", name = "IndustrialCraft2", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.ic2.description") +@ForestryPlugin(pluginID = ForestryPluginUids.INDUSTRIALCRAFT2, name = "IndustrialCraft2", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.ic2.description") public class PluginIC2 extends BlankForestryPlugin { public static final String modId = "IC2"; public static PluginIC2 instance;