Advertisement
Guest User

TileEntity that I don't know what to do with anymore :/

a guest
Jul 30th, 2015
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 17.46 KB | None | 0 0
  1. package com.limplungs.limpcraft.tileentities;
  2.  
  3. import com.limplungs.limpcraft.Construct;
  4. import com.limplungs.limpcraft.blocks.machines.CarbonCondenser;
  5. import com.limplungs.limpcraft.recipes.RecipesCarbonCondenser;
  6. import cpw.mods.fml.relauncher.Side;
  7. import cpw.mods.fml.relauncher.SideOnly;
  8. import net.minecraft.block.Block;
  9. import net.minecraft.client.Minecraft;
  10. import net.minecraft.entity.player.EntityPlayer;
  11. import net.minecraft.init.Blocks;
  12. import net.minecraft.inventory.ISidedInventory;
  13. import net.minecraft.item.ItemStack;
  14. import net.minecraft.nbt.NBTTagCompound;
  15. import net.minecraft.nbt.NBTTagList;
  16. import net.minecraft.network.NetworkManager;
  17. import net.minecraft.network.Packet;
  18. import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
  19. import net.minecraft.tileentity.TileEntity;
  20. import net.minecraft.world.World;
  21.  
  22. public class TileEntityCarbonCondenser extends TileEntity implements ISidedInventory
  23. {
  24.  
  25.     private static final int[] slotsAutomation = new int[] { 0, 1, 2, 3 };
  26.  
  27.     private static String invname = "Carbon Condenser";
  28.  
  29.     private ItemStack[] itemslots = new ItemStack[9];
  30.  
  31.     public long speed = 0;
  32.  
  33.     public int smeltcount = 0;
  34.     public int smeltrequire = 0;
  35.  
  36.     public long fuelcount = 0;
  37.     public long fuelrequire = 0;
  38.  
  39.     public long condenserCookTime;
  40.     public long currentItemBurnTime;
  41.  
  42.     public long condenserBurnTime;
  43.  
  44.     public int sTop = 0;
  45.     public int sBot = 0;
  46.     public int sLeft = 0;
  47.     public int sRight = 0;
  48.     public int sBack = 0;
  49.  
  50.     public int bot = 0;
  51.     public int top = 1;
  52.     public int left = 5;
  53.     public int right = 4;
  54.     public int back = 3;
  55.  
  56.     public int meta = 0;
  57.  
  58.     @Override
  59.     public int getSizeInventory()
  60.     {
  61.         return this.itemslots.length;
  62.     }
  63.  
  64.     @Override
  65.     public ItemStack getStackInSlot(int i)
  66.     {
  67.         return itemslots[i];
  68.     }
  69.  
  70.     @Override
  71.     public ItemStack decrStackSize(int i, int count)
  72.     {
  73.         ItemStack itemstack = getStackInSlot(i);
  74.  
  75.         if (itemstack != null)
  76.         {
  77.             if (itemstack.stackSize <= count)
  78.             {
  79.                 setInventorySlotContents(i, null);
  80.             }
  81.             else
  82.             {
  83.                 itemstack = itemstack.splitStack(count);
  84.                 markDirty();
  85.             }
  86.         }
  87.  
  88.         return itemstack;
  89.     }
  90.  
  91.     @Override
  92.     public ItemStack getStackInSlotOnClosing(int i)
  93.     {
  94.         ItemStack item = getStackInSlot(i);
  95.         setInventorySlotContents(i, null);
  96.         return item;
  97.     }
  98.  
  99.     @Override
  100.     public void setInventorySlotContents(int i, ItemStack itemstack)
  101.     {
  102.         itemslots[i] = itemstack;
  103.  
  104.         if (itemstack != null && itemstack.stackSize > getInventoryStackLimit())
  105.         {
  106.             itemstack.stackSize = getInventoryStackLimit();
  107.         }
  108.  
  109.         markDirty();
  110.     }
  111.  
  112.     @Override
  113.     public String getInventoryName()
  114.     {
  115.         return invname;
  116.     }
  117.  
  118.     @Override
  119.     public boolean hasCustomInventoryName()
  120.     {
  121.         return true;
  122.     }
  123.  
  124.     @Override
  125.     public int getInventoryStackLimit()
  126.     {
  127.         return 64;
  128.     }
  129.  
  130.     @Override
  131.     public boolean isUseableByPlayer(EntityPlayer player)
  132.     {
  133.         return true;
  134.     }
  135.  
  136.     @Override
  137.     public void openInventory()
  138.     {
  139.  
  140.     }
  141.  
  142.     @Override
  143.     public void closeInventory()
  144.     {
  145.  
  146.     }
  147.  
  148.     @Override
  149.     public boolean isItemValidForSlot(int par1, ItemStack itemstack)
  150.     {
  151.         if (par1 == 0 && isItemInput(itemstack) == true)
  152.         {
  153.             return true;
  154.         }
  155.         else if (par1 == 1 && isItemFuel(itemstack) == true)
  156.         {
  157.             return true;
  158.         }
  159.         else if (par1 == 2 && itemstack.getItem() == new ItemStack(Blocks.air).getItem())
  160.         {
  161.             return true;
  162.         }
  163.         else if (par1 == 3 && isItemUpgrade(itemstack) == true)
  164.         {
  165.             return true;
  166.         }
  167.         else if (par1 == 4 && isItemCircuit(itemstack) == true || par1 == 5 && isItemCircuit(itemstack) == true || par1 == 6 && isItemCircuit(itemstack) == true || par1 == 7 && isItemCircuit(itemstack) == true || par1 == 8 && isItemCircuit(itemstack) == true)
  168.         {
  169.             return true;
  170.         }
  171.         else
  172.         {
  173.             return false;
  174.         }
  175.  
  176.     }
  177.  
  178.     public static boolean isItemCircuit(ItemStack itemstack)
  179.     {
  180.         if (itemstack.getItem() == new ItemStack(Construct.circuitImport).getItem() || itemstack.getItem() == new ItemStack(Construct.circuitExport).getItem())
  181.         {
  182.             return true;
  183.         }
  184.         else
  185.         {
  186.             return false;
  187.         }
  188.     }
  189.  
  190.     public static boolean isItemUpgrade(ItemStack itemstack)
  191.     {
  192.         if (RecipesCarbonCondenser.getPercentage(itemstack) > 0)
  193.         {
  194.             return true;
  195.         }
  196.         else
  197.         {
  198.             return false;
  199.         }
  200.     }
  201.  
  202.     public static boolean isItemInput(ItemStack itemstack)
  203.     {
  204.         if (RecipesCarbonCondenser.getInputSmeltTime(itemstack) > 0)
  205.         {
  206.             return true;
  207.         }
  208.         else
  209.         {
  210.             return false;
  211.         }
  212.     }
  213.  
  214.     public static boolean isItemFuel(ItemStack itemstack)
  215.     {
  216.         if (RecipesCarbonCondenser.getFuelBurnTime(itemstack) > 0)
  217.         {
  218.             return true;
  219.         }
  220.         else
  221.         {
  222.             return false;
  223.         }
  224.     }
  225.  
  226.     @Override
  227.     public int[] getAccessibleSlotsFromSide(int side)
  228.     {
  229.         if (side == top || side == left || side == back || side == right || side == bot)
  230.         {
  231.             return slotsAutomation;
  232.         }
  233.         return null;
  234.     }
  235.  
  236.     @Override
  237.     public boolean canInsertItem(int slot, ItemStack itemstack, int side)
  238.     {
  239.         if (this.getStackInSlot(4) != null)
  240.         {
  241.             if (this.getStackInSlot(4).getItem() == Construct.circuitImport && side == top && this.isItemValidForSlot(slot, itemstack))
  242.             {
  243.                 return true;
  244.             }
  245.         }
  246.         if (this.getStackInSlot(5) != null)
  247.         {
  248.             if (this.getStackInSlot(5).getItem() == Construct.circuitImport && side == left && this.isItemValidForSlot(slot, itemstack))
  249.             {
  250.                 return true;
  251.             }
  252.         }
  253.         if (this.getStackInSlot(6) != null)
  254.         {
  255.             if (this.getStackInSlot(6).getItem() == Construct.circuitImport && side == back && this.isItemValidForSlot(slot, itemstack))
  256.             {
  257.                 return true;
  258.             }
  259.         }
  260.         if (this.getStackInSlot(7) != null)
  261.         {
  262.             if (this.getStackInSlot(7).getItem() == Construct.circuitImport && side == right && this.isItemValidForSlot(slot, itemstack))
  263.             {
  264.                 return true;
  265.             }
  266.         }
  267.         if (this.getStackInSlot(8) != null)
  268.         {
  269.             if (this.getStackInSlot(8).getItem() == Construct.circuitImport && side == bot && this.isItemValidForSlot(slot, itemstack))
  270.             {
  271.                 return true;
  272.             }
  273.         }
  274.  
  275.         return false;
  276.     }
  277.  
  278.     @Override
  279.     public boolean canExtractItem(int slot, ItemStack itemstack, int side)
  280.     {
  281.         if (slot == 2)
  282.         {
  283.             if (this.getStackInSlot(4) != null)
  284.             {
  285.                 if (this.getStackInSlot(4).getItem() == Construct.circuitExport && side == top)
  286.                 {
  287.                     return true;
  288.                 }
  289.             }
  290.             if (this.getStackInSlot(5) != null)
  291.             {
  292.                 if (this.getStackInSlot(5).getItem() == Construct.circuitExport && side == left)
  293.                 {
  294.                     return true;
  295.                 }
  296.             }
  297.             if (this.getStackInSlot(6) != null)
  298.             {
  299.                 if (this.getStackInSlot(6).getItem() == Construct.circuitExport && side == back)
  300.                 {
  301.                     return true;
  302.                 }
  303.             }
  304.             if (this.getStackInSlot(7) != null)
  305.             {
  306.                 if (this.getStackInSlot(7).getItem() == Construct.circuitExport && side == right)
  307.                 {
  308.                     return true;
  309.                 }
  310.             }
  311.             if (this.getStackInSlot(8) != null)
  312.             {
  313.                 if (this.getStackInSlot(8).getItem() == Construct.circuitExport && side == bot)
  314.                 {
  315.                     return true;
  316.                 }
  317.             }
  318.         }
  319.         return false;
  320.     }
  321.  
  322.     @Override
  323.     public void writeToNBT(NBTTagCompound compound)
  324.     {
  325.         updateCircuitTextures(); //Updates Circuit Texture Data before write.
  326.  
  327.         super.writeToNBT(compound);
  328.  
  329.         NBTTagList items = new NBTTagList();
  330.  
  331.         for (int i = 0; i < getSizeInventory(); i++)
  332.         {
  333.             ItemStack stack = this.getStackInSlot(i);
  334.  
  335.             if (stack != null)
  336.             {
  337.                 NBTTagCompound item = new NBTTagCompound();
  338.                 item.setByte("Slot", (byte) i);
  339.                 stack.writeToNBT(item);
  340.                 items.appendTag(item);
  341.             }
  342.         }
  343.  
  344.         compound.setTag("Items", items);
  345.         compound.setLong("CookTime", this.condenserCookTime);
  346.         compound.setLong("BurnTime", this.condenserBurnTime);
  347.         compound.setLong("CBurnTime", this.currentItemBurnTime);
  348.  
  349.         compound.setInteger("intleft", this.left);
  350.         compound.setInteger("intright", this.right);
  351.         compound.setInteger("intback", this.back);
  352.         compound.setInteger("inttop", this.top);
  353.         compound.setInteger("intbot", this.bot);
  354.         compound.setInteger("intsLeft", this.sLeft);
  355.         compound.setInteger("intsRight", this.sRight);
  356.         compound.setInteger("intsBack", this.sBack);
  357.         compound.setInteger("intsTop", this.sTop);
  358.         compound.setInteger("intsBot", this.sBot);
  359.     }
  360.  
  361.     @Override
  362.     public void readFromNBT(NBTTagCompound compound)
  363.     {
  364.         super.readFromNBT(compound);
  365.  
  366.         NBTTagList items = compound.getTagList("Items", compound.getId());
  367.  
  368.         for (int i = 0; i < items.tagCount(); i++)
  369.         {
  370.             NBTTagCompound item = (NBTTagCompound) items.getCompoundTagAt(i);
  371.             byte slot = item.getByte("Slot");
  372.  
  373.             if (slot >= 0 && slot < this.getSizeInventory())
  374.             {
  375.                 this.itemslots[slot] = ItemStack.loadItemStackFromNBT(item);
  376.             }
  377.         }
  378.  
  379.         this.condenserCookTime = compound.getInteger("CookTime");
  380.         this.condenserBurnTime = compound.getLong("BurnTime");
  381.         this.currentItemBurnTime = compound.getInteger("CBurnTime");
  382.  
  383.         this.left = compound.getInteger("intleft");
  384.         this.right = compound.getInteger("intright");
  385.         this.back = compound.getInteger("intback");
  386.         this.top = compound.getInteger("inttop");
  387.         this.bot = compound.getInteger("intbot");
  388.         this.sLeft = compound.getInteger("intsLeft");
  389.         this.sRight = compound.getInteger("intsRight");
  390.         this.sBack = compound.getInteger("intsBack");
  391.         this.sTop = compound.getInteger("intsTop");
  392.         this.sBot = compound.getInteger("intsBot");
  393.     }
  394.  
  395.     @SideOnly(Side.CLIENT)
  396.     public long getSmeltProgressScaled(int GUILength)
  397.     {
  398.         if (itemslots[0] != null)
  399.         {
  400.             return this.condenserCookTime * GUILength / RecipesCarbonCondenser.getInputSmeltTime(itemslots[0]);
  401.         }
  402.         else
  403.         {
  404.             return 0;
  405.         }
  406.     }
  407.  
  408.     @SideOnly(Side.CLIENT)
  409.     public long getFuelTimeRemainingScaled(int GUIHeight)
  410.     {
  411.         if (this.currentItemBurnTime == 0)
  412.         {
  413.             this.currentItemBurnTime = RecipesCarbonCondenser.getInputSmeltTime(itemslots[0]);
  414.         }
  415.  
  416.         if (this.currentItemBurnTime > 0)
  417.         {
  418.             return this.condenserBurnTime * GUIHeight / this.currentItemBurnTime;
  419.         }
  420.         else
  421.         {
  422.             return 0;
  423.         }
  424.     }
  425.  
  426.     public boolean isBurning()
  427.     {
  428.         return this.condenserBurnTime > 0;
  429.     }
  430.  
  431.     public void updateEntity()
  432.     {
  433.  
  434.         boolean flag = this.condenserBurnTime > 0;
  435.         boolean flag1 = false;
  436.  
  437.         speed = this.getSpeed();
  438.  
  439.         if (this.condenserBurnTime > 0)
  440.         {
  441.             this.condenserBurnTime = this.condenserBurnTime - speed;
  442.         }
  443.  
  444.         if (!this.worldObj.isRemote)
  445.         {
  446.             if (this.canSmelt())
  447.             {
  448.                 // If it is not burning
  449.                 if (!this.isBurning())
  450.                 {
  451.                     double smelt = RecipesCarbonCondenser.getInputSmeltTime(this.itemslots[0]);
  452.                     double burn = RecipesCarbonCondenser.getFuelBurnTime(this.itemslots[1]);
  453.                     double ratio = smelt / burn;
  454.  
  455.                     if ((int) Math.ceil(ratio) <= this.itemslots[1].stackSize)
  456.                     {
  457.                         this.currentItemBurnTime = this.condenserBurnTime = RecipesCarbonCondenser.getFuelBurnTime(this.itemslots[1]) * (int) Math.ceil(ratio);
  458.  
  459.                         if (this.isBurning())
  460.                         {
  461.                             flag1 = true;
  462.  
  463.                             if (this.itemslots[1] != null)
  464.                             {
  465.                                 this.setInventorySlotContents(1, new ItemStack(this.itemslots[1].getItem(), this.itemslots[1].stackSize - (int) Math.ceil(ratio), this.itemslots[1].getItemDamage()));
  466.  
  467.                                 if (this.itemslots[1].stackSize == 0)
  468.                                 {
  469.                                     this.itemslots[1] = this.itemslots[1].getItem().getContainerItem(this.itemslots[1]);
  470.                                 }
  471.                             }
  472.                         }
  473.                     }
  474.                 }
  475.  
  476.                 // If it is burning
  477.                 if (this.isBurning())
  478.                 {
  479.                     this.condenserCookTime = this.condenserCookTime + speed;
  480.  
  481.                     if (this.condenserCookTime >= RecipesCarbonCondenser.getInputSmeltTime(itemslots[0]))
  482.                     {
  483.                         this.condenserCookTime = 0;
  484.                         this.smeltItem();
  485.                         flag1 = true;
  486.                     }
  487.                 }
  488.                 else
  489.                 {
  490.                     this.condenserCookTime = 0;
  491.                 }
  492.             }
  493.  
  494.             // while burning, update block to look burning.
  495.             if (flag != this.condenserBurnTime > 0)
  496.             {
  497.                 flag1 = true;
  498.                 CarbonCondenser.updateBlockState(this.condenserBurnTime > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord);
  499.             }
  500.  
  501.             if (this.isBurning() && this.getStackInSlot(0) == null)
  502.             {
  503.                 this.condenserCookTime = 0;
  504.             }
  505.         }
  506.  
  507.         if (this.getStackInSlot(0) != null && this.getStackInSlot(1) == null && this.isBurning() == false)
  508.         {
  509.             this.condenserCookTime = 0;
  510.         }
  511.  
  512.         if (flag1)
  513.         {
  514.             this.markDirty();
  515.         }
  516.     }
  517.  
  518.     private long getSpeed()
  519.     {
  520.         if (this.getStackInSlot(3) != null)
  521.         {
  522.             double temp = 125 + (this.getStackInSlot(3).stackSize * new Double(125.0 * RecipesCarbonCondenser.getPercentage(this.getStackInSlot(3)) / 100));
  523.             return (long) Math.ceil(temp);
  524.         }
  525.         else
  526.         {
  527.             return 125;
  528.         }
  529.     }
  530.  
  531.     private void smeltItem()
  532.     {
  533.         ItemStack input = this.getStackInSlot(0);
  534.         ItemStack output = this.getStackInSlot(2);
  535.  
  536.         if (this.canSmelt())
  537.         {
  538.             // Input
  539.             int in = input.stackSize - RecipesCarbonCondenser.InputSize(input);
  540.  
  541.             if (in > 0)
  542.             {
  543.                 this.setInventorySlotContents(0, new ItemStack(input.getItem(), in, input.getItemDamage()));
  544.             }
  545.             else
  546.             {
  547.                 this.setInventorySlotContents(0, null);
  548.             }
  549.  
  550.             // Output
  551.             if (output != null)
  552.             {
  553.                 this.setInventorySlotContents(2, new ItemStack(output.getItem(), output.stackSize + RecipesCarbonCondenser.OutputSize(input), RecipesCarbonCondenser.Output(input).getItemDamage()));
  554.             }
  555.             else
  556.             {
  557.                 this.setInventorySlotContents(2, new ItemStack(RecipesCarbonCondenser.Output(input).getItem(), RecipesCarbonCondenser.OutputSize(input), RecipesCarbonCondenser.Output(input).getItemDamage()));
  558.             }
  559.  
  560.             markDirty();
  561.         }
  562.     }
  563.  
  564.     private boolean canSmelt()
  565.     {
  566.         ItemStack input = this.getStackInSlot(0);
  567.         ItemStack output = this.getStackInSlot(2);
  568.  
  569.         if (input != null && this.getStackInSlot(1) != null)
  570.         {
  571.             smeltcount = input.stackSize;
  572.             smeltrequire = RecipesCarbonCondenser.InputSize(input);
  573.             fuelcount = RecipesCarbonCondenser.getFuelBurnTime(this.getStackInSlot(1)) * this.getStackInSlot(1).stackSize;
  574.             fuelrequire = RecipesCarbonCondenser.getInputSmeltTime(input);
  575.         }
  576.         else
  577.         {
  578.             smeltcount = 0;
  579.             smeltrequire = 0;
  580.             fuelcount = 0;
  581.             fuelrequire = 0;
  582.         }
  583.  
  584.         if (input != null && smeltcount >= smeltrequire && fuelcount >= fuelrequire && fuelrequire > 0)
  585.         {
  586.             if (output == null || output.getItem() == RecipesCarbonCondenser.Output(input).getItem() && output.stackSize <= (this.getInventoryStackLimit() - RecipesCarbonCondenser.OutputSize(input)))
  587.             {
  588.                 return true;
  589.             }
  590.             else
  591.             {
  592.                 return false;
  593.             }
  594.         }
  595.         else if (input != null && smeltcount >= smeltrequire && this.isBurning())
  596.         {
  597.             if (output == null || output.getItem() == RecipesCarbonCondenser.Output(input).getItem() && output.stackSize <= (this.getInventoryStackLimit() - RecipesCarbonCondenser.OutputSize(input)))
  598.             {
  599.                 return true;
  600.             }
  601.             else
  602.             {
  603.                 return false;
  604.             }
  605.         }
  606.         else
  607.         {
  608.             return false;
  609.         }
  610.     }
  611.  
  612.     /**
  613.      * Updating the Textures
  614.      */
  615.     @Override
  616.     public Packet getDescriptionPacket()
  617.     {
  618.         // also tried running updateCircuitTextures() here with the added worldObj.markBlockForUpdate(xCoord, yCoord, zCoord) but it didn't work :/
  619.        
  620.         NBTTagCompound tag = new NBTTagCompound();
  621.         writeToNBT(tag);
  622.         return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, tag);
  623.     }
  624.  
  625.     @Override
  626.     public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt)
  627.     {
  628.         readFromNBT(pkt.func_148857_g());
  629.     }
  630.  
  631.     public void updateCircuitTextures()
  632.     {
  633.         if (!getWorldObj().isRemote)
  634.         {
  635.             // sets orientation of sides
  636.             if (this.meta == 2)
  637.             {
  638.                 this.left = 5;
  639.                 this.right = 4;
  640.                 this.back = 3;
  641.                 this.top = 1;
  642.                 this.bot = 0;
  643.             }
  644.             else if (this.meta == 3)
  645.             {
  646.                 this.left = 4;
  647.                 this.right = 5;
  648.                 this.back = 2;
  649.                 this.top = 1;
  650.                 this.bot = 0;
  651.             }
  652.             else if (this.meta == 4)
  653.             {
  654.                 this.left = 2;
  655.                 this.right = 3;
  656.                 this.back = 5;
  657.                 this.top = 1;
  658.                 this.bot = 0;
  659.             }
  660.             else if (this.meta == 5)
  661.             {
  662.                 this.left = 3;
  663.                 this.right = 2;
  664.                 this.back = 4;
  665.                 this.top = 1;
  666.                 this.bot = 0;
  667.             }
  668.  
  669.             // Sets circuit textures
  670.  
  671.             // Top Side
  672.             if (this.getStackInSlot(4) != null)
  673.             {
  674.                 if (this.getStackInSlot(4).getItem() == Construct.circuitImport)
  675.                 {
  676.                     this.sTop = 1;
  677.                 }
  678.                 else if (this.getStackInSlot(4).getItem() == Construct.circuitExport)
  679.                 {
  680.                     this.sTop = 2;
  681.                 }
  682.             }
  683.             else
  684.             {
  685.                 this.sTop = 0;
  686.             }
  687.  
  688.             // Left Side
  689.             if (this.getStackInSlot(5) != null)
  690.             {
  691.                 if (this.getStackInSlot(5).getItem() == Construct.circuitImport)
  692.                 {
  693.                     this.sLeft = 1;
  694.                 }
  695.                 else if (this.getStackInSlot(5).getItem() == Construct.circuitExport)
  696.                 {
  697.                     this.sLeft = 2;
  698.                 }
  699.             }
  700.             else
  701.             {
  702.                 this.sLeft = 0;
  703.             }
  704.  
  705.             // Back Side
  706.             if (this.getStackInSlot(6) != null)
  707.             {
  708.                 if (this.getStackInSlot(6).getItem() == Construct.circuitImport)
  709.                 {
  710.                     this.sBack = 1;
  711.                 }
  712.                 else if (this.getStackInSlot(6).getItem() == Construct.circuitExport)
  713.                 {
  714.                     this.sBack = 2;
  715.                 }
  716.             }
  717.             else
  718.             {
  719.                 this.sBack = 0;
  720.             }
  721.  
  722.             // Right Side
  723.             if (this.getStackInSlot(7) != null)
  724.             {
  725.                 if (this.getStackInSlot(7).getItem() == Construct.circuitImport)
  726.                 {
  727.                     this.sRight = 1;
  728.                 }
  729.                 else if (this.getStackInSlot(7).getItem() == Construct.circuitExport)
  730.                 {
  731.                     this.sRight = 2;
  732.                 }
  733.             }
  734.             else
  735.             {
  736.                 this.sRight = 0;
  737.             }
  738.  
  739.             // Bottom Side
  740.             if (this.getStackInSlot(8) != null)
  741.             {
  742.                 if (this.getStackInSlot(8).getItem() == Construct.circuitImport)
  743.                 {
  744.                     this.sBot = 1;
  745.                 }
  746.                 else if (this.getStackInSlot(8).getItem() == Construct.circuitExport)
  747.                 {
  748.                     this.sBot = 2;
  749.                 }
  750.             }
  751.             else
  752.             {
  753.                 this.sBot = 0;
  754.             }
  755.            
  756.             //tried worldObj.markBlockForUpdate(xCoord, yCoord, zCoord) but it didn't work here :/
  757.             markDirty();
  758.         }
  759.     }
  760. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement