mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-10-25 20:22:23 +00:00
Fix Dark Steel Shears duplicating drops from shearable blocks (#224)
Co-authored-by: clawdbot-silly-waddle <clawdbot-silly-waddle@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
1 file changed
+13
-9
@@ -122,12 +122,13 @@ public class ItemDarkSteelShears extends ItemShears
|
||||
BlockCoord bc = new BlockCoord(x, y, z);
|
||||
HarvestResult res = new HarvestResult(null, bc);
|
||||
|
||||
for (int dx = -Config.darkSteelShearsBlockAreaBoostWhenPowered; dx
|
||||
<= Config.darkSteelShearsBlockAreaBoostWhenPowered; dx++) {
|
||||
for (int dy = -Config.darkSteelShearsBlockAreaBoostWhenPowered; dy
|
||||
<= Config.darkSteelShearsBlockAreaBoostWhenPowered; dy++) {
|
||||
for (int dz = -Config.darkSteelShearsBlockAreaBoostWhenPowered; dz
|
||||
<= Config.darkSteelShearsBlockAreaBoostWhenPowered; dz++) {
|
||||
int range = Config.darkSteelShearsBlockAreaBoostWhenPowered;
|
||||
for (int dx = -range; dx <= range; dx++) {
|
||||
for (int dy = -range; dy <= range; dy++) {
|
||||
for (int dz = -range; dz <= range; dz++) {
|
||||
// Skip center block, already added via HarvestResult constructor
|
||||
if (dx == 0 && dy == 0 && dz == 0) continue;
|
||||
|
||||
Block block2 = player.worldObj.getBlock(x + dx, y + dy, z + dz);
|
||||
if (block2 instanceof IShearable && ((IShearable) block2)
|
||||
.isShearable(itemstack, player.worldObj, x + dx, y + dy, z + dz)) {
|
||||
@@ -144,9 +145,12 @@ public class ItemDarkSteelShears extends ItemShears
|
||||
int maxBlocks = Math.min(sortedTargets.size(), powerStored / Config.darkSteelShearsPowerUsePerDamagePoint);
|
||||
for (int i = 0; i < maxBlocks; i++) {
|
||||
BlockCoord bc2 = sortedTargets.get(i);
|
||||
super.onBlockStartBreak(itemstack, bc2.x, bc2.y, bc2.z, player);
|
||||
if (bc2 != bc) {
|
||||
player.worldObj.setBlockToAir(bc2.x, bc2.y, bc2.z);
|
||||
Block target = player.worldObj.getBlock(bc2.x, bc2.y, bc2.z);
|
||||
if (target instanceof IShearable
|
||||
&& ((IShearable) target).isShearable(itemstack, player.worldObj, bc2.x, bc2.y, bc2.z)) {
|
||||
if (!super.onBlockStartBreak(itemstack, bc2.x, bc2.y, bc2.z, player)) {
|
||||
player.worldObj.setBlockToAir(bc2.x, bc2.y, bc2.z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user