Package tconstruct.smeltery.logic

Source Code of tconstruct.smeltery.logic.LiquidTextureLogic

package tconstruct.smeltery.logic;

import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.*;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;

public class LiquidTextureLogic extends TileEntity
{
    int texturePos;

    @Override
    public boolean canUpdate ()
    {
        return false;
    }

    public void setLiquidType (int tex)
    {
        texturePos = tex;
        worldObj.func_147479_m(xCoord, yCoord, zCoord);
    }

    public int getLiquidType ()
    {
        return texturePos;
    }

    @Override
    public void readFromNBT (NBTTagCompound tags)
    {
        super.readFromNBT(tags);
        readCustomNBT(tags);
    }

    public void readCustomNBT (NBTTagCompound tags)
    {
        texturePos = tags.getInteger("Texture");
    }

    @Override
    public void writeToNBT (NBTTagCompound tags)
    {
        super.writeToNBT(tags);
        writeCustomNBT(tags);
    }

    public void writeCustomNBT (NBTTagCompound tags)
    {
        tags.setInteger("Texture", texturePos);
    }

    @Override
    public Packet getDescriptionPacket ()
    {
        NBTTagCompound tag = new NBTTagCompound();
        writeCustomNBT(tag);
        return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, tag);
    }

    @Override
    public void onDataPacket (NetworkManager net, S35PacketUpdateTileEntity packet)
    {
        readCustomNBT(packet.func_148857_g());
        worldObj.func_147479_m(xCoord, yCoord, zCoord);
    }
}
TOP

Related Classes of tconstruct.smeltery.logic.LiquidTextureLogic

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.