Switching PCs

This commit is contained in:
Pahimar 2014-10-14 21:11:54 -04:00
parent 5a73736076
commit 4b3dce914f

View file

@ -9,112 +9,68 @@ import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.Packet;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityAlchemyArray extends TileEntityEE
{
public class TileEntityAlchemyArray extends TileEntityEE {
private AlchemyArray alchemyArray;
private int rotation;
private ForgeDirection rotation;
public TileEntityAlchemyArray()
{
public TileEntityAlchemyArray() {
super();
alchemyArray = new AlchemyArray();
rotation = 0;
rotation = ForgeDirection.UNKNOWN;
}
public AlchemyArray getAlchemyArray()
{
public AlchemyArray getAlchemyArray() {
return alchemyArray;
}
public boolean addGlyphToAlchemyArray(Glyph glyph)
{
public boolean addGlyphToAlchemyArray(Glyph glyph) {
return alchemyArray.addGlyph(glyph);
}
public boolean addGlyphToAlchemyArray(Glyph glyph, int size)
{
public boolean addGlyphToAlchemyArray(Glyph glyph, int size) {
return addGlyphToAlchemyArray(new Glyph(glyph, size));
}
public int getRotation()
{
public ForgeDirection getRotation() {
return rotation;
}
public void setRotation(int rotation)
{
public void setRotation(ForgeDirection rotation) {
this.rotation = rotation;
if (this.rotation < 0)
{
this.rotation = 0;
}
else
{
this.rotation = this.rotation % 4;
}
}
public void rotate()
{
rotate(true);
}
/**
* @param rotateClockwise true if we should rotate clockwise, false if we rotate counter clockwise
*/
public void rotate(boolean rotateClockwise)
{
if (rotateClockwise)
{
this.rotation = (rotation + 1) % 4;
}
else
{
this.rotation -= 1;
if (this.rotation < 0)
{
this.rotation = 3;
}
}
}
@Override
@SideOnly(Side.CLIENT)
public AxisAlignedBB getRenderBoundingBox()
{
public AxisAlignedBB getRenderBoundingBox() {
// TODO: Make this glyph size and orientation sensitive
return AxisAlignedBB.getBoundingBox(xCoord - alchemyArray.getLargestGlyphSize(), yCoord - alchemyArray.getLargestGlyphSize(), zCoord - alchemyArray.getLargestGlyphSize(), xCoord + alchemyArray.getLargestGlyphSize(), yCoord + alchemyArray.getLargestGlyphSize(), zCoord + alchemyArray.getLargestGlyphSize());
}
@Override
public Packet getDescriptionPacket()
{
public Packet getDescriptionPacket() {
return PacketHandler.INSTANCE.getPacketFrom(new MessageTileEntityAlchemyArray(this));
}
@Override
public void readFromNBT(NBTTagCompound nbtTagCompound)
{
public void readFromNBT(NBTTagCompound nbtTagCompound) {
super.readFromNBT(nbtTagCompound);
NBTTagCompound alchemyArrayTagCompound = nbtTagCompound.getCompoundTag("alchemyArray");
alchemyArray = AlchemyArray.readAlchemyArrayFromNBT(alchemyArrayTagCompound);
rotation = nbtTagCompound.getInteger("rotation");
rotation = ForgeDirection.getOrientation(nbtTagCompound.getInteger("rotation"));
}
@Override
public void writeToNBT(NBTTagCompound nbtTagCompound)
{
public void writeToNBT(NBTTagCompound nbtTagCompound) {
super.writeToNBT(nbtTagCompound);
NBTTagCompound alchemyArrayTagCompound = new NBTTagCompound();
alchemyArray.writeToNBT(alchemyArrayTagCompound);
nbtTagCompound.setInteger("rotation", rotation);
nbtTagCompound.setInteger("rotation", rotation.ordinal());
nbtTagCompound.setTag("alchemyArray", alchemyArrayTagCompound);
}