mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-25 20:58:34 +01:00
parent
d334272467
commit
a24d73dc77
1 changed files with 7 additions and 8 deletions
|
@ -62,8 +62,8 @@ public class EntityEffectInhibitor extends Entity implements IVisualizable {
|
||||||
@Override
|
@Override
|
||||||
public void onRemovedFromWorld() {
|
public void onRemovedFromWorld() {
|
||||||
super.onRemovedFromWorld();
|
super.onRemovedFromWorld();
|
||||||
this.setInhibitedEffect(null);
|
// we pass a null effect because we want to remove our effect from the world
|
||||||
this.updatePowderListStatus();
|
this.updatePowderListStatus(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -92,7 +92,7 @@ public class EntityEffectInhibitor extends Entity implements IVisualizable {
|
||||||
super.tick();
|
super.tick();
|
||||||
|
|
||||||
if (this.powderListDirty)
|
if (this.powderListDirty)
|
||||||
this.updatePowderListStatus();
|
this.updatePowderListStatus(this.getInhibitedEffect());
|
||||||
|
|
||||||
if (this.level.isClientSide) {
|
if (this.level.isClientSide) {
|
||||||
if (this.level.getGameTime() % 5 == 0) {
|
if (this.level.getGameTime() % 5 == 0) {
|
||||||
|
@ -199,18 +199,17 @@ public class EntityEffectInhibitor extends Entity implements IVisualizable {
|
||||||
return this.getColor();
|
return this.getColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updatePowderListStatus() {
|
private void updatePowderListStatus(ResourceLocation inhibitedEffect) {
|
||||||
var powders = ((LevelData) ILevelData.getLevelData(this.level)).effectPowders;
|
var powders = ((LevelData) ILevelData.getLevelData(this.level)).effectPowders;
|
||||||
if (this.lastEffect != null) {
|
if (this.lastEffect != null) {
|
||||||
var oldList = powders.get(this.lastEffect);
|
var oldList = powders.get(this.lastEffect);
|
||||||
oldList.removeIf(t -> this.getEyePosition().equals(t.getA()));
|
oldList.removeIf(t -> this.getEyePosition().equals(t.getA()));
|
||||||
}
|
}
|
||||||
var effect = this.getInhibitedEffect();
|
if (inhibitedEffect != null) {
|
||||||
if (effect != null) {
|
var newList = powders.get(inhibitedEffect);
|
||||||
var newList = powders.get(effect);
|
|
||||||
newList.add(new Tuple<>(this.getEyePosition(), this.getAmount()));
|
newList.add(new Tuple<>(this.getEyePosition(), this.getAmount()));
|
||||||
}
|
}
|
||||||
this.powderListDirty = false;
|
this.powderListDirty = false;
|
||||||
this.lastEffect = effect;
|
this.lastEffect = inhibitedEffect;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue