Guest User

TileEntityBlockholeWall

a guest
Jan 31st, 2017
11
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.limplungs.blockhole.tileentities;
  2.  
  3. import net.minecraft.nbt.NBTTagCompound;
  4. import net.minecraft.network.NetworkManager;
  5. import net.minecraft.network.play.server.SPacketUpdateTileEntity;
  6. import net.minecraft.tileentity.TileEntity;
  7. import net.minecraft.util.EnumFacing;
  8. import net.minecraft.util.text.ITextComponent;
  9. import net.minecraftforge.common.capabilities.Capability;
  10.  
  11. public class TileEntityBlockholeWall extends TileEntity
  12. {
  13.     private int dimID = -999;
  14.     private int index = 0;
  15.    
  16.     public TileEntityBlockholeWall()
  17.     {
  18.     }
  19.    
  20.     @Override
  21.     public NBTTagCompound writeToNBT(NBTTagCompound compound)
  22.     {
  23.         compound.setInteger("dimID", this.dimID);
  24.         compound.setInteger("index", this.index);
  25.        
  26.         return super.writeToNBT(compound);
  27.     }
  28.    
  29.     @Override
  30.     public void readFromNBT(NBTTagCompound compound)
  31.     {
  32.         super.readFromNBT(compound);
  33.        
  34.         this.dimID = compound.getInteger("dimID");
  35.         this.index = compound.getInteger("index");
  36.     }
  37.    
  38.     @Override
  39.     public void handleUpdateTag(NBTTagCompound tag)
  40.     {
  41.         super.handleUpdateTag(tag);
  42.     }
  43.    
  44.    
  45.     @Override
  46.     public NBTTagCompound getUpdateTag()
  47.     {
  48.       return this.writeToNBT(super.getUpdateTag());
  49.     }
  50.    
  51.     @Override
  52.     public final SPacketUpdateTileEntity getUpdatePacket()
  53.     {
  54.       NBTTagCompound tag = new NBTTagCompound();
  55.       writeToNBT(tag);    
  56.       return new SPacketUpdateTileEntity(getPos(), 0, tag);
  57.     }
  58.    
  59.     @Override
  60.     public final void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt)
  61.     {
  62.       super.onDataPacket(net, pkt);
  63.      
  64.       if(worldObj.isRemote)
  65.       {
  66.         readFromNBT(pkt.getNbtCompound());
  67.       }
  68.     }
  69.  
  70.     public int getDimensionID()
  71.     {
  72.         return this.dimID;
  73.     }
  74.  
  75.     public void setDimensionID(int id)
  76.     {
  77.         this.dimID = id;
  78.         this.markDirty();
  79.     }
  80.  
  81.     public int getIndex()
  82.     {
  83.         return this.index;
  84.     }
  85.  
  86.     public void setIndex(int index)
  87.     {
  88.         this.index = index;
  89.         this.markDirty();
  90.     }
  91.    
  92.     @Override
  93.     public void markDirty()
  94.     {
  95.         super.markDirty();
  96.     }
  97.  
  98.  
  99.     @Override
  100.     public ITextComponent getDisplayName()
  101.     {
  102.         return null;
  103.     }
  104.  
  105.     @Override
  106.     public boolean hasCapability(Capability<?> capability, EnumFacing facing)
  107.     {
  108.         return false;
  109.     }
  110.  
  111.     @Override
  112.     public <T> T getCapability(Capability<T> capability, EnumFacing facing)
  113.     {
  114.         return null;
  115.     }
  116.  
  117.     @Override
  118.     public NBTTagCompound serializeNBT()
  119.     {
  120.         return null;
  121.     }
  122.    
  123. }
RAW Paste Data