Fix TnT/Creeper explosion with natural reinforcements

This commit is contained in:
erocs
2012-10-21 19:42:12 -07:00
parent 52183a1717
commit b0bc2c4520
2 changed files with 13 additions and 1 deletions

View File

@@ -132,6 +132,17 @@ public class Utility {
} }
} }
public static boolean explodeReinforcement(Block block) {
AccessDelegate delegate = AccessDelegate.getDelegate(block);
IReinforcement reinforcement = delegate.getReinforcement();
if (reinforcement == null) {
return false;
} else if(reinforcement instanceof NaturalReinforcement) {
return reinforcementBroken(reinforcement);
}
return reinforcementDamaged(reinforcement);
}
public static boolean maybeReinforcementDamaged(Block block) { public static boolean maybeReinforcementDamaged(Block block) {
AccessDelegate delegate = AccessDelegate.getDelegate(block); AccessDelegate delegate = AccessDelegate.getDelegate(block);
IReinforcement reinforcement = delegate.getReinforcement(); IReinforcement reinforcement = delegate.getReinforcement();

View File

@@ -1,5 +1,6 @@
package com.untamedears.citadel.listener; package com.untamedears.citadel.listener;
import static com.untamedears.citadel.Utility.explodeReinforcement;
import static com.untamedears.citadel.Utility.maybeReinforcementDamaged; import static com.untamedears.citadel.Utility.maybeReinforcementDamaged;
import java.util.ArrayList; import java.util.ArrayList;
@@ -36,7 +37,7 @@ public class EntityListener implements Listener {
while (iterator.hasNext()) { while (iterator.hasNext()) {
Block block = iterator.next(); Block block = iterator.next();
try { try {
if (maybeReinforcementDamaged(block)) { if (explodeReinforcement(block)) {
block.getDrops().clear(); block.getDrops().clear();
iterator.remove(); iterator.remove();
} }