mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-08 06:26:43 +01:00
Players holding the gem of light will also emit light!
This commit is contained in:
parent
74f02b045c
commit
0c5a92bdae
1 changed files with 29 additions and 6 deletions
|
@ -1,15 +1,13 @@
|
|||
package com.minelittlepony.unicopia.spell;
|
||||
|
||||
import com.minelittlepony.util.PosHelper;
|
||||
import com.minelittlepony.unicopia.player.IPlayer;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.EnumSkyBlock;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class SpellLight extends GenericSpell {
|
||||
public class SpellLight extends GenericSpell implements IHeldEffect {
|
||||
|
||||
private BlockPos lastPos;
|
||||
private ICaster<?> source;
|
||||
|
@ -32,6 +30,13 @@ public class SpellLight extends GenericSpell {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateInHand(IPlayer caster, SpellAffinity affinity) {
|
||||
if (caster.getPlayerSpecies().canCast()) {
|
||||
update(caster);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(ICaster<?> source) {
|
||||
this.source = source;
|
||||
|
@ -58,7 +63,25 @@ public class SpellLight extends GenericSpell {
|
|||
return true;
|
||||
}
|
||||
|
||||
protected void resetLight(BlockPos pos) {
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound) {
|
||||
super.writeToNBT(compound);
|
||||
|
||||
if (compound.hasKey("lastX")) {
|
||||
lastPos = new BlockPos(compound.getInteger("lastX"), compound.getInteger("lastY"), compound.getInteger("lastZ"));
|
||||
} else {
|
||||
lastPos = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound) {
|
||||
super.readFromNBT(compound);
|
||||
|
||||
if (lastPos != null) {
|
||||
compound.setInteger("lastX", lastPos.getX());
|
||||
compound.setInteger("lastY", lastPos.getY());
|
||||
compound.setInteger("lastZ", lastPos.getZ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue