Search in sources :

Example 1 with AGenerator

use of me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AGenerator in project GlobalWarming by poma123.

the class PollutionListener method onMachineOperationComplete.

@EventHandler
public void onMachineOperationComplete(AsyncMachineOperationFinishEvent e) {
    World world = e.getPosition().getWorld();
    if (!GlobalWarmingPlugin.getRegistry().isWorldEnabled(world.getName())) {
        return;
    }
    if (e.getProcessor() == null) {
        return;
    }
    String id = null;
    ItemStack[] inputs = new ItemStack[] {};
    if ((e.getProcessor().getOwner() instanceof Reactor || e.getProcessor().getOwner() instanceof AGenerator) && e.getOperation() instanceof FuelOperation) {
        id = e.getProcessor().getOwner().getId();
        FuelOperation operation = (FuelOperation) e.getOperation();
        inputs = new ItemStack[] { operation.getIngredient() };
    } else if (e.getProcessor().getOwner() instanceof AContainer && e.getOperation() instanceof CraftingOperation) {
        id = e.getProcessor().getOwner().getId();
        CraftingOperation operation = (CraftingOperation) e.getOperation();
        inputs = operation.getIngredients();
    }
    if (id != null) {
        risePollutionTry(world, id, inputs);
        descendPollutionTry(world, id);
    }
}
Also used : AGenerator(me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AGenerator) CraftingOperation(io.github.thebusybiscuit.slimefun4.implementation.operations.CraftingOperation) FuelOperation(io.github.thebusybiscuit.slimefun4.implementation.operations.FuelOperation) AContainer(me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer) World(org.bukkit.World) ItemStack(org.bukkit.inventory.ItemStack) Reactor(io.github.thebusybiscuit.slimefun4.implementation.items.electric.reactors.Reactor) EventHandler(org.bukkit.event.EventHandler)

Aggregations

Reactor (io.github.thebusybiscuit.slimefun4.implementation.items.electric.reactors.Reactor)1 CraftingOperation (io.github.thebusybiscuit.slimefun4.implementation.operations.CraftingOperation)1 FuelOperation (io.github.thebusybiscuit.slimefun4.implementation.operations.FuelOperation)1 AContainer (me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer)1 AGenerator (me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AGenerator)1 World (org.bukkit.World)1 EventHandler (org.bukkit.event.EventHandler)1 ItemStack (org.bukkit.inventory.ItemStack)1