diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2018-07-06 20:48:49 +1000 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2018-07-06 20:48:49 +1000 |
commit | ce9df5c8438a530d53173eb9747416708f434330 (patch) | |
tree | 79d8cf04d939f708412c70a4e1d622c61dc9f752 | |
parent | 21d918ebc34c24e4044423f393ecb3f1be4fd249 (diff) | |
download | GT5-Unofficial-ce9df5c8438a530d53173eb9747416708f434330.tar.gz GT5-Unofficial-ce9df5c8438a530d53173eb9747416708f434330.tar.bz2 GT5-Unofficial-ce9df5c8438a530d53173eb9747416708f434330.zip |
$ Small Villager Fixes.
-rw-r--r-- | src/Java/gtPlusPlus/plugin/villagers/entity/EntityBaseVillager.java | 49 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/plugin/villagers/trade/TradeHandlerAboriginal.java | 9 |
2 files changed, 29 insertions, 29 deletions
diff --git a/src/Java/gtPlusPlus/plugin/villagers/entity/EntityBaseVillager.java b/src/Java/gtPlusPlus/plugin/villagers/entity/EntityBaseVillager.java index 8fcb0b96dd..d56dc33ab1 100644 --- a/src/Java/gtPlusPlus/plugin/villagers/entity/EntityBaseVillager.java +++ b/src/Java/gtPlusPlus/plugin/villagers/entity/EntityBaseVillager.java @@ -417,38 +417,43 @@ public class EntityBaseVillager extends EntityVillager { } for (int l = 0; l < p_70950_1_ && l < merchantrecipelist.size(); ++l) { - this.getBuyingList().addToListWithCheck((MerchantRecipe) merchantrecipelist.get(l)); + try { + this.getBuyingList().addToListWithCheck((MerchantRecipe) merchantrecipelist.get(l)); + } + catch (Throwable t) { + Logger.INFO("Villager with ID "+this.entityUniqueID.toString()+" at | X: "+this.posX+" Y: "+this.posY+" Z: "+this.posZ+" may have corrupt trades, it is advised to remove/kill it."); + } } try { - if (this.getBuyingList() != null) { - for (Object g : this.getBuyingList()) { - if (g != null) { - if (g instanceof MerchantRecipe) { - MerchantRecipe m = (MerchantRecipe) g; - ItemStack selling = m.getItemToSell(); - ItemStack[] buying = new ItemStack[] {m.getItemToBuy(), m.getSecondItemToBuy() != null ? m.getSecondItemToBuy() : null}; - if (selling == null) { - Logger.INFO("Villager is Selling an invalid item"); - } - else if (buying[0] == null && buying[1] == null) { - Logger.INFO("Villager is buying two invalid items"); - } - else { - Logger.INFO("Villager is Selling x"+selling.stackSize+selling.getDisplayName()+" for x"+buying[0].stackSize+" "+buying[0].getDisplayName()+buying[1] != null ? " and for x"+buying[1].stackSize+" "+buying[1].getDisplayName() : ""); + if (this.getBuyingList() != null) { + for (Object g : this.getBuyingList()) { + if (g != null) { + if (g instanceof MerchantRecipe) { + MerchantRecipe m = (MerchantRecipe) g; + ItemStack selling = m.getItemToSell(); + ItemStack[] buying = new ItemStack[] {m.getItemToBuy(), m.getSecondItemToBuy() != null ? m.getSecondItemToBuy() : null}; + if (selling == null) { + Logger.INFO("Villager is Selling an invalid item"); + } + else if (buying[0] == null && buying[1] == null) { + Logger.INFO("Villager is buying two invalid items"); + } + else { + Logger.INFO("Villager is Selling x"+selling.stackSize+selling.getDisplayName()+" for x"+buying[0].stackSize+" "+buying[0].getDisplayName()+buying[1] != null ? " and for x"+buying[1].stackSize+" "+buying[1].getDisplayName() : ""); + } } + else + Logger.INFO("Found: "+g.getClass().getName()); } - else - Logger.INFO("Found: "+g.getClass().getName()); } } - } - else { + else { - } + } } catch (Throwable t) { - + } } diff --git a/src/Java/gtPlusPlus/plugin/villagers/trade/TradeHandlerAboriginal.java b/src/Java/gtPlusPlus/plugin/villagers/trade/TradeHandlerAboriginal.java index b4b24bd779..e7030e39c5 100644 --- a/src/Java/gtPlusPlus/plugin/villagers/trade/TradeHandlerAboriginal.java +++ b/src/Java/gtPlusPlus/plugin/villagers/trade/TradeHandlerAboriginal.java @@ -90,18 +90,13 @@ public class TradeHandlerAboriginal extends TradeHandlerBase { 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); - shuffle(recipeList); - shuffle(recipeList); - shuffle(recipeList); } } - final static int MID_BOUND = 9; + 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(5, MID_BOUND), MathUtils.randInt(MID_BOUND, 48)))) : 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(12, MID_BOUND), MathUtils.randInt(MID_BOUND, 48)))) : output.stackSize); return ItemUtils.getSimpleStack(output, outputSize); } |