コード例 #1
0
 @Override
 public void setFacing(short var1) {
   beforeSetFacing(var1, facing);
   facing = var1;
   NetworkHelper.updateTileEntityField(this, "facing");
   NetworkHelper.announceBlockUpdate(worldObj, xCoord, yCoord, zCoord);
   afterSetFacing(var1);
 }
コード例 #2
0
  @Override
  public void updateEntity() {

    if (!this.created) {
      this.created = true;
      NetworkHelper.requestInitialData(this);
      NetworkHelper.announceBlockUpdate(worldObj, xCoord, yCoord, zCoord);
    }
    super.updateEntity();
    // if (worldObj!=null)
    // worldObj.markBlockForRenderUpdate(xCoord,  yCoord,  zCoord);
  }
コード例 #3
0
 @Override
 protected void actionPerformed(GuiButton button) {
   switch (button.id) {
     case ID_COLORS:
       GuiScreen colorGui = new GuiScreenColor(this, container.panel);
       mc.displayGuiScreen(colorGui);
       break;
     case ID_SETTINGS:
       ItemStack card = getActiveCard();
       if (card == null) return;
       if (card != null && card.getItem() instanceof IAdvancedCardSettings) {
         ICardWrapper helper = new CardWrapperImpl(card, activeTab);
         Object guiObject = ((IAdvancedCardSettings) card.getItem()).getSettingsScreen(helper);
         if (!(guiObject instanceof GuiScreen)) {
           FMLLog.warning("Invalid card, getSettingsScreen method should return GuiScreen object");
           return;
         }
         GuiScreen gui = (GuiScreen) guiObject;
         ICardSettingsWrapper wrapper =
             new CardSettingsWrapperImpl(card, container.panel, this, activeTab);
         ((ICardGui) gui).setCardSettingsHelper(wrapper);
         mc.displayGuiScreen(gui);
       }
       break;
     case ID_LABELS:
       boolean checked = !container.panel.getShowLabels();
       if (button instanceof IconButton) {
         IconButton iButton = (IconButton) button;
         iButton.textureTop = getIconLabelsTopOffset(checked);
       }
       int value = checked ? -1 : -2;
       container.panel.setShowLabels(checked);
       NetworkHelper.initiateClientTileEntityEvent(container.panel, value);
       break;
     case ID_POWER:
       byte mode = ((TileEntityAdvancedInfoPanel) container.panel).getNextPowerMode();
       if (button instanceof IconButton) {
         IconButton iButton = (IconButton) button;
         iButton.textureTop = getIconPowerTopOffset(mode);
       }
       NetworkHelper.initiateClientTileEntityEvent(container.panel, mode);
       break;
     case ID_SLOPE:
       GuiPanelSlope slopeGui =
           new GuiPanelSlope(this, (TileEntityAdvancedInfoPanel) container.panel);
       mc.displayGuiScreen(slopeGui);
       break;
   }
 }
コード例 #4
0
 @Override
 public boolean mousePressed(Minecraft minecraft, int i, int j) {
   if (super.mousePressed(minecraft, i, j)) {
     checked = !checked;
     int value = checked ? -1 : -2;
     panel.setShowLabels(checked);
     NetworkHelper.initiateClientTileEntityEvent(panel, value);
     return true;
   } else {
     return false;
   }
 }
コード例 #5
0
 public void setWorking(boolean value) {
   isWorking = value;
   NetworkHelper.updateTileEntityField(this, "isWorking");
 }
コード例 #6
0
  @Override
  public void updateEntity() {
    boolean flag = false;
    if (!this.initnal && this.worldObj != null) {
      if (this.worldObj.isRemote) {
        NetworkHelper.requestInitialData(this);
      } else {
        MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
        this.initnal = true;
      }
    }

    if (this.storage > 0) {
      if (this.storage - 16 > 0) {
        this.production = sendEnergy(16);
        this.storage -= 16;
      } else {
        this.production = sendEnergy(this.storage);
        this.storage = 0;
      }
      PacketDispatcher.sendPacketToServer(ClientPacketHandler.sendPacket(this));
    }

    if (isWorking()) {
      if (production > 0) {
        this.storage = this.storage + this.production;
        this.production = 0;
      }
      this.waitTime--;
      if (this.waitTime <= 0 && !this.worldObj.isRemote) {
        if (this.inv[0].getItemDamage() == Atoms.HYDROGEN.id
            && this.inv[1].getItemDamage() == Atoms.OXYGEN.id) {
          this.inv[0] = delSlot(this.inv[0]);
          this.inv[1] = delSlot(this.inv[1]);
          addSlot(new ItemStack(KagacraftItems.testTube, 1), 2);
          addSlot(new ItemStack(KagacraftItems.testTube, 1), 3);
          this.production = sendEnergy(this.hatuden);

          PacketDispatcher.sendPacketToServer(ClientPacketHandler.sendPacket(this));
          flag = true;
        }
        this.waitTime = 0;
      }
      if (this.inv[0] == null || this.inv[1] == null) {
        this.waitTime = 0;
      }
    } else if (this.inv[0] != null
        && this.inv[1] != null
        && this.inv[0].itemID == KagacraftItems.elements.itemID
        && this.inv[1].itemID == KagacraftItems.elements.itemID) {
      if (this.inv[0].getItemDamage() == Atoms.HYDROGEN.id
          && this.inv[1].getItemDamage() == Atoms.OXYGEN.id) {
        if (this.storage + this.hatuden < this.maxStorage) {
          this.waitTime = this.maxWaitTime;
        }
      }
    }

    if (flag) {
      this.onInventoryChanged();
    }
  }