Closed andris155 closed 6 years ago
Did a bit of debug, however could not find a way to fix it.
{
@Override
public boolean onBlockBreak(BlockBreakEvent e, ItemStack item, int fortune, List<ItemStack> drops) {
if (SlimefunManager.isItemSimiliar(item, SlimefunItems.AUTO_SMELT_PICKAXE, true)) {
if (e.getBlock().getType().equals(Material.SKULL)) return true;
int j = -1;
for (int i = 0; i < e.getBlock().getDrops().size(); i++) {
if (((List<ItemStack>) e.getBlock().getDrops()).get(i) != null) {
j++;
drops.add(e.getBlock().getType().toString().endsWith("_ORE") ? new CustomItem(((List<ItemStack>) e.getBlock().getDrops()).get(i), fortune): ((List<ItemStack>) e.getBlock().getDrops()).get(i));
if (RecipeCalculator.getSmeltedOutput(drops.get(i).getType()) != null) {
e.getBlock().getWorld().playEffect(e.getBlock().getLocation(), Effect.MOBSPAWNER_FLAMES, 1);
drops.set(j, new CustomItem(RecipeCalculator.getSmeltedOutput(drops.get(i).getType()), drops.get(i).getAmount()));
}
}
}
return true;
}
else return false;
}
});
Here, the for loop is correct : it does not try to read an index higher or equal to the size of the list.
if (!item.getEnchantments().containsKey(Enchantment.SILK_TOUCH) && e.getBlock().getType().toString().endsWith("_ORE")) {
if (Talisman.checkFor(e, SlimefunItem.getByName("MINER_TALISMAN"))) {
if (drops.isEmpty()) drops = (List<ItemStack>) e.getBlock().getDrops();
for (ItemStack drop: new ArrayList<ItemStack>(drops)) {
if (!drop.getType().isBlock()) drops.add(new CustomItem(drop, fortune * 2));
}
}
}
Here we can see a drop is added.
As those two pieces of code are run this means that this happen with a Smelter's Pickaxe with a Talisman of Miner.
This exception is thrown when mining lapis or diamond, not necessarly with the talisman of miner doubling the drops
Description
Describe your Issue AS DETAILED AS POSSIBLE. Could not pass event BlockBreakEvent to Slimefun v4.1.9
Server Log
Upload your FULL SERVER LOG (/logs/latest.log) to http://pastebin.com/ and paste your link in here. Without this File, we may not be able to help you at all. Send if need
Evidence / Proof
Attach as many Screenshots or Videos if possible. Anything that helps us understand the Issue better, is gonna get your Issue fixed even faster.
Environment
We need the EXACT VERSIONS of the Software you are using. This includes your Minecraft Version, your CS-CoreLib version and your Slimefun Version. If you cannot figure out what versions you are running, then please run /sf versions and show us the output of that command.