Advertisement
Guest User

TileEntityCarbonCondenser - Updating Texture area.

a guest
Jul 29th, 2015
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.72 KB | None | 0 0
  1.     /**
  2.      * Updating the Textures in my TILE ENTITY CLASS
  3.      */
  4.     @Override
  5.     public Packet getDescriptionPacket()
  6.     {
  7.         NBTTagCompound tag = new NBTTagCompound();
  8.         writeToNBT(tag);
  9.         return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, tag);
  10.     }
  11.  
  12.     @Override
  13.     public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt)
  14.     {
  15.         readFromNBT(pkt.func_148857_g());
  16.     }
  17.  
  18.     public void markForUpdate()
  19.     {
  20.         worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
  21.         Minecraft.getMinecraft().renderGlobal.markBlockForUpdate(xCoord, yCoord, zCoord);
  22.         Minecraft.getMinecraft().renderGlobal.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
  23.     }
  24.  
  25.     public void updateCircuitTextures(World world, int x, int y, int z)
  26.     {
  27.         // sets orientation of sides
  28.         if (this.meta == 2)
  29.         {
  30.             this.left = 5;
  31.             this.right = 4;
  32.             this.back = 3;
  33.         }
  34.         else if (this.meta == 3)
  35.         {
  36.             this.left = 4;
  37.             this.right = 5;
  38.             this.back = 2;
  39.         }
  40.         else if (this.meta == 4)
  41.         {
  42.             this.left = 2;
  43.             this.right = 3;
  44.             this.back = 5;
  45.         }
  46.         else if (this.meta == 5)
  47.         {
  48.             this.left = 3;
  49.             this.right = 2;
  50.             this.back = 4;
  51.         }
  52.  
  53.         // Sets circuit textures
  54.  
  55.         // Top Side
  56.         if (this.getStackInSlot(4) != null)
  57.         {
  58.             if (this.getStackInSlot(4).getItem() == Construct.circuitImport)
  59.             {
  60.                 this.sTop = 1;
  61.             }
  62.             else if (this.getStackInSlot(4).getItem() == Construct.circuitExport)
  63.             {
  64.                 this.sTop = 2;
  65.             }
  66.         }
  67.         else
  68.         {
  69.             this.sTop = 0;
  70.         }
  71.  
  72.         // Left Side
  73.         if (this.getStackInSlot(5) != null)
  74.         {
  75.             if (this.getStackInSlot(5).getItem() == Construct.circuitImport)
  76.             {
  77.                 this.sLeft = 1;
  78.             }
  79.             else if (this.getStackInSlot(5).getItem() == Construct.circuitExport)
  80.             {
  81.                 this.sLeft = 2;
  82.             }
  83.         }
  84.         else
  85.         {
  86.             this.sLeft = 0;
  87.         }
  88.  
  89.         // Back Side
  90.         if (this.getStackInSlot(6) != null)
  91.         {
  92.             if (this.getStackInSlot(6).getItem() == Construct.circuitImport)
  93.             {
  94.                 this.sBack = 1;
  95.             }
  96.             else if (this.getStackInSlot(6).getItem() == Construct.circuitExport)
  97.             {
  98.                 this.sBack = 2;
  99.             }
  100.         }
  101.         else
  102.         {
  103.             this.sBack = 0;
  104.         }
  105.  
  106.         // Right Side
  107.         if (this.getStackInSlot(7) != null)
  108.         {
  109.             if (this.getStackInSlot(7).getItem() == Construct.circuitImport)
  110.             {
  111.                 this.sRight = 1;
  112.             }
  113.             else if (this.getStackInSlot(7).getItem() == Construct.circuitExport)
  114.             {
  115.                 this.sRight = 2;
  116.             }
  117.         }
  118.         else
  119.         {
  120.             this.sRight = 0;
  121.         }
  122.  
  123.         // Bottom Side
  124.         if (this.getStackInSlot(8) != null)
  125.         {
  126.             if (this.getStackInSlot(8).getItem() == Construct.circuitImport)
  127.             {
  128.                 this.sBot = 1;
  129.             }
  130.             else if (this.getStackInSlot(8).getItem() == Construct.circuitExport)
  131.             {
  132.                 this.sBot = 2;
  133.             }
  134.         }
  135.         else
  136.         {
  137.             this.sBot = 0;
  138.         }
  139.        
  140.         this.markForUpdate();
  141.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement