Search in sources :

Example 1 with MachineFuel

use of me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineFuel in project Slimefun4 by Slimefun.

the class ProgrammableAndroid method consumeFuel.

@ParametersAreNonnullByDefault
private void consumeFuel(Block b, BlockMenu menu) {
    ItemStack item = menu.getItemInSlot(43);
    if (item != null && item.getType() != Material.AIR) {
        for (MachineFuel fuel : fuelTypes) {
            if (fuel.test(item)) {
                menu.consumeItem(43);
                if (getFuelSource() == AndroidFuelSource.LIQUID) {
                    menu.pushItem(new ItemStack(Material.BUCKET), getOutputSlots());
                }
                int fuelLevel = fuel.getTicks();
                BlockStorage.addBlockInfo(b, "fuel", String.valueOf(fuelLevel));
                break;
            }
        }
    }
}
Also used : ItemStack(org.bukkit.inventory.ItemStack) CustomItemStack(io.github.bakedlibs.dough.items.CustomItemStack) SlimefunItemStack(io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack) MachineFuel(me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineFuel) ParametersAreNonnullByDefault(javax.annotation.ParametersAreNonnullByDefault)

Example 2 with MachineFuel

use of me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineFuel in project Slimefun4 by Slimefun.

the class ProgrammableAndroid method getDisplayRecipes.

@Override
public List<ItemStack> getDisplayRecipes() {
    List<ItemStack> list = new ArrayList<>();
    for (MachineFuel fuel : fuelTypes) {
        ItemStack item = fuel.getInput().clone();
        ItemMeta im = item.getItemMeta();
        List<String> lore = new ArrayList<>();
        lore.add(ChatColors.color("&8\u21E8 &7Lasts " + NumberUtils.getTimeLeft(fuel.getTicks() / 2)));
        im.setLore(lore);
        item.setItemMeta(im);
        list.add(item);
    }
    return list;
}
Also used : ArrayList(java.util.ArrayList) ItemStack(org.bukkit.inventory.ItemStack) CustomItemStack(io.github.bakedlibs.dough.items.CustomItemStack) SlimefunItemStack(io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack) MachineFuel(me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineFuel) ItemMeta(org.bukkit.inventory.meta.ItemMeta)

Example 3 with MachineFuel

use of me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineFuel in project Slimefun4 by Slimefun.

the class ProgrammableAndroid method registerDefaultFuelTypes.

private void registerDefaultFuelTypes() {
    switch(getFuelSource()) {
        case SOLID:
            registerFuelType(new MachineFuel(80, new ItemStack(Material.COAL_BLOCK)));
            registerFuelType(new MachineFuel(45, new ItemStack(Material.BLAZE_ROD)));
            registerFuelType(new MachineFuel(70, new ItemStack(Material.DRIED_KELP_BLOCK)));
            // Coal & Charcoal
            registerFuelType(new MachineFuel(8, new ItemStack(Material.COAL)));
            registerFuelType(new MachineFuel(8, new ItemStack(Material.CHARCOAL)));
            // Logs
            for (Material mat : Tag.LOGS.getValues()) {
                registerFuelType(new MachineFuel(2, new ItemStack(mat)));
            }
            // Wooden Planks
            for (Material mat : Tag.PLANKS.getValues()) {
                registerFuelType(new MachineFuel(1, new ItemStack(mat)));
            }
            break;
        case LIQUID:
            registerFuelType(new MachineFuel(100, new ItemStack(Material.LAVA_BUCKET)));
            registerFuelType(new MachineFuel(200, SlimefunItems.OIL_BUCKET));
            registerFuelType(new MachineFuel(500, SlimefunItems.FUEL_BUCKET));
            break;
        case NUCLEAR:
            registerFuelType(new MachineFuel(2500, SlimefunItems.URANIUM));
            registerFuelType(new MachineFuel(1200, SlimefunItems.NEPTUNIUM));
            registerFuelType(new MachineFuel(3000, SlimefunItems.BOOSTED_URANIUM));
            break;
        default:
            throw new IllegalStateException("Unhandled Fuel Source: " + getFuelSource());
    }
}
Also used : Material(org.bukkit.Material) ItemStack(org.bukkit.inventory.ItemStack) CustomItemStack(io.github.bakedlibs.dough.items.CustomItemStack) SlimefunItemStack(io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack) MachineFuel(me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineFuel)

Example 4 with MachineFuel

use of me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineFuel in project Slimefun4 by Slimefun.

the class AbstractEnergyProvider method getDisplayRecipes.

@Override
public List<ItemStack> getDisplayRecipes() {
    List<ItemStack> list = new ArrayList<>();
    for (MachineFuel fuel : fuelTypes) {
        ItemStack item = fuel.getInput().clone();
        ItemMeta im = item.getItemMeta();
        List<String> lore = new ArrayList<>();
        lore.add(ChatColors.color("&8\u21E8 &7Lasts " + NumberUtils.getTimeLeft(fuel.getTicks() / 2)));
        lore.add(ChatColors.color("&8\u21E8 &e\u26A1 &7" + getEnergyProduction() * 2) + " J/s");
        lore.add(ChatColors.color("&8\u21E8 &e\u26A1 &7" + NumberUtils.getCompactDouble((double) fuel.getTicks() * getEnergyProduction()) + " J in total"));
        im.setLore(lore);
        item.setItemMeta(im);
        list.add(item);
    }
    return list;
}
Also used : ArrayList(java.util.ArrayList) ItemStack(org.bukkit.inventory.ItemStack) SlimefunItemStack(io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack) MachineFuel(me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineFuel) ItemMeta(org.bukkit.inventory.meta.ItemMeta)

Example 5 with MachineFuel

use of me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineFuel in project Slimefun4 by Slimefun.

the class CoalGenerator method registerDefaultFuelTypes.

@Override
protected void registerDefaultFuelTypes() {
    registerFuel(new MachineFuel(80, new ItemStack(Material.COAL_BLOCK)));
    registerFuel(new MachineFuel(12, new ItemStack(Material.BLAZE_ROD)));
    registerFuel(new MachineFuel(20, new ItemStack(Material.DRIED_KELP_BLOCK)));
    // Boats
    for (Material mat : Tag.ITEMS_BOATS.getValues()) {
        registerFuel(new MachineFuel(5, new ItemStack(mat)));
    }
    // Coal & Charcoal
    registerFuel(new MachineFuel(8, new ItemStack(Material.COAL)));
    registerFuel(new MachineFuel(8, new ItemStack(Material.CHARCOAL)));
    // Logs
    for (Material mat : Tag.LOGS.getValues()) {
        registerFuel(new MachineFuel(4, new ItemStack(mat)));
    }
    // Wooden Planks
    for (Material mat : Tag.PLANKS.getValues()) {
        registerFuel(new MachineFuel(1, new ItemStack(mat)));
    }
    // Wooden Slabs
    for (Material mat : Tag.WOODEN_SLABS.getValues()) {
        registerFuel(new MachineFuel(1, new ItemStack(mat)));
    }
    // Wooden Buttons
    for (Material mat : Tag.WOODEN_BUTTONS.getValues()) {
        registerFuel(new MachineFuel(1, new ItemStack(mat)));
    }
    // Wooden Fences
    for (Material mat : Tag.WOODEN_FENCES.getValues()) {
        registerFuel(new MachineFuel(1, new ItemStack(mat)));
    }
    // wooden Trapdoors
    for (Material mat : Tag.WOODEN_TRAPDOORS.getValues()) {
        registerFuel(new MachineFuel(3, new ItemStack(mat)));
    }
    // Wooden Pressure Plates
    for (Material mat : Tag.WOODEN_PRESSURE_PLATES.getValues()) {
        registerFuel(new MachineFuel(2, new ItemStack(mat)));
    }
    // Wooden Doors
    for (Material mat : Tag.WOODEN_DOORS.getValues()) {
        registerFuel(new MachineFuel(2, new ItemStack(mat)));
    }
    // Signs
    for (Material mat : Tag.STANDING_SIGNS.getValues()) {
        registerFuel(new MachineFuel(2, new ItemStack(mat)));
    }
}
Also used : Material(org.bukkit.Material) SlimefunItemStack(io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack) ItemStack(org.bukkit.inventory.ItemStack) MachineFuel(me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineFuel)

Aggregations

MachineFuel (me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineFuel)18 SlimefunItemStack (io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack)13 ItemStack (org.bukkit.inventory.ItemStack)13 CustomItemStack (io.github.bakedlibs.dough.items.CustomItemStack)5 ArrayList (java.util.ArrayList)4 Material (org.bukkit.Material)4 ItemMeta (org.bukkit.inventory.meta.ItemMeta)4 CustomItemStack (io.github.thebusybiscuit.slimefun4.libraries.dough.items.CustomItemStack)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 Nonnull (javax.annotation.Nonnull)2 CustomFood (io.github.thebusybiscuit.exoticgarden.items.CustomFood)1 SlimefunItem (io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem)1 Capacitor (io.github.thebusybiscuit.slimefun4.implementation.items.electric.Capacitor)1 ChargingBench (io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines.ChargingBench)1 ElectricSmeltery (io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines.ElectricSmeltery)1 AutoDisenchanter (io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines.enchanting.AutoDisenchanter)1 AutoEnchanter (io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines.enchanting.AutoEnchanter)1 NetherStarReactor (io.github.thebusybiscuit.slimefun4.implementation.items.electric.reactors.NetherStarReactor)1 GEOMiner (io.github.thebusybiscuit.slimefun4.implementation.items.geo.GEOMiner)1