diff options
Diffstat (limited to 'src/main/java/gtPlusPlus/plugin/villagers/trade')
5 files changed, 204 insertions, 207 deletions
diff --git a/src/main/java/gtPlusPlus/plugin/villagers/trade/TradeHandlerAboriginal.java b/src/main/java/gtPlusPlus/plugin/villagers/trade/TradeHandlerAboriginal.java index 3baca10792..3d087ea053 100644 --- a/src/main/java/gtPlusPlus/plugin/villagers/trade/TradeHandlerAboriginal.java +++ b/src/main/java/gtPlusPlus/plugin/villagers/trade/TradeHandlerAboriginal.java @@ -2,14 +2,11 @@ package gtPlusPlus.plugin.villagers.trade; import static java.util.Collections.shuffle; -import java.util.Collections; -import java.util.Random; - import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; +import java.util.Random; import net.minecraft.entity.passive.EntityVillager; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -19,143 +16,148 @@ import net.minecraft.village.MerchantRecipeList; public class TradeHandlerAboriginal extends TradeHandlerBase { - private final static AutoMap<ItemStack> mInputs = new AutoMap<ItemStack>(); - private final static AutoMap<ItemStack> mOutputs = new AutoMap<ItemStack>(); - private static boolean initialised = false; + private static final AutoMap<ItemStack> mInputs = new AutoMap<ItemStack>(); + private static final AutoMap<ItemStack> mOutputs = new AutoMap<ItemStack>(); + private static boolean initialised = false; - public static void init() { - mOutputs.put(ItemUtils.getSimpleStack(Blocks.anvil, 1)); - mOutputs.put(ItemUtils.getSimpleStack(Blocks.bookshelf, 0)); - mOutputs.put(ItemUtils.getSimpleStack(Blocks.cactus, 0)); - mOutputs.put(ItemUtils.getSimpleStack(Blocks.dirt, 0)); - mOutputs.put(ItemUtils.getSimpleStack(Blocks.cobblestone, 0)); - mOutputs.put(ItemUtils.getSimpleStack(Blocks.mossy_cobblestone, 0)); - mOutputs.put(ItemUtils.getSimpleStack(Blocks.pumpkin, 0)); - mOutputs.put(ItemUtils.getSimpleStack(Blocks.hardened_clay, 0)); - mOutputs.put(ItemUtils.getSimpleStack(Blocks.log, 0)); - mOutputs.put(ItemUtils.getSimpleStack(Blocks.obsidian, 8)); - mOutputs.put(ItemUtils.getSimpleStack(Items.wheat, 0)); - mOutputs.put(ItemUtils.getSimpleStack(Blocks.gravel, 0)); - mOutputs.put(ItemUtils.getSimpleStack(Blocks.sand, 0)); - mOutputs.put(ItemUtils.getSimpleStack(Items.apple, 0)); - mOutputs.put(ItemUtils.getSimpleStack(Items.emerald, 1)); - mOutputs.put(ItemUtils.getSimpleStack(Items.diamond, 1)); - mOutputs.put(ItemUtils.getSimpleStack(Items.baked_potato, 0)); - mOutputs.put(ItemUtils.getSimpleStack(Items.beef, 0)); - mOutputs.put(ItemUtils.getSimpleStack(Items.bone, 0)); - mOutputs.put(ItemUtils.getSimpleStack(Items.bread, 0)); - mOutputs.put(ItemUtils.getSimpleStack(Items.carrot, 0)); - mOutputs.put(ItemUtils.getSimpleStack(Items.potato, 0)); - mOutputs.put(ItemUtils.getSimpleStack(Items.poisonous_potato, 0)); - mOutputs.put(ItemUtils.getSimpleStack(Items.chicken, 0)); - mOutputs.put(ItemUtils.getSimpleStack(Items.porkchop, 0)); - mOutputs.put(ItemUtils.getSimpleStack(Items.cooked_beef, 0)); - mOutputs.put(ItemUtils.getSimpleStack(Items.cooked_chicken, 0)); - mOutputs.put(ItemUtils.getSimpleStack(Items.cooked_porkchop, 0)); - mOutputs.put(ItemUtils.getSimpleStack(Items.fish, 0)); - mOutputs.put(ItemUtils.getSimpleStack(Items.cooked_fished, 0)); - mOutputs.put(ItemUtils.getSimpleStack(Items.feather, 0)); - mOutputs.put(ItemUtils.getSimpleStack(Items.egg, 0)); - mOutputs.put(ItemUtils.getSimpleStack(Items.gold_nugget, 0)); - mOutputs.put(ItemUtils.getSimpleStack(Items.leather, 0)); - mOutputs.put(ItemUtils.getSimpleStack(Items.melon_seeds, 0)); - mOutputs.put(ItemUtils.getSimpleStack(Items.reeds, 0)); - mInputs.put(ItemUtils.getSimpleStack(Items.wooden_door)); - mInputs.put(ItemUtils.getSimpleStack(Blocks.log)); - mInputs.put(ItemUtils.getSimpleStack(Blocks.log2)); - mInputs.put(ItemUtils.getSimpleStack(Blocks.planks)); - mInputs.put(ItemUtils.getSimpleStack(Blocks.sapling)); - mInputs.put(ItemUtils.getSimpleStack(Blocks.sandstone)); - mInputs.put(ItemUtils.getSimpleStack(Blocks.nether_brick)); - mInputs.put(ItemUtils.getSimpleStack(Blocks.bookshelf)); - mInputs.put(ItemUtils.getSimpleStack(Blocks.crafting_table)); - mInputs.put(ItemUtils.getSimpleStack(Blocks.gravel)); - mInputs.put(ItemUtils.getSimpleStack(Blocks.hardened_clay)); - mInputs.put(ItemUtils.getSimpleStack(Blocks.cactus)); - mInputs.put(ItemUtils.getSimpleStack(Blocks.quartz_block)); - mInputs.put(ItemUtils.getSimpleStack(Blocks.stone)); - mInputs.put(ItemUtils.getSimpleStack(Blocks.mossy_cobblestone)); - mInputs.put(ItemUtils.getSimpleStack(Items.apple, 0)); - mInputs.put(ItemUtils.getSimpleStack(Items.emerald, 1)); - mInputs.put(ItemUtils.getSimpleStack(Items.diamond, 1)); - mInputs.put(ItemUtils.getSimpleStack(Items.baked_potato, 0)); - mInputs.put(ItemUtils.getSimpleStack(Items.beef, 0)); - mInputs.put(ItemUtils.getSimpleStack(Items.bone, 0)); - mInputs.put(ItemUtils.getSimpleStack(Items.bread, 0)); - mInputs.put(ItemUtils.getSimpleStack(Items.carrot, 0)); - mInputs.put(ItemUtils.getSimpleStack(Items.potato, 0)); - mInputs.put(ItemUtils.getSimpleStack(Items.poisonous_potato, 0)); - mInputs.put(ItemUtils.getSimpleStack(Items.chicken, 0)); - mInputs.put(ItemUtils.getSimpleStack(Items.porkchop, 0)); - mInputs.put(ItemUtils.getSimpleStack(Items.cooked_beef, 0)); - mInputs.put(ItemUtils.getSimpleStack(Items.cooked_chicken, 0)); - mInputs.put(ItemUtils.getSimpleStack(Items.cooked_porkchop, 0)); - mInputs.put(ItemUtils.getSimpleStack(Items.fish, 0)); - mInputs.put(ItemUtils.getSimpleStack(Items.cooked_fished, 0)); - mInputs.put(ItemUtils.getSimpleStack(Items.feather, 0)); - mInputs.put(ItemUtils.getSimpleStack(Items.egg, 0)); - mInputs.put(ItemUtils.getSimpleStack(Items.gold_nugget, 0)); - mInputs.put(ItemUtils.getSimpleStack(Items.leather, 0)); - mInputs.put(ItemUtils.getSimpleStack(Items.melon_seeds, 0)); - mInputs.put(ItemUtils.getSimpleStack(Items.reeds, 0)); - initialised = true; - } + public static void init() { + mOutputs.put(ItemUtils.getSimpleStack(Blocks.anvil, 1)); + mOutputs.put(ItemUtils.getSimpleStack(Blocks.bookshelf, 0)); + mOutputs.put(ItemUtils.getSimpleStack(Blocks.cactus, 0)); + mOutputs.put(ItemUtils.getSimpleStack(Blocks.dirt, 0)); + mOutputs.put(ItemUtils.getSimpleStack(Blocks.cobblestone, 0)); + mOutputs.put(ItemUtils.getSimpleStack(Blocks.mossy_cobblestone, 0)); + mOutputs.put(ItemUtils.getSimpleStack(Blocks.pumpkin, 0)); + mOutputs.put(ItemUtils.getSimpleStack(Blocks.hardened_clay, 0)); + mOutputs.put(ItemUtils.getSimpleStack(Blocks.log, 0)); + mOutputs.put(ItemUtils.getSimpleStack(Blocks.obsidian, 8)); + mOutputs.put(ItemUtils.getSimpleStack(Items.wheat, 0)); + mOutputs.put(ItemUtils.getSimpleStack(Blocks.gravel, 0)); + mOutputs.put(ItemUtils.getSimpleStack(Blocks.sand, 0)); + mOutputs.put(ItemUtils.getSimpleStack(Items.apple, 0)); + mOutputs.put(ItemUtils.getSimpleStack(Items.emerald, 1)); + mOutputs.put(ItemUtils.getSimpleStack(Items.diamond, 1)); + mOutputs.put(ItemUtils.getSimpleStack(Items.baked_potato, 0)); + mOutputs.put(ItemUtils.getSimpleStack(Items.beef, 0)); + mOutputs.put(ItemUtils.getSimpleStack(Items.bone, 0)); + mOutputs.put(ItemUtils.getSimpleStack(Items.bread, 0)); + mOutputs.put(ItemUtils.getSimpleStack(Items.carrot, 0)); + mOutputs.put(ItemUtils.getSimpleStack(Items.potato, 0)); + mOutputs.put(ItemUtils.getSimpleStack(Items.poisonous_potato, 0)); + mOutputs.put(ItemUtils.getSimpleStack(Items.chicken, 0)); + mOutputs.put(ItemUtils.getSimpleStack(Items.porkchop, 0)); + mOutputs.put(ItemUtils.getSimpleStack(Items.cooked_beef, 0)); + mOutputs.put(ItemUtils.getSimpleStack(Items.cooked_chicken, 0)); + mOutputs.put(ItemUtils.getSimpleStack(Items.cooked_porkchop, 0)); + mOutputs.put(ItemUtils.getSimpleStack(Items.fish, 0)); + mOutputs.put(ItemUtils.getSimpleStack(Items.cooked_fished, 0)); + mOutputs.put(ItemUtils.getSimpleStack(Items.feather, 0)); + mOutputs.put(ItemUtils.getSimpleStack(Items.egg, 0)); + mOutputs.put(ItemUtils.getSimpleStack(Items.gold_nugget, 0)); + mOutputs.put(ItemUtils.getSimpleStack(Items.leather, 0)); + mOutputs.put(ItemUtils.getSimpleStack(Items.melon_seeds, 0)); + mOutputs.put(ItemUtils.getSimpleStack(Items.reeds, 0)); + mInputs.put(ItemUtils.getSimpleStack(Items.wooden_door)); + mInputs.put(ItemUtils.getSimpleStack(Blocks.log)); + mInputs.put(ItemUtils.getSimpleStack(Blocks.log2)); + mInputs.put(ItemUtils.getSimpleStack(Blocks.planks)); + mInputs.put(ItemUtils.getSimpleStack(Blocks.sapling)); + mInputs.put(ItemUtils.getSimpleStack(Blocks.sandstone)); + mInputs.put(ItemUtils.getSimpleStack(Blocks.nether_brick)); + mInputs.put(ItemUtils.getSimpleStack(Blocks.bookshelf)); + mInputs.put(ItemUtils.getSimpleStack(Blocks.crafting_table)); + mInputs.put(ItemUtils.getSimpleStack(Blocks.gravel)); + mInputs.put(ItemUtils.getSimpleStack(Blocks.hardened_clay)); + mInputs.put(ItemUtils.getSimpleStack(Blocks.cactus)); + mInputs.put(ItemUtils.getSimpleStack(Blocks.quartz_block)); + mInputs.put(ItemUtils.getSimpleStack(Blocks.stone)); + mInputs.put(ItemUtils.getSimpleStack(Blocks.mossy_cobblestone)); + mInputs.put(ItemUtils.getSimpleStack(Items.apple, 0)); + mInputs.put(ItemUtils.getSimpleStack(Items.emerald, 1)); + mInputs.put(ItemUtils.getSimpleStack(Items.diamond, 1)); + mInputs.put(ItemUtils.getSimpleStack(Items.baked_potato, 0)); + mInputs.put(ItemUtils.getSimpleStack(Items.beef, 0)); + mInputs.put(ItemUtils.getSimpleStack(Items.bone, 0)); + mInputs.put(ItemUtils.getSimpleStack(Items.bread, 0)); + mInputs.put(ItemUtils.getSimpleStack(Items.carrot, 0)); + mInputs.put(ItemUtils.getSimpleStack(Items.potato, 0)); + mInputs.put(ItemUtils.getSimpleStack(Items.poisonous_potato, 0)); + mInputs.put(ItemUtils.getSimpleStack(Items.chicken, 0)); + mInputs.put(ItemUtils.getSimpleStack(Items.porkchop, 0)); + mInputs.put(ItemUtils.getSimpleStack(Items.cooked_beef, 0)); + mInputs.put(ItemUtils.getSimpleStack(Items.cooked_chicken, 0)); + mInputs.put(ItemUtils.getSimpleStack(Items.cooked_porkchop, 0)); + mInputs.put(ItemUtils.getSimpleStack(Items.fish, 0)); + mInputs.put(ItemUtils.getSimpleStack(Items.cooked_fished, 0)); + mInputs.put(ItemUtils.getSimpleStack(Items.feather, 0)); + mInputs.put(ItemUtils.getSimpleStack(Items.egg, 0)); + mInputs.put(ItemUtils.getSimpleStack(Items.gold_nugget, 0)); + mInputs.put(ItemUtils.getSimpleStack(Items.leather, 0)); + mInputs.put(ItemUtils.getSimpleStack(Items.melon_seeds, 0)); + mInputs.put(ItemUtils.getSimpleStack(Items.reeds, 0)); + initialised = true; + } + public TradeHandlerAboriginal() { + Logger.INFO("Created Trade Manager for 'Trader' villager profession type."); + } - public TradeHandlerAboriginal() { - Logger.INFO("Created Trade Manager for 'Trader' villager profession type."); - } + @SuppressWarnings("unchecked") + @Override + public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random random) { + if (!initialised) { + init(); + } + if (initialised) { + recipeList.add(new MerchantRecipe(getInput(), getOutput())); + recipeList.add(new MerchantRecipe(getInput(), getOutput())); + recipeList.add(new MerchantRecipe(getInput(), getOutput())); + recipeList.add(new MerchantRecipe(getInput(), getOutput())); + recipeList.add(new MerchantRecipe(getInput(), getOutput())); + recipeList.add(new MerchantRecipe(getInput(), getOutput())); + recipeList.add(new MerchantRecipe(getInput(), getOutput())); + recipeList.add(new MerchantRecipe(getInput(), getOutput())); + recipeList.add(new MerchantRecipe(getInput(), getOutput())); + recipeList.add(new MerchantRecipe(getInput(), getOutput())); + recipeList.add(new MerchantRecipe(getInput(), getOutput())); + recipeList.add(new MerchantRecipe(getInput(), getOutput())); + recipeList.add(new MerchantRecipe(getInput(), getOutput())); + recipeList.add(new MerchantRecipe(getInput(), getOutput())); + recipeList.add(new MerchantRecipe(getInput(), getOutput())); + recipeList.add(new MerchantRecipe(getInput(), getInput(), getOutput())); + recipeList.add(new MerchantRecipe(getInput(), getInput(), getOutput())); + recipeList.add(new MerchantRecipe(getInput(), getInput(), getOutput())); + recipeList.add(new MerchantRecipe(getInput(), getInput(), getOutput())); + recipeList.add(new MerchantRecipe(getInput(), getInput(), getOutput())); + recipeList.add(new MerchantRecipe(getInput(), getInput(), getOutput())); + recipeList.add(new MerchantRecipe(getInput(), getInput(), getOutput())); + recipeList.add(new MerchantRecipe(getInput(), getInput(), getOutput())); + recipeList.add(new MerchantRecipe(getInput(), getInput(), getOutput())); + recipeList.add(new MerchantRecipe(getInput(), getInput(), getOutput())); + recipeList.add(new MerchantRecipe(getInput(), getInput(), getOutput())); + recipeList.add(new MerchantRecipe(getInput(), getInput(), getOutput())); + recipeList.add(new MerchantRecipe(getInput(), getInput(), getOutput())); + shuffle(recipeList); + } + } - @SuppressWarnings("unchecked") - @Override - public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random random) { - if (!initialised) { - init(); - } - if (initialised) { - recipeList.add(new MerchantRecipe(getInput(), getOutput())); - recipeList.add(new MerchantRecipe(getInput(), getOutput())); - recipeList.add(new MerchantRecipe(getInput(), getOutput())); - recipeList.add(new MerchantRecipe(getInput(), getOutput())); - recipeList.add(new MerchantRecipe(getInput(), getOutput())); - recipeList.add(new MerchantRecipe(getInput(), getOutput())); - recipeList.add(new MerchantRecipe(getInput(), getOutput())); - recipeList.add(new MerchantRecipe(getInput(), getOutput())); - recipeList.add(new MerchantRecipe(getInput(), getOutput())); - recipeList.add(new MerchantRecipe(getInput(), getOutput())); - recipeList.add(new MerchantRecipe(getInput(), getOutput())); - recipeList.add(new MerchantRecipe(getInput(), getOutput())); - recipeList.add(new MerchantRecipe(getInput(), getOutput())); - recipeList.add(new MerchantRecipe(getInput(), getOutput())); - recipeList.add(new MerchantRecipe(getInput(), getOutput())); - recipeList.add(new MerchantRecipe(getInput(), getInput(), getOutput())); - recipeList.add(new MerchantRecipe(getInput(), getInput(), getOutput())); - recipeList.add(new MerchantRecipe(getInput(), getInput(), getOutput())); - recipeList.add(new MerchantRecipe(getInput(), getInput(), getOutput())); - recipeList.add(new MerchantRecipe(getInput(), getInput(), getOutput())); - recipeList.add(new MerchantRecipe(getInput(), getInput(), getOutput())); - recipeList.add(new MerchantRecipe(getInput(), getInput(), getOutput())); - recipeList.add(new MerchantRecipe(getInput(), getInput(), getOutput())); - recipeList.add(new MerchantRecipe(getInput(), getInput(), getOutput())); - recipeList.add(new MerchantRecipe(getInput(), getInput(), getOutput())); - recipeList.add(new MerchantRecipe(getInput(), getInput(), getOutput())); - recipeList.add(new MerchantRecipe(getInput(), getInput(), getOutput())); - recipeList.add(new MerchantRecipe(getInput(), getInput(), getOutput())); - shuffle(recipeList); - } - } + private ItemStack getInput() { + ItemStack input = mInputs.get(MathUtils.randInt(0, mInputs.size() - 1)); + int outputSize = (input.stackSize == 0 + ? (Math.max(MathUtils.randInt(1, 64), MathUtils.randInt(1, 32))) + : input.stackSize); + return ItemUtils.getSimpleStack(input, outputSize); + } - private ItemStack getInput() { - ItemStack input = mInputs.get(MathUtils.randInt(0, mInputs.size()-1)); - int outputSize = (input.stackSize == 0 ? (Math.max(MathUtils.randInt(1, 64), MathUtils.randInt(1, 32))) : input.stackSize); - return ItemUtils.getSimpleStack(input, outputSize); - } - - final static int MID_BOUND = 24; - private ItemStack getOutput() { - ItemStack output = mOutputs.get(MathUtils.randInt(0, mOutputs.size()-1)); - int outputSize = (output.stackSize == 0 ? (Math.min(MathUtils.randInt(MathUtils.randInt(1, MID_BOUND), MathUtils.randInt(MID_BOUND, 32)), MathUtils.randInt(MathUtils.randInt(12, MID_BOUND), MathUtils.randInt(MID_BOUND, 48)))) : output.stackSize); - return ItemUtils.getSimpleStack(output, outputSize); - } + static final int MID_BOUND = 24; + private ItemStack getOutput() { + ItemStack output = mOutputs.get(MathUtils.randInt(0, mOutputs.size() - 1)); + int outputSize = (output.stackSize == 0 + ? (Math.min( + MathUtils.randInt(MathUtils.randInt(1, MID_BOUND), MathUtils.randInt(MID_BOUND, 32)), + MathUtils.randInt(MathUtils.randInt(12, MID_BOUND), MathUtils.randInt(MID_BOUND, 48)))) + : output.stackSize); + return ItemUtils.getSimpleStack(output, outputSize); + } } diff --git a/src/main/java/gtPlusPlus/plugin/villagers/trade/TradeHandlerBanker.java b/src/main/java/gtPlusPlus/plugin/villagers/trade/TradeHandlerBanker.java index 215dc0683b..c42da6895f 100644 --- a/src/main/java/gtPlusPlus/plugin/villagers/trade/TradeHandlerBanker.java +++ b/src/main/java/gtPlusPlus/plugin/villagers/trade/TradeHandlerBanker.java @@ -1,27 +1,23 @@ package gtPlusPlus.plugin.villagers.trade; -import java.util.Collections; -import java.util.Random; - import gtPlusPlus.core.recipe.common.CI; +import java.util.Random; import net.minecraft.entity.passive.EntityVillager; import net.minecraft.village.MerchantRecipe; import net.minecraft.village.MerchantRecipeList; public class TradeHandlerBanker extends TradeHandlerBase { - - @SuppressWarnings("unchecked") - @Override - public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random random) { - //if (villager.getProfession() == 7735) { - recipeList.add(new MerchantRecipe(CI.electricMotor_LV, CI.electricPiston_LV, CI.robotArm_LV)); - recipeList.add(new MerchantRecipe(CI.electricMotor_MV, CI.electricPiston_MV, CI.robotArm_MV)); - recipeList.add(new MerchantRecipe(CI.electricMotor_HV, CI.electricPiston_HV, CI.robotArm_HV)); - recipeList.add(new MerchantRecipe(CI.electricMotor_EV, CI.electricPiston_EV, CI.robotArm_EV)); - recipeList.add(new MerchantRecipe(CI.electricMotor_IV, CI.electricPiston_IV, CI.robotArm_IV)); - //Collections.shuffle(recipeList); - //} - } - + @SuppressWarnings("unchecked") + @Override + public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random random) { + // if (villager.getProfession() == 7735) { + recipeList.add(new MerchantRecipe(CI.electricMotor_LV, CI.electricPiston_LV, CI.robotArm_LV)); + recipeList.add(new MerchantRecipe(CI.electricMotor_MV, CI.electricPiston_MV, CI.robotArm_MV)); + recipeList.add(new MerchantRecipe(CI.electricMotor_HV, CI.electricPiston_HV, CI.robotArm_HV)); + recipeList.add(new MerchantRecipe(CI.electricMotor_EV, CI.electricPiston_EV, CI.robotArm_EV)); + recipeList.add(new MerchantRecipe(CI.electricMotor_IV, CI.electricPiston_IV, CI.robotArm_IV)); + // Collections.shuffle(recipeList); + // } + } } diff --git a/src/main/java/gtPlusPlus/plugin/villagers/trade/TradeHandlerBase.java b/src/main/java/gtPlusPlus/plugin/villagers/trade/TradeHandlerBase.java index b726ebefff..1e1e326201 100644 --- a/src/main/java/gtPlusPlus/plugin/villagers/trade/TradeHandlerBase.java +++ b/src/main/java/gtPlusPlus/plugin/villagers/trade/TradeHandlerBase.java @@ -10,16 +10,15 @@ ******************************************************************************/ package gtPlusPlus.plugin.villagers.trade; +import cpw.mods.fml.common.registry.VillagerRegistry.IVillageTradeHandler; import java.util.Random; - import net.minecraft.entity.passive.EntityVillager; import net.minecraft.village.MerchantRecipeList; -import cpw.mods.fml.common.registry.VillagerRegistry.IVillageTradeHandler; public abstract class TradeHandlerBase implements IVillageTradeHandler { - @SuppressWarnings("unchecked") - @Override - public abstract void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random random); - + @SuppressWarnings("unchecked") + @Override + public abstract void manipulateTradesForVillager( + EntityVillager villager, MerchantRecipeList recipeList, Random random); } diff --git a/src/main/java/gtPlusPlus/plugin/villagers/trade/TradeHandlerTechnician.java b/src/main/java/gtPlusPlus/plugin/villagers/trade/TradeHandlerTechnician.java index 922316b136..bd2acc9bfe 100644 --- a/src/main/java/gtPlusPlus/plugin/villagers/trade/TradeHandlerTechnician.java +++ b/src/main/java/gtPlusPlus/plugin/villagers/trade/TradeHandlerTechnician.java @@ -1,27 +1,23 @@ package gtPlusPlus.plugin.villagers.trade; -import java.util.Collections; -import java.util.Random; - import gtPlusPlus.core.recipe.common.CI; +import java.util.Random; import net.minecraft.entity.passive.EntityVillager; import net.minecraft.village.MerchantRecipe; import net.minecraft.village.MerchantRecipeList; public class TradeHandlerTechnician extends TradeHandlerBase { - - @SuppressWarnings("unchecked") - @Override - public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random random) { - //if (villager.getProfession() == 7737) { - recipeList.add(new MerchantRecipe(CI.machineHull_LV, CI.electricMotor_LV, CI.machineHull_LV)); - recipeList.add(new MerchantRecipe(CI.machineHull_MV, CI.electricMotor_MV, CI.machineHull_MV)); - recipeList.add(new MerchantRecipe(CI.machineHull_HV, CI.electricMotor_HV, CI.machineHull_HV)); - recipeList.add(new MerchantRecipe(CI.machineHull_EV, CI.electricMotor_EV, CI.machineHull_EV)); - recipeList.add(new MerchantRecipe(CI.machineHull_IV, CI.electricMotor_IV, CI.machineHull_IV)); - //Collections.shuffle(recipeList); - //} - } - + @SuppressWarnings("unchecked") + @Override + public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random random) { + // if (villager.getProfession() == 7737) { + recipeList.add(new MerchantRecipe(CI.machineHull_LV, CI.electricMotor_LV, CI.machineHull_LV)); + recipeList.add(new MerchantRecipe(CI.machineHull_MV, CI.electricMotor_MV, CI.machineHull_MV)); + recipeList.add(new MerchantRecipe(CI.machineHull_HV, CI.electricMotor_HV, CI.machineHull_HV)); + recipeList.add(new MerchantRecipe(CI.machineHull_EV, CI.electricMotor_EV, CI.machineHull_EV)); + recipeList.add(new MerchantRecipe(CI.machineHull_IV, CI.electricMotor_IV, CI.machineHull_IV)); + // Collections.shuffle(recipeList); + // } + } } diff --git a/src/main/java/gtPlusPlus/plugin/villagers/trade/TradeHandlerTrader.java b/src/main/java/gtPlusPlus/plugin/villagers/trade/TradeHandlerTrader.java index 0025c054bd..f866bd7aa6 100644 --- a/src/main/java/gtPlusPlus/plugin/villagers/trade/TradeHandlerTrader.java +++ b/src/main/java/gtPlusPlus/plugin/villagers/trade/TradeHandlerTrader.java @@ -1,11 +1,10 @@ package gtPlusPlus.plugin.villagers.trade; -import java.util.Collections; -import java.util.Random; - import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.core.util.minecraft.ItemUtils; +import java.util.Collections; +import java.util.Random; import net.minecraft.entity.passive.EntityVillager; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; @@ -14,32 +13,37 @@ import net.minecraft.village.MerchantRecipeList; public class TradeHandlerTrader extends TradeHandlerBase { - public TradeHandlerTrader() { - Logger.INFO("Created Trade Manager for 'Trader' villager profession type."); - } - - @SuppressWarnings("unchecked") - @Override - public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random random) { - ItemStack Ore1 = null, Ore2 = null; - if (Ore1 == null) { - Ore1 = ELEMENT.getInstance().SILICON.getOre(1); - } - if (Ore2 == null) { - Ore2 = ELEMENT.getInstance().ALUMINIUM.getOre(1); - } - if (Ore1 == null) { - Ore1 = ELEMENT.getInstance().GOLD.getOre(1); - } - if (Ore2 == null) { - Ore2 = ELEMENT.getInstance().LEAD.getOre(1); - } - recipeList.add(new MerchantRecipe(ItemUtils.getItemStackOfAmountFromOreDict("logWood", 32), ELEMENT.getInstance().IRON.getOre(1))); - recipeList.add(new MerchantRecipe(ItemUtils.getItemStackOfAmountFromOreDict("dustMeatRaw", 32), ELEMENT.getInstance().COPPER.getOre(1))); - recipeList.add(new MerchantRecipe(ItemUtils.getSimpleStack(Blocks.obsidian, 6), ELEMENT.getInstance().TIN.getOre(1))); - recipeList.add(new MerchantRecipe(ItemUtils.getSimpleStack(Blocks.glowstone, 32), Ore1)); - recipeList.add(new MerchantRecipe(ItemUtils.getSimpleStack(Blocks.piston, 32), Ore2)); - Collections.shuffle(recipeList); - } + public TradeHandlerTrader() { + Logger.INFO("Created Trade Manager for 'Trader' villager profession type."); + } + @SuppressWarnings("unchecked") + @Override + public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random random) { + ItemStack Ore1 = null, Ore2 = null; + if (Ore1 == null) { + Ore1 = ELEMENT.getInstance().SILICON.getOre(1); + } + if (Ore2 == null) { + Ore2 = ELEMENT.getInstance().ALUMINIUM.getOre(1); + } + if (Ore1 == null) { + Ore1 = ELEMENT.getInstance().GOLD.getOre(1); + } + if (Ore2 == null) { + Ore2 = ELEMENT.getInstance().LEAD.getOre(1); + } + recipeList.add(new MerchantRecipe( + ItemUtils.getItemStackOfAmountFromOreDict("logWood", 32), + ELEMENT.getInstance().IRON.getOre(1))); + recipeList.add(new MerchantRecipe( + ItemUtils.getItemStackOfAmountFromOreDict("dustMeatRaw", 32), + ELEMENT.getInstance().COPPER.getOre(1))); + recipeList.add(new MerchantRecipe( + ItemUtils.getSimpleStack(Blocks.obsidian, 6), + ELEMENT.getInstance().TIN.getOre(1))); + recipeList.add(new MerchantRecipe(ItemUtils.getSimpleStack(Blocks.glowstone, 32), Ore1)); + recipeList.add(new MerchantRecipe(ItemUtils.getSimpleStack(Blocks.piston, 32), Ore2)); + Collections.shuffle(recipeList); + } } |