Dub Glitch(Wood Stripping)
Blindbewm opened this issue ยท 5 comments
Hi,
So I found a weird dup glitch while playing with your mod. When I would strip an Oak Log on a village house instead of bark pieces it was giving me 2-4 Netherite Axes stacked instead of the wood bark. I was using a Netherite Axe with Fortune3,Effic 4, Mending, and unbreaking. Tested it multiple times to make sure and I'd end up with stacks of 10 non-enchanted netherite axes that dropped everytime I stripped oak wood at this Village.
Currently using Fabric 0.26 and moreblocksmod-0.1.3.0
That's a strange glitch, I'll see what's going on. Thank you for letting me know
Added Pass check. Checked to see if fix worked and it does.
Issue Definition: If the useOnBlock method was used (Aka right click block). The result would take AxeItem (Aka "this") and drop 4 AxeItem(s) where block is located.
Issue located: @ AxeItemMixin : Line 58 - ItemConvertiable bark_item = this.asItem();
Issue Fix:
Old Code:
ItemConvertible bark_item = this.asItem();
if(blockState5.isOf(Blocks.ACACIA_LOG)) {
bark_item = MBMItems.ACACIA_BARK_FRAGMENT.asItem();
} else if(blockState5.isOf(Blocks.BIRCH_LOG)) {
bark_item = MBMItems.BIRCH_BARK_FRAGMENT.asItem();
} else if(blockState5.isOf(Blocks.DARK_OAK_LOG)) {
bark_item = MBMItems.DARK_OAK_BARK_FRAGMENT.asItem();
} else if(blockState5.isOf(Blocks.JUNGLE_LOG)) {
bark_item = MBMItems.JUNGLE_BARK_FRAGMENT.asItem();
} else if(blockState5.isOf(Blocks.OAK_LOG)) {
bark_item = MBMItems.OAK_BARK_FRAGMENT.asItem();
} else if(blockState5.isOf(Blocks.SPRUCE_LOG)) {
bark_item = MBMItems.SPRUCE_BARK_FRAGMENT.asItem();
}
Block.dropStack(context.getWorld(), blockPos4, new ItemStack(bark_item, 4));
if (playerEntity7 != null) {
context.getStack().<PlayerEntity>damage(1, playerEntity7, p -> p.sendToolBreakStatus(context.getHand()));
}
Fixed Code:
ItemConvertible bark_item = this.asItem();
Boolean pass = false;
if(blockState5.isOf(Blocks.ACACIA_LOG)) {
bark_item = MBMItems.ACACIA_BARK_FRAGMENT.asItem();
pass = true;
} else if(blockState5.isOf(Blocks.BIRCH_LOG)) {
bark_item = MBMItems.BIRCH_BARK_FRAGMENT.asItem();
pass = true;
} else if(blockState5.isOf(Blocks.DARK_OAK_LOG)) {
bark_item = MBMItems.DARK_OAK_BARK_FRAGMENT.asItem();
pass = true;
} else if(blockState5.isOf(Blocks.JUNGLE_LOG)) {
bark_item = MBMItems.JUNGLE_BARK_FRAGMENT.asItem();
pass = true;
} else if(blockState5.isOf(Blocks.OAK_LOG)) {
bark_item = MBMItems.OAK_BARK_FRAGMENT.asItem();
pass = true;
} else if(blockState5.isOf(Blocks.SPRUCE_LOG)) {
bark_item = MBMItems.SPRUCE_BARK_FRAGMENT.asItem();
pass = true;
}
if(pass){
Block.dropStack(context.getWorld(), blockPos4, new ItemStack(bark_item, 4));
if (playerEntity7 != null) {
context.getStack().<PlayerEntity>damage(1, playerEntity7, p -> p.sendToolBreakStatus(context.getHand()));
}
}
Issue committed to next update. As this is a major issue this will be released asap. Issue will close when fixed is uploaded to mod sites.
Thank you @Blindbewm for initially reporting this issue!