mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-17 10:24:23 +01:00
Fixed postal spells
This commit is contained in:
parent
a0fa404767
commit
600d9f7ce9
1 changed files with 12 additions and 4 deletions
|
@ -83,6 +83,8 @@ public class SpellPortal extends AbstractSpell.RangedAreaSpell implements IUseAc
|
||||||
getDestinationPortal().ifPresent(IMagicEffect::setDead);
|
getDestinationPortal().ifPresent(IMagicEffect::setDead);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private SpellPortal bridge;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlaced(ICaster<?> caster) {
|
public void onPlaced(ICaster<?> caster) {
|
||||||
world = caster.getWorld();
|
world = caster.getWorld();
|
||||||
|
@ -93,6 +95,10 @@ public class SpellPortal extends AbstractSpell.RangedAreaSpell implements IUseAc
|
||||||
sibling.destinationId = casterId;
|
sibling.destinationId = casterId;
|
||||||
sibling.destinationPos = position;
|
sibling.destinationPos = position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (bridge != null) {
|
||||||
|
bridge.onPlaced(caster);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -102,16 +108,18 @@ public class SpellPortal extends AbstractSpell.RangedAreaSpell implements IUseAc
|
||||||
|
|
||||||
IPlayer prop = PlayerSpeciesList.instance().getPlayer(player);
|
IPlayer prop = PlayerSpeciesList.instance().getPlayer(player);
|
||||||
|
|
||||||
IMagicEffect other = prop.getEffect();
|
SpellPortal other = prop.getEffect(SpellPortal.class, true);
|
||||||
if (other instanceof SpellPortal && other != this && !other.getDead()) {
|
if (other != null) {
|
||||||
((SpellPortal)other).getActualInstance().setDestinationPortal(this);
|
other.getActualInstance().setDestinationPortal(this);
|
||||||
|
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
prop.setEffect(null);
|
prop.setEffect(null);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
prop.setEffect(this);
|
bridge = (SpellPortal)copy();
|
||||||
|
|
||||||
|
prop.setEffect(bridge);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue