mirror of
https://github.com/GTNewHorizons/Gadomancy.git
synced 2026-11-26 14:53:21 +00:00
- AuraCore: <init>
- AuraPylon: Finishing touches
This commit is contained in:
1 parent
c0f0d9924e
commit
27ac4caf63
16 files changed
+140
-62
No files matched your search
@@ -71,32 +71,6 @@ public class EventHandlerWorld {
|
||||
rules.theGameRules.put("mobGriefing", new ValueOverride(this, String.valueOf(rules.getGameRuleBooleanValue("mobGriefing"))));
|
||||
}
|
||||
|
||||
private static class ValueOverride extends GameRules.Value {
|
||||
private final EventHandlerWorld handler;
|
||||
public ValueOverride(EventHandlerWorld handler, String value) {
|
||||
super(value);
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getGameRuleBooleanValue() {
|
||||
boolean mobGriefing = super.getGameRuleBooleanValue();
|
||||
if(mobGriefing) {
|
||||
Entity lastUpdated = handler.lastUpdated;
|
||||
if(lastUpdated != null) {
|
||||
StackTraceElement[] elements = Thread.currentThread().getStackTrace();
|
||||
for(StackTraceElement element : elements) {
|
||||
if(element.getClassName().equals(EntityLivingBase.class.getName())
|
||||
&& (element.getMethodName().equals("func_70071_h") || element.getMethodName().equals("onUpdate"))) {
|
||||
return !TileBlockProtector.isSpotProtected(lastUpdated.worldObj, lastUpdated);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return mobGriefing;
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public void on(ExplosionEvent.Start e) {
|
||||
Explosion expl = e.explosion;
|
||||
@@ -217,4 +191,30 @@ public class EventHandlerWorld {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class ValueOverride extends GameRules.Value {
|
||||
private final EventHandlerWorld handler;
|
||||
public ValueOverride(EventHandlerWorld handler, String value) {
|
||||
super(value);
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getGameRuleBooleanValue() {
|
||||
boolean mobGriefing = super.getGameRuleBooleanValue();
|
||||
if(mobGriefing) {
|
||||
Entity lastUpdated = handler.lastUpdated;
|
||||
if(lastUpdated != null) {
|
||||
StackTraceElement[] elements = Thread.currentThread().getStackTrace();
|
||||
for(StackTraceElement element : elements) {
|
||||
if(element.getClassName().equals(EntityLivingBase.class.getName())
|
||||
&& (element.getMethodName().equals("func_70071_h") || element.getMethodName().equals("onUpdate"))) {
|
||||
return !TileBlockProtector.isSpotProtected(lastUpdated.worldObj, lastUpdated);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return mobGriefing;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user