2013-07-03 07:51:39 +00:00
|
|
|
package biomesoplenty.tileentities;
|
2013-06-07 21:36:52 +00:00
|
|
|
|
|
|
|
import net.minecraft.nbt.NBTTagCompound;
|
2013-06-08 07:04:09 +00:00
|
|
|
import net.minecraft.network.INetworkManager;
|
|
|
|
import net.minecraft.network.packet.Packet;
|
|
|
|
import net.minecraft.network.packet.Packet132TileEntityData;
|
2013-06-07 21:36:52 +00:00
|
|
|
import net.minecraft.tileentity.TileEntity;
|
|
|
|
|
|
|
|
public class TileEntityAltar extends TileEntity
|
|
|
|
{
|
2013-06-08 08:29:24 +00:00
|
|
|
private boolean apatitePresent = false;
|
|
|
|
private boolean peridotPresent = false;
|
|
|
|
private boolean rubyPresent = false;
|
|
|
|
private boolean sapphirePresent = false;
|
|
|
|
private boolean tanzanitePresent = false;
|
|
|
|
private boolean topazPresent = false;
|
2013-06-07 21:36:52 +00:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void readFromNBT(NBTTagCompound nbt)
|
|
|
|
{
|
|
|
|
super.readFromNBT(nbt);
|
|
|
|
this.apatitePresent = nbt.getBoolean("apatitePresent");
|
|
|
|
this.peridotPresent = nbt.getBoolean("peridotPresent");
|
|
|
|
this.rubyPresent = nbt.getBoolean("rubyPresent");
|
|
|
|
this.sapphirePresent = nbt.getBoolean("sapphirePresent");
|
|
|
|
this.tanzanitePresent = nbt.getBoolean("tanzanitePresent");
|
|
|
|
this.topazPresent = nbt.getBoolean("topazPresent");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void writeToNBT(NBTTagCompound nbt)
|
|
|
|
{
|
|
|
|
super.writeToNBT(nbt);
|
|
|
|
nbt.setBoolean("apatitePresent", apatitePresent);
|
|
|
|
nbt.setBoolean("peridotPresent", peridotPresent);
|
|
|
|
nbt.setBoolean("rubyPresent", rubyPresent);
|
|
|
|
nbt.setBoolean("sapphirePresent", sapphirePresent);
|
|
|
|
nbt.setBoolean("tanzanitePresent", tanzanitePresent);
|
|
|
|
nbt.setBoolean("topazPresent", topazPresent);
|
|
|
|
}
|
|
|
|
|
2013-06-08 07:04:09 +00:00
|
|
|
@Override
|
|
|
|
public Packet getDescriptionPacket()
|
2013-06-08 08:29:24 +00:00
|
|
|
{
|
|
|
|
NBTTagCompound nbt = new NBTTagCompound();
|
|
|
|
|
|
|
|
nbt.setBoolean("apatitePresent", apatitePresent);
|
|
|
|
nbt.setBoolean("peridotPresent", peridotPresent);
|
|
|
|
nbt.setBoolean("rubyPresent", rubyPresent);
|
|
|
|
nbt.setBoolean("sapphirePresent", sapphirePresent);
|
|
|
|
nbt.setBoolean("tanzanitePresent", tanzanitePresent);
|
|
|
|
nbt.setBoolean("topazPresent", topazPresent);
|
|
|
|
|
|
|
|
return new Packet132TileEntityData(this.xCoord, this.yCoord, this.zCoord, 0, nbt);
|
|
|
|
}
|
2013-06-08 07:04:09 +00:00
|
|
|
|
|
|
|
@Override
|
2013-10-16 05:29:49 +00:00
|
|
|
public void onDataPacket(INetworkManager var1, Packet132TileEntityData packet)
|
|
|
|
{
|
|
|
|
if (packet.actionType == 0)
|
|
|
|
{
|
|
|
|
this.apatitePresent = packet.data.getBoolean("apatitePresent");
|
|
|
|
this.peridotPresent = packet.data.getBoolean("peridotPresent");
|
|
|
|
this.rubyPresent = packet.data.getBoolean("rubyPresent");
|
|
|
|
this.sapphirePresent = packet.data.getBoolean("sapphirePresent");
|
|
|
|
this.tanzanitePresent = packet.data.getBoolean("tanzanitePresent");
|
|
|
|
this.topazPresent = packet.data.getBoolean("topazPresent");
|
|
|
|
}
|
|
|
|
|
2013-06-08 07:04:09 +00:00
|
|
|
this.worldObj.markBlockForUpdate(packet.xPosition, packet.yPosition, packet.zPosition);
|
2013-10-16 05:29:49 +00:00
|
|
|
}
|
2013-06-08 07:04:09 +00:00
|
|
|
|
2013-06-09 22:45:23 +00:00
|
|
|
public void setPresent(int presentGem, boolean state)
|
2013-06-07 21:36:52 +00:00
|
|
|
{
|
2013-06-09 22:45:23 +00:00
|
|
|
if (presentGem == 10)
|
2013-06-07 21:36:52 +00:00
|
|
|
{
|
2013-06-09 22:45:23 +00:00
|
|
|
rubyPresent = state;
|
2013-06-07 21:36:52 +00:00
|
|
|
}
|
2013-06-09 22:45:23 +00:00
|
|
|
else if (presentGem == 11)
|
2013-06-07 21:36:52 +00:00
|
|
|
{
|
|
|
|
peridotPresent = state;
|
|
|
|
}
|
2013-06-09 22:45:23 +00:00
|
|
|
else if (presentGem == 12)
|
2013-06-07 21:36:52 +00:00
|
|
|
{
|
2013-06-09 22:45:23 +00:00
|
|
|
topazPresent = state;
|
2013-06-07 21:36:52 +00:00
|
|
|
}
|
2013-06-09 22:45:23 +00:00
|
|
|
else if (presentGem == 13)
|
2013-06-07 21:36:52 +00:00
|
|
|
{
|
2013-06-09 22:45:23 +00:00
|
|
|
tanzanitePresent = state;
|
2013-06-07 21:36:52 +00:00
|
|
|
}
|
2013-06-09 22:45:23 +00:00
|
|
|
else if (presentGem == 14)
|
2013-06-07 21:36:52 +00:00
|
|
|
{
|
2013-06-09 22:45:23 +00:00
|
|
|
apatitePresent = state;
|
2013-06-07 21:36:52 +00:00
|
|
|
}
|
2013-06-09 22:45:23 +00:00
|
|
|
else if (presentGem == 15)
|
2013-06-07 21:36:52 +00:00
|
|
|
{
|
2013-06-09 22:45:23 +00:00
|
|
|
sapphirePresent = state;
|
2013-06-07 21:36:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-09 22:45:23 +00:00
|
|
|
public boolean getPresent(int presentGem)
|
2013-06-07 21:36:52 +00:00
|
|
|
{
|
2013-06-09 22:45:23 +00:00
|
|
|
if (presentGem == 10)
|
2013-06-07 21:36:52 +00:00
|
|
|
{
|
2013-06-09 22:45:23 +00:00
|
|
|
return rubyPresent;
|
2013-06-07 21:36:52 +00:00
|
|
|
}
|
2013-06-09 22:45:23 +00:00
|
|
|
else if (presentGem == 11)
|
2013-06-07 21:36:52 +00:00
|
|
|
{
|
|
|
|
return peridotPresent;
|
|
|
|
}
|
2013-06-09 22:45:23 +00:00
|
|
|
else if (presentGem == 12)
|
2013-06-07 21:36:52 +00:00
|
|
|
{
|
2013-06-09 22:45:23 +00:00
|
|
|
return topazPresent;
|
2013-06-07 21:36:52 +00:00
|
|
|
}
|
2013-06-09 22:45:23 +00:00
|
|
|
else if (presentGem == 13)
|
2013-06-07 21:36:52 +00:00
|
|
|
{
|
2013-06-09 22:45:23 +00:00
|
|
|
return tanzanitePresent;
|
2013-06-07 21:36:52 +00:00
|
|
|
}
|
2013-06-09 22:45:23 +00:00
|
|
|
else if (presentGem == 14)
|
2013-06-07 21:36:52 +00:00
|
|
|
{
|
2013-06-09 22:45:23 +00:00
|
|
|
return apatitePresent;
|
2013-06-07 21:36:52 +00:00
|
|
|
}
|
2013-06-09 22:45:23 +00:00
|
|
|
else if (presentGem == 15)
|
2013-06-07 21:36:52 +00:00
|
|
|
{
|
2013-06-09 22:45:23 +00:00
|
|
|
return sapphirePresent;
|
2013-06-07 21:36:52 +00:00
|
|
|
}
|
2013-06-08 02:50:47 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2013-06-07 21:36:52 +00:00
|
|
|
}
|
2013-06-15 03:18:19 +00:00
|
|
|
|
|
|
|
public boolean getAllPresent()
|
|
|
|
{
|
|
|
|
if (rubyPresent && peridotPresent && topazPresent && tanzanitePresent && apatitePresent && sapphirePresent)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2013-07-01 00:31:34 +00:00
|
|
|
|
|
|
|
return false;
|
2013-06-15 03:18:19 +00:00
|
|
|
}
|
2013-06-07 21:36:52 +00:00
|
|
|
}
|