Ejemplo n.º 1
0
  public void updateEntity() {
    if (worldObj.isRemote) {
      updateCoolDown++;

      if (updateCoolDown == 600) {
        this.validate();
        updateCoolDown = 0;
      }
    }

    if (!worldObj.isRemote) {
      ForgeDirection d;
      SocketModule m;
      SideConfig c;
      for (int i = 0; i < 6; i++) {
        d = ForgeDirection.getOrientation(i);
        m = getSide(d);
        c = configs[i];

        /*if(m.pullsFromHopper())
        {
        	int xo = xCoord + d.offsetX;
        	int yo = yCoord + d.offsetY;
        	int zo = zCoord + d.offsetZ;

        	TileEntity t = worldObj.getBlockTileEntity(xo, yo, zo);

        	if(t != null && t instanceof TileEntityHopper)
        	{
        		TileEntityHopper th = (TileEntityHopper)t;

        		for (int j = 0; j < th.getSizeInventory(); ++j)
                   {
                       if (th.getStackInSlot(j) != null)
                       {
                           ItemStack itemstack = th.getStackInSlot(j).copy();
                           itemstack.stackSize = 1;
                           int added =  addItem(itemstack, true, d);

                           itemstack.stackSize = th.getStackInSlot(j).stackSize - added;
                           if(itemstack.stackSize <= 0) itemstack = null;

                           th.setInventorySlotContents(j, itemstack);
                           break;
                       }
                   }
               }
        }*/
        m.updateSide(c, this, d);
      }
    }

    if (!initialized && worldObj != null) {
      if (!worldObj.isRemote) {
        /*EnergyTileLoadEvent loadEvent = new EnergyTileLoadEvent(this);
        MinecraftForge.EVENT_BUS.post(loadEvent);
        this.addedToEnergyNet = true;*/

        sideID = new int[6];
        sideMeta = new int[6];

        for (int i = 0; i < 6; i++) {
          sideID[i] = -1;
          sideMeta[i] = -1;

          checkSideForChange(i);
        }
      }

      initialized = true;
    }
  }