mirror of
https://github.com/CivMC/Civ.git
synced 2026-07-15 23:20:44 +00:00
Fix TnT/Creeper explosion with natural reinforcements
This commit is contained in:
@@ -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();
|
||||||
|
|||||||
@@ -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();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user