@Override
 public CategoryConfigManagerBuilder getConfig() {
   return new CategoryConfigManagerBuilder("Other")
       .addValue(
           "enableAnimalAITweak",
           "true",
           Type.BOOLEAN,
           "Enable changing the animals AI to make them run from their attackers.",
           property -> {
             if (property.getBoolean()) {
               if (aiManager == null) {
                 aiManager = new AITweaksManager();
                 MinecraftForge.EVENT_BUS.register(aiManager);
               }
             } else {
               if (aiManager != null) {
                 MinecraftForge.EVENT_BUS.unregister(aiManager);
                 aiManager = null;
               }
             }
           })
       .addValue(
           "enableNonSolidLeaves",
           "true",
           Type.BOOLEAN,
           "Enable tweak to make leaves blocks non-solid (like vines).",
           property -> {
             Hea3venTweaks.setConfig(
                 "NonSolidLeaves.enabled", Boolean.toString(property.getBoolean()));
           },
           true,
           true);
 }
Ejemplo n.º 2
0
  @EventHandler
  public void preInit(FMLPreInitializationEvent event) {
    config = new Configuration(event.getSuggestedConfigurationFile()); // gets default config file

    this.instance = this;

    FMLCommonHandler.instance().bus().register(worldgen);
    MinecraftForge.EVENT_BUS.register(worldgen);

    FMLCommonHandler.instance().bus().register(versionChecker);
    MinecraftForge.EVENT_BUS.register(versionChecker);

    FMLCommonHandler.instance().bus().register(this);
    MinecraftForge.EVENT_BUS.register(this);

    ClientCommandHandler.instance.registerCommand(new VersionCommand());

    fluids.setupFluids();
    fluids.setupFluidBlocks();
    items.setupItems();
    items.registerItems();
    items.registerItemsOreDict();
    blocks.setupBlocks();
    blocks.registerBlocks();
    blocks.registerBlocksOreDict();
    blocks.setupHarvestLevels();
    recipes.setupShapelessCrafting();
    recipes.setupShapedCrafting();
    recipes.setupSmelting();
    worldgen.setupWorldgen();
    mobs.setupMobs();
    proxy.registerRenderers();
  }
Ejemplo n.º 3
0
  @Override
  public void registerHandlers() {
    OreDicHandler.registerWildCards();
    MaricultureHandlers.biomeType = new BiomeTypeHandler();
    MaricultureHandlers.smelter = new LiquifierHandler();
    MaricultureHandlers.casting = new IngotCastingHandler();
    MaricultureHandlers.vat = new VatHandler();
    MaricultureHandlers.anvil = new TileAnvil();
    MaricultureHandlers.upgrades = new UpgradeHandler();
    MaricultureHandlers.modules = new ModulesHandler();
    GameRegistry.registerFuelHandler(new FuelHandler());
    GameRegistry.registerWorldGenerator(new WorldGenHandler(), 1);
    MinecraftForge.EVENT_BUS.register(new GuiItemToolTip());
    MinecraftForge.EVENT_BUS.register(new OreDicHandler());
    FMLCommonHandler.instance().bus().register(new ServerFMLEvents());
    FMLCommonHandler.instance().bus().register(new ClientFMLEvents());
    if (RetroGeneration.ENABLED) MinecraftForge.EVENT_BUS.register(new RetroGen());

    // Initalise our Side Helper
    List<Integer> sides = new ArrayList<Integer>();
    for (int i = 0; i < 6; i++) {
      sides.add(i);
    }

    BlockTransferHelper.sides = sides;
  }
Ejemplo n.º 4
0
  /** Called each tick so GUIs can handle their input. */
  @Override
  public void handleInput() throws IOException {
    if (Mouse.isCreated()) {
      while (Mouse.next()) {
        if (!MinecraftForge.EVENT_BUS.post(
            new net.minecraftforge.client.event.GuiScreenEvent.MouseInputEvent.Pre(this))) {
          this.handleMouseInput();
          if (this.equals(this.mc.currentScreen)) {
            MinecraftForge.EVENT_BUS.post(
                new net.minecraftforge.client.event.GuiScreenEvent.MouseInputEvent.Post(this));
          }
        }
      }
    }

    if (Keyboard.isCreated()) {
      while (Keyboard.next()) {
        if (!MinecraftForge.EVENT_BUS.post(
            new net.minecraftforge.client.event.GuiScreenEvent.KeyboardInputEvent.Pre(this))) {
          this.handleKeyboardInput();
          if (this.equals(this.mc.currentScreen)) {
            MinecraftForge.EVENT_BUS.post(
                new net.minecraftforge.client.event.GuiScreenEvent.KeyboardInputEvent.Post(this));
          }
        }
      }
    }
  }
  @Mod.EventHandler
  public void init(FMLInitializationEvent event) {
    MinecraftForge.EVENT_BUS.register(instance);
    MinecraftForge.EVENT_BUS.register(proxy);
    NetworkRegistry.instance().registerGuiHandler(instance, new ExplorationGuiHandler());

    proxy.init();
  }
Ejemplo n.º 6
0
 public void render(HashMap<String, Object> passedInformation) {
   // TODO: Do not re-render components if nothing changed (like Swing doesn't) to reduce lag.
   for (ScreenLayer layer : guiLayers) {
     MinecraftForge.EVENT_BUS.post(new LayerEvent.Render(GUIAPIEvent.Phase.START, layer));
     layer.render(passedInformation);
     MinecraftForge.EVENT_BUS.post(new LayerEvent.Render(GUIAPIEvent.Phase.END, layer));
   }
 }
 public void tryCheckUseItem(ItemStack offhand, EntityPlayer player) {
   MovingObjectPosition mouseOver = mc.objectMouseOver;
   boolean flag = true;
   if (mouseOver != null && mouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
     BlockPos pos = mouseOver.getBlockPos();
     if (!player.worldObj.getBlockState(pos).getBlock().isAir(player.worldObj, pos)) {
       final int size = offhand.stackSize;
       EnumFacing i1 = mouseOver.sideHit;
       PlayerEventChild.UseOffhandItemEvent useItemEvent =
           new PlayerEventChild.UseOffhandItemEvent(
               new PlayerInteractEvent(
                   player, PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, pos, i1, player.worldObj),
               offhand);
       if (!MinecraftForge.EVENT_BUS.post(useItemEvent)) {
         BattlegearUtils.refreshAttributes(player, false);
         boolean result =
             onPlayerPlaceBlock(
                 mc.playerController, player, useItemEvent.offhand, pos, i1, mouseOver.hitVec);
         BattlegearUtils.refreshAttributes(player, true);
         if (result) {
           if (useItemEvent.swingOffhand)
             BattlegearUtils.sendOffSwingEvent(useItemEvent.event, useItemEvent.offhand);
           flag = false;
         }
       }
       if (useItemEvent.offhand.stackSize == 0) {
         BattlegearUtils.setPlayerOffhandItem(player, null);
       } else if (useItemEvent.offhand.stackSize != size
           || mc.playerController.isInCreativeMode()) {
         ((IOffhandRender) mc.entityRenderer.itemRenderer).setEquippedProgress(0.0F);
       }
     }
   }
   if (flag) {
     offhand = ((InventoryPlayerBattle) player.inventory).getCurrentOffhandWeapon();
     PlayerEventChild.UseOffhandItemEvent useItemEvent =
         new PlayerEventChild.UseOffhandItemEvent(
             new PlayerInteractEvent(
                 player,
                 PlayerInteractEvent.Action.RIGHT_CLICK_AIR,
                 new BlockPos(0, 0, 0),
                 null,
                 player.worldObj),
             offhand);
     if (offhand != null && !MinecraftForge.EVENT_BUS.post(useItemEvent)) {
       if (!mc.playerController.isSpectatorMode()) {
         BattlegearUtils.refreshAttributes(player, false);
         flag = BattlemodeHookContainerClass.tryUseItem(player, useItemEvent.offhand, Side.CLIENT);
         BattlegearUtils.refreshAttributes(player, true);
         if (flag) {
           if (useItemEvent.swingOffhand)
             BattlegearUtils.sendOffSwingEvent(useItemEvent.event, useItemEvent.offhand);
           ((IOffhandRender) mc.entityRenderer.itemRenderer).setEquippedProgress(0.0F);
         }
       }
     }
   }
 }
Ejemplo n.º 8
0
 @Override
 public void registerEventHandlers() {
   super.registerEventHandlers();
   WMClientEventHandler eventhandler = new WMClientEventHandler();
   FMLCommonHandler.instance().bus().register(eventhandler);
   MinecraftForge.EVENT_BUS.register(eventhandler);
   MinecraftForge.EVENT_BUS.register(
       new GuiOverlayReloaded(FMLClientHandler.instance().getClient()));
 }
Ejemplo n.º 9
0
  public void onPickupFromSlot(EntityPlayer var1, ItemStack var2) {
    this.onCrafting(var2);
    int var3;
    ItemStack var4;
    ItemStack var5;

    for (var3 = 0; var3 < this.craftMatrix.getSizeInventory(); ++var3) {
      var4 = this.craftMatrix.getStackInSlot(var3);

      if (var4 != null) {
        this.craftMatrix.decrStackSize(var3, 1);

        if (var4.getItem().hasContainerItem()) {
          var5 = var4.getItem().getContainerItemStack(var4);

          if (var5.isItemStackDamageable() && var5.getItemDamage() > var5.getMaxDamage()) {
            MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(this.thePlayer, var5));
            var5 = null;
          }

          if (var5 != null
              && (!var4.getItem().doesContainerItemLeaveCraftingGrid(var4)
                  || !this.thePlayer.inventory.addItemStackToInventory(var5))) {
            if (this.craftMatrix.getStackInSlot(var3) == null) {
              this.craftMatrix.setInventorySlotContents(var3, var5);
            } else {
              this.thePlayer.dropPlayerItem(var5);
            }
          }
        }
      }
    }

    for (var3 = 0; var3 < this.recipe.getSizeInventory(); ++var3) {
      var4 = this.recipe.getStackInSlot(var3);

      if (var4 != null && var4.getItem().hasContainerItem()) {
        var5 = var4.getItem().getContainerItemStack(var4);

        if (var5.isItemStackDamageable() && var5.getItemDamage() > var5.getMaxDamage()) {
          MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(this.thePlayer, var5));
          var5 = null;
        }

        if (var5 != null
            && (!var4.getItem().doesContainerItemLeaveCraftingGrid(var4)
                || !this.thePlayer.inventory.addItemStackToInventory(var5))) {
          if (this.recipe.getStackInSlot(var3) == null) {
            this.recipe.setInventorySlotContents(var3, var5);
          } else {
            this.thePlayer.dropPlayerItem(var5);
          }
        }
      }
    }
  }
Ejemplo n.º 10
0
  @EventHandler
  public void preLoad(FMLPreInitializationEvent event) {
    snw = NetworkRegistry.INSTANCE.newSimpleChannel(modid);
    snw.registerMessage(TimeTravelerPacketHandler.class, Message.class, 0, Side.CLIENT);

    FMLCommonHandler.instance().bus().register(new TTEventHandler());
    FMLCommonHandler.instance().bus().register(new Ticker());
    MinecraftForge.EVENT_BUS.register(new TTEventHandler());
    MinecraftForge.EVENT_BUS.register(new Ticker());
  }
Ejemplo n.º 11
0
 @Override
 public TreeBranch init(TreeBranch superBranch, String label) {
   this.superBranch = superBranch;
   this.label = label;
   MinecraftForge.EVENT_BUS.post(new TreeBranchInitEvent(EventPeriod.BEFORE, this));
   addLeaf(((LeafInteger) new LeafInteger().init(this, -1, "Drop ID")).setMin(-1).setMax(32000));
   addLeaf(((LeafInteger) new LeafInteger().init(this, -1, "Drop Metadata")).setMin(0));
   addLeaf(((LeafInteger) new LeafInteger().init(this, 1, "Drop Count Min")).setMin(0).setMax(64));
   addLeaf(((LeafInteger) new LeafInteger().init(this, 1, "Drop Count Max")).setMin(0).setMax(64));
   MinecraftForge.EVENT_BUS.post(new TreeBranchInitEvent(EventPeriod.AFTER, this));
   return this;
 }
 protected void generateVenus() {
   MinecraftForge.EVENT_BUS.post(
       new GCCoreEventPopulate.Pre(this.worldObj, this.randomGenerator, this.chunkX, this.chunkZ));
   this.genStandardOre1(20, this.dirtGen, 0, 200);
   //        this.genStandardOre1(26, this.gemGen, 0, 60);
   //        this.genStandardOre1(36, this.coalGen, 0, 128);
   //        this.genStandardOre1(35, this.tinGen, 0, 128);
   //        this.genStandardOre1(36, this.copperGen, 0, 128);
   MinecraftForge.EVENT_BUS.post(
       new GCCoreEventPopulate.Post(
           this.worldObj, this.randomGenerator, this.chunkX, this.chunkZ));
 }
Ejemplo n.º 13
0
  /**
   * Called to initialize and setup everything. TODO: This should be handled better if possible.
   *
   * @param minecraft Minecraft instance.
   * @param width New window width.
   * @param height New window height.
   */
  @Override
  public void setWorldAndResolution(Minecraft minecraft, int width, int height) {
    this.mc = minecraft;
    this.itemRender = minecraft.getRenderItem();
    this.fontRenderer = minecraft.fontRendererObj;
    this.width = width;
    this.height = height;
    if (!MinecraftForge.EVENT_BUS.post(new GUIScreenEvent.InitGuiEvent.Pre(this))) {
      this.initGui();
    }

    MinecraftForge.EVENT_BUS.post(new GUIScreenEvent.InitGuiEvent.Post(this));
  }
Ejemplo n.º 14
0
  public void load() {
    Mw mw = new Mw(this.config);
    MinecraftForge.EVENT_BUS.register(new EventHandler(mw));

    Object eventhandler = new MwKeyHandler();
    FMLCommonHandler.instance().bus().register(eventhandler);
    MinecraftForge.EVENT_BUS.register(eventhandler);

    // temporary workaround for user defined key bindings not being loaded
    // at game start. see https://github.com/MinecraftForge/FML/issues/378
    // for more info.
    Minecraft.getMinecraft().gameSettings.loadOptions();
  }
Ejemplo n.º 15
0
  // TODO: Deal with duplicates. Can't use Traits sadly.
  public void keyboardInput() {
    HashMap<String, Object> passedInformation = new HashMap<String, Object>(0);
    passedInformation.put("character", Keyboard.getEventCharacter());
    passedInformation.put("key", Keyboard.getEventKey());
    passedInformation.put("down", Keyboard.getEventKeyState());
    passedInformation.put("time", Keyboard.getEventNanoseconds());
    passedInformation.put("count", Keyboard.getKeyCount());

    for (ScreenLayer layer : guiLayers) {
      MinecraftForge.EVENT_BUS.post(new LayerEvent.KeyboardInput(GUIAPIEvent.Phase.START, layer));
      layer.keyInputEvent(passedInformation);
      MinecraftForge.EVENT_BUS.post(new LayerEvent.KeyboardInput(GUIAPIEvent.Phase.END, layer));
    }
  }
  @EventHandler
  public void preInit(FMLPreInitializationEvent event) {
    ConfigHandler.init(event.getSuggestedConfigurationFile());

    ModItem.init();
    ModBlock.init();
    ModTile.init();

    MinecraftForge.EVENT_BUS.register(new EntityLivingHandler());
    MinecraftForge.EVENT_BUS.register(new EntityPlayerHandler());

    proxy.initSounds();
    proxy.initRenderers();
  }
  @SuppressWarnings("unchecked")
  @Init
  public void load(FMLInitializationEvent event) {

    // Register the GUI Handler
    NetworkRegistry.instance().registerGuiHandler(instance, proxy);

    // Register the PlayerDestroyItem Handler
    MinecraftForge.EVENT_BUS.register(new PlayerDestroyItemHandler());

    // Register the Item Pickup Handler
    MinecraftForge.EVENT_BUS.register(new ItemEventHandler());

    // Register the EntityLiving Handler
    MinecraftForge.EVENT_BUS.register(new EntityLivingHandler());

    MinecraftForge.EVENT_BUS.register(new ActionRequestHandler());

    MinecraftForge.EVENT_BUS.register(new WorldTransmutationHandler());

    GameRegistry.registerCraftingHandler(new CraftingHandler());

    // Register the DrawBlockHighlight Handler
    proxy.registerDrawBlockHighlightHandler();

    // Initialize mod tile entities
    proxy.registerTileEntities();

    // Initialize custom rendering and pre-load textures (Client only)
    proxy.initRenderingAndTextures();

    // Add in the ability to dye Alchemical Bags
    CraftingManager.getInstance().getRecipeList().add(new RecipesAlchemicalBagDyes());

    // Register the Fuel Handler
    GameRegistry.registerFuelHandler(new FuelHandler());

    // Quick test to see that sending an encoded recipe to be added to the recipe registry works
    FMLInterModComms.sendMessage(
        Reference.MOD_ID,
        InterModComms.ADD_RECIPE,
        NBTHelper.encodeRecipeAsNBT(
            Item.bucketWater, Arrays.asList(Item.bucketEmpty, Block.waterStill)));
    FMLInterModComms.sendMessage(
        Reference.MOD_ID,
        InterModComms.ADD_RECIPE,
        NBTHelper.encodeRecipeAsNBT(
            Item.bucketLava, Arrays.asList(Item.bucketEmpty, Block.lavaStill)));
  }
 public static void init(FMLPreInitializationEvent event) {
   // Init
   boolean isRender = getRenderSetting(event.getSuggestedConfigurationFile());
   mc = Minecraft.getMinecraft();
   chatHandler = new ChatHandler();
   entityKillHandler = new EntityKillHandler();
   renderHandler = new RenderHandler(mc, isRender);
   keyInputHandler = new KeyInputHandler(renderHandler, event.getSuggestedConfigurationFile());
   KeyBindler.init();
   // Register handlers
   MinecraftForge.EVENT_BUS.register(chatHandler);
   MinecraftForge.EVENT_BUS.register(entityKillHandler);
   MinecraftForge.EVENT_BUS.register(renderHandler);
   FMLCommonHandler.instance().bus().register(keyInputHandler);
 }
 public ItemElectricBootsTraveller(int id, int par3, int par4) {
   super(id, EnumArmorMaterial.DIAMOND, par3, par4);
   this.setMaxDamage(27);
   this.setMaxStackSize(1);
   this.setCreativeTab(CreativeTab.tabTombenpotter);
   if (ticks()) MinecraftForge.EVENT_BUS.register(this);
 }
Ejemplo n.º 20
0
  @EventHandler
  public void preInit(FMLPreInitializationEvent event) {
    weaponSpear =
        new WeaponSpear()
            .setUnlocalizedName("weaponSpear")
            .setTextureName(References.MODID + ":weaponSpear")
            .setCreativeTab(this.tabArkCraft);
    itemLongneckRifle =
        new ItemLongneckRifle()
            .setUnlocalizedName("itemLongneckRifle")
            .setTextureName(References.MODID + ":itemLongneckRifle")
            .setCreativeTab(this.tabArkCraft);

    GameRegistry.registerItem(weaponSpear, "weapon_spear");
    GameRegistry.registerItem(itemLongneckRifle, "itemLongneckRifle");

    blockWoodenDoor = new BlockWoodenDoor(Material.wood).setBlockName("blockWoodenDoor");

    GameRegistry.registerBlock(blockWoodenDoor, "blockWoodenDoor");

    if (event.getSide().isClient()) {
      FMLCommonHandler.instance().bus().register(new TickClientHandlerEvent());
      MinecraftForge.EVENT_BUS.register(new TickClientHandlerEvent());
    }
  }
Ejemplo n.º 21
0
 /**
  * Causes the screen to lay out its subcomponents again. This is the equivalent of the Java call
  * Container.validate()
  */
 public void setWorldAndResolution(Minecraft mc, int width, int height) {
   this.mc = mc;
   this.itemRender = mc.getRenderItem();
   this.fontRendererObj = mc.fontRendererObj;
   this.width = width;
   this.height = height;
   if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(
       new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Pre(
           this, this.buttonList))) {
     this.buttonList.clear();
     this.initGui();
   }
   net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(
       new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Post(
           this, this.buttonList));
 }
 public void onLoaded() {
   if (!this.worldObj.isRemote) {
     MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
     this.addedToEnergyNet = true;
   }
   this.loaded = true;
 }
Ejemplo n.º 23
0
 @Mod.EventHandler
 public void init(FMLInitializationEvent event) {
   instance = this;
   proxy.registerEvents();
   NetworkRegistry.INSTANCE.registerGuiHandler(this, guiHandler);
   MinecraftForge.EVENT_BUS.register(this);
 }
Ejemplo n.º 24
0
  public void sendThisChunkToPlayer(EntityPlayerMP par1EntityPlayerMP) {
    if (this.playersInChunk.contains(par1EntityPlayerMP)) {
      par1EntityPlayerMP.playerNetServerHandler.sendPacketToPlayer(
          new Packet51MapChunk(
              PlayerManager.getWorldServer(this.thePlayerManager)
                  .getChunkFromChunkCoords(
                      this.chunkLocation.chunkXPos, this.chunkLocation.chunkZPos),
              true,
              0));
      this.playersInChunk.remove(par1EntityPlayerMP);
      par1EntityPlayerMP.loadedChunks.remove(this.chunkLocation);

      MinecraftForge.EVENT_BUS.post(new ChunkWatchEvent.UnWatch(chunkLocation, par1EntityPlayerMP));

      if (this.playersInChunk.isEmpty()) {
        long i =
            (long) this.chunkLocation.chunkXPos + 2147483647L
                | (long) this.chunkLocation.chunkZPos + 2147483647L << 32;
        PlayerManager.getChunkWatchers(this.thePlayerManager).remove(i);

        if (this.numberOfTilesToUpdate > 0) {
          PlayerManager.getChunkWatchersWithPlayers(this.thePlayerManager).remove(this);
        }

        this.thePlayerManager
            .getWorldServer()
            .theChunkProviderServer
            .unloadChunksIfNotNearSpawn(this.chunkLocation.chunkXPos, this.chunkLocation.chunkZPos);
      }
    }
  }
 @Override
 public void onChunkUnload() {
   if (addedToEnergyNet) {
     MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
     addedToEnergyNet = false;
   }
 }
Ejemplo n.º 26
0
  @Override
  protected void onCrafting(ItemStack par1ItemStack) {
    par1ItemStack.onCrafting(thePlayer.worldObj, thePlayer, stackSize);

    if (!thePlayer.worldObj.isRemote) {
      int i = stackSize;
      float f = MaterializerRecipes.instance().getExperience(par1ItemStack);
      int j;

      if (f == 0.0F) i = 0;
      else if (f < 1.0F) {
        j = MathHelper.floor_float(i * f);

        if (j < MathHelper.ceiling_float_int(i * f) && (float) Math.random() < i * f - j) ++j;

        i = j;
      }

      while (i > 0) {
        j = EntityXPOrb.getXPSplit(i);
        i -= j;
        thePlayer.worldObj.spawnEntityInWorld(
            new EntityXPOrb(
                thePlayer.worldObj,
                thePlayer.posX,
                thePlayer.posY + 0.5D,
                thePlayer.posZ + 0.5D,
                j));
      }
    }

    stackSize = 0;

    MinecraftForge.EVENT_BUS.post(new ACEvents.ItemMaterializedEvent(thePlayer, par1ItemStack));
  }
 public TileEntityProgrammableController() {
   super(5, 7, 5000);
   inventory = new ItemStack[INVENTORY_SIZE];
   //    setUpgradeSlots(new int[]{UPGRADE_SLOT_START, 1, 2, UPGRADE_SLOT_END});
   setUpgradeSlots(new int[] {1, 2, 3, 4});
   MinecraftForge.EVENT_BUS.post(new DroneConstructingEvent(this));
 }
Ejemplo n.º 28
0
  @Override
  public void onUpdate() {
    super.onUpdate();

    if (FMLCommonHandler.instance().getEffectiveSide().isServer()) {
      if (transferDelay == 0) {
        didTransfer = false;
      } else {
        transferDelay--;
      }

      int stored = fluidStored != null ? fluidStored.amount : 0;

      if (stored != prevStored) {
        needsUpdate = true;
      }

      prevStored = stored;

      if (didTransfer != prevTransfer || needsUpdate) {
        MinecraftForge.EVENT_BUS.post(new FluidTransferEvent(this, fluidStored, didTransfer));
        needsUpdate = false;
      }

      prevTransfer = didTransfer;

      if (fluidStored != null) {
        fluidStored.amount -= tickEmit(fluidStored, true);

        if (fluidStored != null && fluidStored.amount <= 0) {
          fluidStored = null;
        }
      }
    }
  }
  /**
   * Plays a sound effect with the volume and pitch of the parameters passed. The sound isn't
   * affected by position of the player (full volume and center balanced)
   */
  public void playSoundFX(String par1Str, float par2, float par3) {
    if (this.loaded && this.options.soundVolume != 0.0F) {
      SoundPoolEntry soundpoolentry = this.soundPoolSounds.getRandomSoundFromSoundPool(par1Str);
      soundpoolentry =
          SoundEvent.getResult(new PlaySoundEffectEvent(this, soundpoolentry, par1Str, par2, par3));

      if (soundpoolentry != null && par2 > 0.0F) {
        this.latestSoundID = (this.latestSoundID + 1) % 256;
        String s1 = "sound_" + this.latestSoundID;
        this.sndSystem.newSource(
            false,
            s1,
            soundpoolentry.getSoundUrl(),
            soundpoolentry.getSoundName(),
            false,
            0.0F,
            0.0F,
            0.0F,
            0,
            0.0F);

        if (par2 > 1.0F) {
          par2 = 1.0F;
        }

        par2 *= 0.25F;
        this.sndSystem.setPitch(s1, par3);
        this.sndSystem.setVolume(s1, par2 * this.options.soundVolume);
        MinecraftForge.EVENT_BUS.post(new PlaySoundEffectSourceEvent(this, s1));
        this.sndSystem.play(s1);
      }
    }
  }
 public void onUnloaded() {
   if (!this.worldObj.isRemote && this.addedToEnergyNet) {
     MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
     this.addedToEnergyNet = false;
   }
   this.loaded = false;
 }