Example #1
0
  @Override
  public void updateEntity(World world) {
    super.updateEntity(world);
    if (world.isRemote) {
      return;
    }
    filledFromThisTick.clear();
    updateStartPushDir();
    doExtract();

    if (stateDirty) {
      getBundle().dirty();
      stateDirty = false;
      lastSyncRatio = tank.getFilledRatio();

    } else if ((lastSyncRatio != tank.getFilledRatio() && world.getTotalWorldTime() % 2 == 0)) {

      // need to send a custom packet as we don't want want to trigger a full chunk update, just
      // need to get the required  values to the entity renderer
      BlockCoord loc = getLocation();
      PacketHandler.INSTANCE.sendToAllAround(
          new PacketFluidLevel(this),
          new TargetPoint(world.provider.dimensionId, loc.x, loc.y, loc.z, 64));
      lastSyncRatio = tank.getFilledRatio();
    }
  }
Example #2
0
 @Override
 public void actionPerformed(GuiButton guiButton) {
   super.actionPerformed(guiButton);
   if (guiButton.id == ID_COLOR_BUTTON && cb != null) {
     occon.setSignalColor(gui.getDir(), DyeColor.values()[cb.getColorIndex()]);
     PacketHandler.INSTANCE.sendToServer(new PacketOCConduitSignalColor(occon, gui.getDir()));
   }
 }
Example #3
0
  public static BlockWirelessCharger create() {

    PacketHandler.INSTANCE.registerMessage(
        PacketStoredEnergy.class, PacketStoredEnergy.class, PacketHandler.nextID(), Side.CLIENT);

    BlockWirelessCharger res = new BlockWirelessCharger();
    res.init();
    return res;
  }
Example #4
0
 @Override
 protected void actionPerformed(GuiButton b) {
   super.actionPerformed(b);
   if (b.id >= 0 && b.id <= 2) {
     getTileEntity().startTask(b.id);
     PacketHandler.INSTANCE.sendToServer(
         new PacketActivateWeather(getTileEntity(), WeatherTask.values()[b.id]));
   }
 }