From 21d918ebc34c24e4044423f393ecb3f1be4fd249 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Fri, 6 Jul 2018 20:38:11 +1000 Subject: $ Fixed an error in XSTR.java where the maximum bound for nextInt(x) could be 0. $ Fixed some Aboriginal Trader Logic. --- .../villagers/trade/TradeHandlerAboriginal.java | 33 +++++++++++----------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'src/Java/gtPlusPlus/plugin/villagers/trade') diff --git a/src/Java/gtPlusPlus/plugin/villagers/trade/TradeHandlerAboriginal.java b/src/Java/gtPlusPlus/plugin/villagers/trade/TradeHandlerAboriginal.java index ef67543f47..b4b24bd779 100644 --- a/src/Java/gtPlusPlus/plugin/villagers/trade/TradeHandlerAboriginal.java +++ b/src/Java/gtPlusPlus/plugin/villagers/trade/TradeHandlerAboriginal.java @@ -74,21 +74,21 @@ public class TradeHandlerAboriginal extends TradeHandlerBase { init(); } if (initialised) { - recipeList.add(new MerchantRecipe(ItemUtils.getSimpleStack(Blocks.wooden_door, Math.max(MathUtils.randInt(1, 64), MathUtils.randInt(0, 32))), getOutput())); - recipeList.add(new MerchantRecipe(ItemUtils.getSimpleStack(Blocks.log, Math.max(MathUtils.randInt(1, 64), MathUtils.randInt(0, 32))), getOutput())); - recipeList.add(new MerchantRecipe(ItemUtils.getSimpleStack(Blocks.log2, Math.max(MathUtils.randInt(1, 64), MathUtils.randInt(0, 32))), getOutput())); - recipeList.add(new MerchantRecipe(ItemUtils.getSimpleStack(Blocks.planks, Math.max(MathUtils.randInt(1, 64), MathUtils.randInt(0, 32))), getOutput())); - recipeList.add(new MerchantRecipe(ItemUtils.getSimpleStack(Blocks.sapling, Math.max(MathUtils.randInt(1, 64), MathUtils.randInt(0, 32))), getOutput())); - recipeList.add(new MerchantRecipe(ItemUtils.getSimpleStack(Blocks.sandstone, Math.max(MathUtils.randInt(1, 64), MathUtils.randInt(0, 32))), getOutput())); - recipeList.add(new MerchantRecipe(ItemUtils.getSimpleStack(Blocks.nether_brick, Math.max(MathUtils.randInt(1, 64), MathUtils.randInt(0, 32))), getOutput())); - recipeList.add(new MerchantRecipe(ItemUtils.getSimpleStack(Blocks.bookshelf, Math.max(MathUtils.randInt(1, 64), MathUtils.randInt(0, 32))), getOutput())); - recipeList.add(new MerchantRecipe(ItemUtils.getSimpleStack(Blocks.crafting_table, Math.max(MathUtils.randInt(1, 64), MathUtils.randInt(0, 32))), getOutput())); - recipeList.add(new MerchantRecipe(ItemUtils.getSimpleStack(Blocks.gravel, Math.max(MathUtils.randInt(1, 64), MathUtils.randInt(0, 32))), getOutput())); - recipeList.add(new MerchantRecipe(ItemUtils.getSimpleStack(Blocks.hardened_clay, Math.max(MathUtils.randInt(1, 64), MathUtils.randInt(0, 32))), getOutput())); - recipeList.add(new MerchantRecipe(ItemUtils.getSimpleStack(Blocks.cactus, Math.max(MathUtils.randInt(1, 64), MathUtils.randInt(0, 32))), getOutput())); - recipeList.add(new MerchantRecipe(ItemUtils.getSimpleStack(Blocks.quartz_block, Math.max(MathUtils.randInt(1, 64), MathUtils.randInt(0, 32))), getOutput())); - recipeList.add(new MerchantRecipe(ItemUtils.getSimpleStack(Blocks.stone, Math.max(MathUtils.randInt(1, 64), MathUtils.randInt(0, 32))), getOutput())); - recipeList.add(new MerchantRecipe(ItemUtils.getSimpleStack(Blocks.mossy_cobblestone, Math.max(MathUtils.randInt(1, 64), MathUtils.randInt(0, 32))), getOutput())); + recipeList.add(new MerchantRecipe(ItemUtils.getSimpleStack(Blocks.wooden_door, Math.max(MathUtils.randInt(1, 64), MathUtils.randInt(1, 32))), getOutput())); + recipeList.add(new MerchantRecipe(ItemUtils.getSimpleStack(Blocks.log, Math.max(MathUtils.randInt(1, 64), MathUtils.randInt(1, 32))), getOutput())); + recipeList.add(new MerchantRecipe(ItemUtils.getSimpleStack(Blocks.log2, Math.max(MathUtils.randInt(1, 64), MathUtils.randInt(1, 32))), getOutput())); + recipeList.add(new MerchantRecipe(ItemUtils.getSimpleStack(Blocks.planks, Math.max(MathUtils.randInt(1, 64), MathUtils.randInt(1, 32))), getOutput())); + recipeList.add(new MerchantRecipe(ItemUtils.getSimpleStack(Blocks.sapling, Math.max(MathUtils.randInt(1, 64), MathUtils.randInt(1, 32))), getOutput())); + recipeList.add(new MerchantRecipe(ItemUtils.getSimpleStack(Blocks.sandstone, Math.max(MathUtils.randInt(1, 64), MathUtils.randInt(1, 32))), getOutput())); + recipeList.add(new MerchantRecipe(ItemUtils.getSimpleStack(Blocks.nether_brick, Math.max(MathUtils.randInt(1, 64), MathUtils.randInt(1, 32))), getOutput())); + recipeList.add(new MerchantRecipe(ItemUtils.getSimpleStack(Blocks.bookshelf, Math.max(MathUtils.randInt(1, 64), MathUtils.randInt(1, 32))), getOutput())); + recipeList.add(new MerchantRecipe(ItemUtils.getSimpleStack(Blocks.crafting_table, Math.max(MathUtils.randInt(1, 64), MathUtils.randInt(1, 32))), getOutput())); + recipeList.add(new MerchantRecipe(ItemUtils.getSimpleStack(Blocks.gravel, Math.max(MathUtils.randInt(1, 64), MathUtils.randInt(1, 32))), getOutput())); + recipeList.add(new MerchantRecipe(ItemUtils.getSimpleStack(Blocks.hardened_clay, Math.max(MathUtils.randInt(1, 64), MathUtils.randInt(1, 32))), getOutput())); + recipeList.add(new MerchantRecipe(ItemUtils.getSimpleStack(Blocks.cactus, Math.max(MathUtils.randInt(1, 64), MathUtils.randInt(1, 32))), getOutput())); + recipeList.add(new MerchantRecipe(ItemUtils.getSimpleStack(Blocks.quartz_block, Math.max(MathUtils.randInt(1, 64), MathUtils.randInt(1, 32))), getOutput())); + recipeList.add(new MerchantRecipe(ItemUtils.getSimpleStack(Blocks.stone, Math.max(MathUtils.randInt(1, 64), MathUtils.randInt(1, 32))), getOutput())); + recipeList.add(new MerchantRecipe(ItemUtils.getSimpleStack(Blocks.mossy_cobblestone, Math.max(MathUtils.randInt(1, 64), MathUtils.randInt(1, 32))), getOutput())); shuffle(recipeList); shuffle(recipeList); shuffle(recipeList); @@ -98,9 +98,10 @@ public class TradeHandlerAboriginal extends TradeHandlerBase { } } + final static int MID_BOUND = 9; private ItemStack getOutput() { ItemStack output = mOutputs.get(MathUtils.randInt(0, mOutputs.size()-1)); - int outputSize = (output.stackSize == 0 ? (MathUtils.randInt(MathUtils.randInt(0, 8), MathUtils.randInt(4, 32))) : output.stackSize); + int outputSize = (output.stackSize == 0 ? (Math.min(MathUtils.randInt(MathUtils.randInt(1, MID_BOUND), MathUtils.randInt(MID_BOUND, 32)), MathUtils.randInt(MathUtils.randInt(5, MID_BOUND), MathUtils.randInt(MID_BOUND, 48)))) : output.stackSize); return ItemUtils.getSimpleStack(output, outputSize); } -- cgit