Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package fr.hugoland.rpmod.common.tileentity;
- import cpw.mods.fml.relauncher.Side;
- import cpw.mods.fml.relauncher.SideOnly;
- import net.minecraft.tileentity.TileEntitySign;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.inventory.ISidedInventory;
- import net.minecraft.item.Item;
- import net.minecraft.item.ItemStack;
- import net.minecraft.nbt.NBTTagCompound;
- import net.minecraft.network.NetworkManager;
- import net.minecraft.network.Packet;
- import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
- import net.minecraft.tileentity.TileEntity;
- public class TileEntityPancarte extends TileEntitySign
- {
- private byte direction;
- public String[] signText = new String[] {"", ""};
- private boolean editable = true;
- private EntityPlayer player;
- public int lineBeingEdited = -1;
- @Override
- public void readFromNBT(NBTTagCompound compound)
- {
- this.editable = false;
- super.readFromNBT(compound);
- this.direction = compound.getByte("Direction");
- for (int i = 0; i < 2; ++i)
- {
- this.signText[i] = compound.getString("Text" + (i + 1));
- if (this.signText[i].length() > 15)
- {
- this.signText[i] = this.signText[i].substring(0, 15);
- }
- }
- }
- @Override
- public void writeToNBT(NBTTagCompound compound)
- {
- super.writeToNBT(compound);
- compound.setByte("Direction", this.direction);
- compound.setString("Text1", this.signText[0]);
- compound.setString("Text2", this.signText[1]);
- }
- public byte getDirection()
- {
- return direction;
- }
- public void setDirection(byte direction)
- {
- this.direction = direction;
- this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
- }
- public boolean getEditable()
- {
- return this.editable;
- }
- @SideOnly(Side.CLIENT)
- public void setEditable(boolean p_145913_1_)
- {
- this.editable = p_145913_1_;
- if (!p_145913_1_)
- {
- this.player = null;
- }
- }
- public void setPlayer(EntityPlayer player)
- {
- this.player = player;
- }
- public EntityPlayer getPlayer()
- {
- return this.player;
- }
- public Packet getDescriptionPacket()
- {
- NBTTagCompound nbttagcompound = new NBTTagCompound();
- this.writeToNBT(nbttagcompound);
- return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbttagcompound);
- }
- public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt)
- {
- this.readFromNBT(pkt.func_148857_g());
- this.worldObj.markBlockRangeForRenderUpdate(this.xCoord, this.yCoord, this.zCoord, this.xCoord, this.yCoord, this.zCoord);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement