mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
Removed Automated Crafting Chamber
This commit is contained in:
parent
bffef56407
commit
d91d9c2856
@ -37,6 +37,7 @@
|
|||||||
* Renamed "Solar Panel" to "Photovoltaic Cell" to avoid confusions with solar generators
|
* Renamed "Solar Panel" to "Photovoltaic Cell" to avoid confusions with solar generators
|
||||||
* Photovoltaic Cells can no longer be placed
|
* Photovoltaic Cells can no longer be placed
|
||||||
* (API) Removed deprecated "SlimefunBlockHandler"
|
* (API) Removed deprecated "SlimefunBlockHandler"
|
||||||
|
* Removed Automated Crafting Chamber
|
||||||
|
|
||||||
#### Fixes
|
#### Fixes
|
||||||
* Fixed #2987
|
* Fixed #2987
|
||||||
|
@ -846,9 +846,6 @@ public final class SlimefunItems {
|
|||||||
public static final SlimefunItemStack ELECTRIC_INGOT_FACTORY_2 = new SlimefunItemStack("ELECTRIC_INGOT_FACTORY_2", Material.RED_TERRACOTTA, "&cElectric Ingot Factory &7(&eII&7)", "", LoreBuilder.machine(MachineTier.BASIC, MachineType.MACHINE), LoreBuilder.speed(2), LoreBuilder.powerPerSecond(14));
|
public static final SlimefunItemStack ELECTRIC_INGOT_FACTORY_2 = new SlimefunItemStack("ELECTRIC_INGOT_FACTORY_2", Material.RED_TERRACOTTA, "&cElectric Ingot Factory &7(&eII&7)", "", LoreBuilder.machine(MachineTier.BASIC, MachineType.MACHINE), LoreBuilder.speed(2), LoreBuilder.powerPerSecond(14));
|
||||||
public static final SlimefunItemStack ELECTRIC_INGOT_FACTORY_3 = new SlimefunItemStack("ELECTRIC_INGOT_FACTORY_3", Material.RED_TERRACOTTA, "&cElectric Ingot Factory &7(&eIII&7)", "", LoreBuilder.machine(MachineTier.END_GAME, MachineType.MACHINE), LoreBuilder.speed(8), LoreBuilder.powerPerSecond(40));
|
public static final SlimefunItemStack ELECTRIC_INGOT_FACTORY_3 = new SlimefunItemStack("ELECTRIC_INGOT_FACTORY_3", Material.RED_TERRACOTTA, "&cElectric Ingot Factory &7(&eIII&7)", "", LoreBuilder.machine(MachineTier.END_GAME, MachineType.MACHINE), LoreBuilder.speed(8), LoreBuilder.powerPerSecond(40));
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static final SlimefunItemStack AUTOMATED_CRAFTING_CHAMBER = new SlimefunItemStack("AUTOMATED_CRAFTING_CHAMBER", Material.CRAFTING_TABLE, "&6Automated Crafting Chamber", "", LoreBuilder.machine(MachineTier.ADVANCED, MachineType.MACHINE), "&8\u21E8 &e\u26A1 &710 J/Item");
|
|
||||||
|
|
||||||
public static final SlimefunItemStack FLUID_PUMP = new SlimefunItemStack("FLUID_PUMP", Material.BLUE_TERRACOTTA, "&9Fluid Pump", "", LoreBuilder.machine(MachineTier.ADVANCED, MachineType.MACHINE), "&8\u21E8 &e\u26A1 &732 J/Block");
|
public static final SlimefunItemStack FLUID_PUMP = new SlimefunItemStack("FLUID_PUMP", Material.BLUE_TERRACOTTA, "&9Fluid Pump", "", LoreBuilder.machine(MachineTier.ADVANCED, MachineType.MACHINE), "&8\u21E8 &e\u26A1 &732 J/Block");
|
||||||
public static final SlimefunItemStack CHARGING_BENCH = new SlimefunItemStack("CHARGING_BENCH", Material.CRAFTING_TABLE, "&6Charging Bench", "", "&fCharges Items such as Jetpacks", "", LoreBuilder.machine(MachineTier.BASIC, MachineType.MACHINE), LoreBuilder.powerBuffer(128), "&8\u21E8 &e\u26A1 &7Energy Loss: &c50%");
|
public static final SlimefunItemStack CHARGING_BENCH = new SlimefunItemStack("CHARGING_BENCH", Material.CRAFTING_TABLE, "&6Charging Bench", "", "&fCharges Items such as Jetpacks", "", LoreBuilder.machine(MachineTier.BASIC, MachineType.MACHINE), LoreBuilder.powerBuffer(128), "&8\u21E8 &e\u26A1 &7Energy Loss: &c50%");
|
||||||
|
|
||||||
|
@ -1,206 +0,0 @@
|
|||||||
package io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
|
||||||
import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
|
|
||||||
import io.github.thebusybiscuit.slimefun4.api.events.BlockPlacerPlaceEvent;
|
|
||||||
import io.github.thebusybiscuit.slimefun4.core.attributes.EnergyNetComponent;
|
|
||||||
import io.github.thebusybiscuit.slimefun4.core.handlers.BlockBreakHandler;
|
|
||||||
import io.github.thebusybiscuit.slimefun4.core.handlers.BlockPlaceHandler;
|
|
||||||
import io.github.thebusybiscuit.slimefun4.core.networks.energy.EnergyNetComponentType;
|
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.handlers.SimpleBlockBreakHandler;
|
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.items.autocrafters.AbstractAutoCrafter;
|
|
||||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler;
|
|
||||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction;
|
|
||||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
|
||||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
|
||||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
|
||||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.InventoryBlock;
|
|
||||||
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
|
||||||
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
|
||||||
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
|
|
||||||
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset;
|
|
||||||
import me.mrCookieSlime.Slimefun.api.inventory.DirtyChestMenu;
|
|
||||||
import me.mrCookieSlime.Slimefun.api.item_transport.ItemTransportFlow;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This machine is disabled and has been replaced by Auto Crafters.
|
|
||||||
*
|
|
||||||
* @deprecated This has been replaced by the {@link AbstractAutoCrafter}.
|
|
||||||
*
|
|
||||||
* @author TheBusyBiscuit
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public abstract class AutomatedCraftingChamber extends SlimefunItem implements InventoryBlock, EnergyNetComponent {
|
|
||||||
|
|
||||||
private final int[] border = { 0, 1, 3, 4, 5, 7, 8, 13, 14, 15, 16, 17, 50, 51, 52, 53 };
|
|
||||||
private final int[] inputBorder = { 9, 10, 11, 12, 13, 18, 22, 27, 31, 36, 40, 45, 46, 47, 48, 49 };
|
|
||||||
private final int[] outputBorder = { 23, 24, 25, 26, 32, 35, 41, 42, 43, 44 };
|
|
||||||
|
|
||||||
@ParametersAreNonnullByDefault
|
|
||||||
protected AutomatedCraftingChamber(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
|
|
||||||
super(category, item, recipeType, recipe);
|
|
||||||
|
|
||||||
new BlockMenuPreset(getId(), "&4Machine is disabled.") {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init() {
|
|
||||||
constructMenu(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void newInstance(BlockMenu menu, Block b) {
|
|
||||||
if (!BlockStorage.hasBlockInfo(b) || BlockStorage.getLocationInfo(b.getLocation(), "enabled") == null || BlockStorage.getLocationInfo(b.getLocation(), "enabled").equals(String.valueOf(false))) {
|
|
||||||
menu.replaceExistingItem(6, new CustomItem(Material.GUNPOWDER, "&7Enabled: &4\u2718", "", "&e> Click to enable this Machine"));
|
|
||||||
menu.addMenuClickHandler(6, (p, slot, item, action) -> {
|
|
||||||
BlockStorage.addBlockInfo(b, "enabled", String.valueOf(true));
|
|
||||||
newInstance(menu, b);
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
menu.replaceExistingItem(6, new CustomItem(Material.REDSTONE, "&7Enabled: &2\u2714", "", "&e> Click to disable this Machine"));
|
|
||||||
menu.addMenuClickHandler(6, (p, slot, item, action) -> {
|
|
||||||
BlockStorage.addBlockInfo(b, "enabled", String.valueOf(false));
|
|
||||||
newInstance(menu, b);
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canOpen(Block b, Player p) {
|
|
||||||
p.sendMessage(ChatColor.DARK_RED + "This item has been disabled and will be removed soon. Please switch over to the new Auto Crafters in the Cargo Category.");
|
|
||||||
return p.hasPermission("slimefun.inventory.bypass") || SlimefunPlugin.getProtectionManager().hasPermission(p, b.getLocation(), ProtectableAction.INTERACT_BLOCK);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int[] getSlotsAccessedByItemTransport(ItemTransportFlow flow) {
|
|
||||||
return new int[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int[] getSlotsAccessedByItemTransport(DirtyChestMenu menu, ItemTransportFlow flow, ItemStack item) {
|
|
||||||
if (flow == ItemTransportFlow.WITHDRAW) {
|
|
||||||
return getOutputSlots();
|
|
||||||
}
|
|
||||||
|
|
||||||
List<Integer> slots = new ArrayList<>();
|
|
||||||
for (int slot : getInputSlots()) {
|
|
||||||
if (menu.getItemInSlot(slot) != null) {
|
|
||||||
slots.add(slot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Collections.sort(slots, compareSlots(menu));
|
|
||||||
|
|
||||||
int[] array = new int[slots.size()];
|
|
||||||
|
|
||||||
for (int i = 0; i < slots.size(); i++) {
|
|
||||||
array[i] = slots.get(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
return array;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
addItemHandler(onPlace(), onBreak());
|
|
||||||
}
|
|
||||||
|
|
||||||
private BlockPlaceHandler onPlace() {
|
|
||||||
return new BlockPlaceHandler(true) {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPlayerPlace(BlockPlaceEvent e) {
|
|
||||||
e.getPlayer().sendMessage(ChatColor.DARK_RED + "This item has been disabled and will be removed soon. Please switch over to the new Auto Crafters in the Cargo Category.");
|
|
||||||
BlockStorage.addBlockInfo(e.getBlock(), "enabled", String.valueOf(false));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBlockPlacerPlace(BlockPlacerPlaceEvent e) {
|
|
||||||
BlockStorage.addBlockInfo(e.getBlock(), "enabled", String.valueOf(false));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private BlockBreakHandler onBreak() {
|
|
||||||
return new SimpleBlockBreakHandler() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBlockBreak(Block b) {
|
|
||||||
BlockMenu inv = BlockStorage.getInventory(b);
|
|
||||||
|
|
||||||
if (inv != null) {
|
|
||||||
inv.dropItems(b.getLocation(), getInputSlots());
|
|
||||||
inv.dropItems(b.getLocation(), getOutputSlots());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private Comparator<Integer> compareSlots(DirtyChestMenu menu) {
|
|
||||||
return (slot1, slot2) -> menu.getItemInSlot(slot1).getAmount() - menu.getItemInSlot(slot2).getAmount();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void constructMenu(BlockMenuPreset preset) {
|
|
||||||
for (int i : border) {
|
|
||||||
preset.addItem(i, new CustomItem(new ItemStack(Material.GRAY_STAINED_GLASS_PANE), " "), (p, slot, item, action) -> false);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i : inputBorder) {
|
|
||||||
preset.addItem(i, new CustomItem(new ItemStack(Material.BLUE_STAINED_GLASS_PANE), " "), (p, slot, item, action) -> false);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i : outputBorder) {
|
|
||||||
preset.addItem(i, new CustomItem(new ItemStack(Material.ORANGE_STAINED_GLASS_PANE), " "), (p, slot, item, action) -> false);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i : getOutputSlots()) {
|
|
||||||
preset.addMenuClickHandler(i, new AdvancedMenuClickHandler() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onClick(Player p, int slot, ItemStack cursor, ClickAction action) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onClick(InventoryClickEvent e, Player p, int slot, ItemStack cursor, ClickAction action) {
|
|
||||||
return cursor == null || cursor.getType() == null || cursor.getType() == Material.AIR;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
preset.addItem(2, new CustomItem(new ItemStack(Material.CRAFTING_TABLE), "&eRecipe", "", "&bPut in the Recipe you want to craft", "&4Enhanced Crafting Table Recipes ONLY"), (p, slot, item, action) -> false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract int getEnergyConsumption();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int[] getInputSlots() {
|
|
||||||
return new int[] { 19, 20, 21, 28, 29, 30, 37, 38, 39 };
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int[] getOutputSlots() {
|
|
||||||
return new int[] { 33, 34 };
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnergyNetComponentType getEnergyComponentType() {
|
|
||||||
return EnergyNetComponentType.CONSUMER;
|
|
||||||
}
|
|
||||||
}
|
|
@ -219,7 +219,6 @@ public final class ResearchSetup {
|
|||||||
register("electric_ingot_machines", 207, "Electric Ingot Fabrication", 18, SlimefunItems.ELECTRIC_GOLD_PAN, SlimefunItems.ELECTRIC_DUST_WASHER, SlimefunItems.ELECTRIC_INGOT_FACTORY);
|
register("electric_ingot_machines", 207, "Electric Ingot Fabrication", 18, SlimefunItems.ELECTRIC_GOLD_PAN, SlimefunItems.ELECTRIC_DUST_WASHER, SlimefunItems.ELECTRIC_INGOT_FACTORY);
|
||||||
register("medium_tier_electric_ingot_machines", 208, "Fast Ingot Fabrication", 25, SlimefunItems.ELECTRIC_GOLD_PAN_2, SlimefunItems.ELECTRIC_DUST_WASHER_2, SlimefunItems.ELECTRIC_INGOT_FACTORY_2, SlimefunItems.ELECTRIC_ORE_GRINDER_2);
|
register("medium_tier_electric_ingot_machines", 208, "Fast Ingot Fabrication", 25, SlimefunItems.ELECTRIC_GOLD_PAN_2, SlimefunItems.ELECTRIC_DUST_WASHER_2, SlimefunItems.ELECTRIC_INGOT_FACTORY_2, SlimefunItems.ELECTRIC_ORE_GRINDER_2);
|
||||||
register("high_tier_electric_ingot_machines", 209, "Super Fast Ingot Fabrication", 32, SlimefunItems.ELECTRIC_GOLD_PAN_3, SlimefunItems.ELECTRIC_DUST_WASHER_3, SlimefunItems.ELECTRIC_INGOT_FACTORY_3, SlimefunItems.ELECTRIC_ORE_GRINDER_3);
|
register("high_tier_electric_ingot_machines", 209, "Super Fast Ingot Fabrication", 32, SlimefunItems.ELECTRIC_GOLD_PAN_3, SlimefunItems.ELECTRIC_DUST_WASHER_3, SlimefunItems.ELECTRIC_INGOT_FACTORY_3, SlimefunItems.ELECTRIC_ORE_GRINDER_3);
|
||||||
register("automated_crafting_chamber", 210, "Automated Crafting", 20, SlimefunItems.AUTOMATED_CRAFTING_CHAMBER);
|
|
||||||
register("better_food_fabricator", 211, "Upgraded Food Fabrication", 28, SlimefunItems.FOOD_FABRICATOR_2, SlimefunItems.FOOD_COMPOSTER_2);
|
register("better_food_fabricator", 211, "Upgraded Food Fabrication", 28, SlimefunItems.FOOD_FABRICATOR_2, SlimefunItems.FOOD_COMPOSTER_2);
|
||||||
register("reactor_access_port", 212, "Reactor Interaction", 18, SlimefunItems.REACTOR_ACCESS_PORT);
|
register("reactor_access_port", 212, "Reactor Interaction", 18, SlimefunItems.REACTOR_ACCESS_PORT);
|
||||||
register("fluid_pump", 213, "Fluid Pump", 28, SlimefunItems.FLUID_PUMP);
|
register("fluid_pump", 213, "Fluid Pump", 28, SlimefunItems.FLUID_PUMP);
|
||||||
|
@ -85,7 +85,6 @@ import io.github.thebusybiscuit.slimefun4.implementation.items.electric.generato
|
|||||||
import io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines.AutoAnvil;
|
import io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines.AutoAnvil;
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines.AutoBrewer;
|
import io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines.AutoBrewer;
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines.AutoDrier;
|
import io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines.AutoDrier;
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines.AutomatedCraftingChamber;
|
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines.CarbonPress;
|
import io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines.CarbonPress;
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines.ChargingBench;
|
import io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines.ChargingBench;
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines.ElectricDustWasher;
|
import io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines.ElectricDustWasher;
|
||||||
@ -2494,21 +2493,6 @@ public final class SlimefunItemSetup {
|
|||||||
new ItemStack[] {null, SlimefunItems.CARGO_MOTOR, null, SlimefunItems.COBALT_INGOT, SlimefunItems.CARGO_OUTPUT_NODE, SlimefunItems.COBALT_INGOT, null, SlimefunItems.CARGO_MOTOR, null})
|
new ItemStack[] {null, SlimefunItems.CARGO_MOTOR, null, SlimefunItems.COBALT_INGOT, SlimefunItems.CARGO_OUTPUT_NODE, SlimefunItems.COBALT_INGOT, null, SlimefunItems.CARGO_MOTOR, null})
|
||||||
.register(plugin);
|
.register(plugin);
|
||||||
|
|
||||||
new AutomatedCraftingChamber(categories.electricity, SlimefunItems.AUTOMATED_CRAFTING_CHAMBER, RecipeType.ENHANCED_CRAFTING_TABLE,
|
|
||||||
new ItemStack[] {null, null, null, null, new CustomItem(Material.BARRIER, "&4This Item has been disabled.", "&cIt will soon be removed!", "&cPlease switch over to the new", "&cAuto-Crafters from the Cargo Category."), null, null, null, null}) {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getEnergyConsumption() {
|
|
||||||
return 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getCapacity() {
|
|
||||||
return 256;
|
|
||||||
}
|
|
||||||
|
|
||||||
}.register(plugin);
|
|
||||||
|
|
||||||
new ReactorAccessPort(categories.cargo, SlimefunItems.REACTOR_ACCESS_PORT, RecipeType.ENHANCED_CRAFTING_TABLE,
|
new ReactorAccessPort(categories.cargo, SlimefunItems.REACTOR_ACCESS_PORT, RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||||
new ItemStack[] {null, SlimefunItems.BLISTERING_INGOT_3, null, SlimefunItems.LEAD_INGOT, SlimefunItems.CARGO_MOTOR, SlimefunItems.LEAD_INGOT, null, SlimefunItems.ELECTRIC_MOTOR, null})
|
new ItemStack[] {null, SlimefunItems.BLISTERING_INGOT_3, null, SlimefunItems.LEAD_INGOT, SlimefunItems.CARGO_MOTOR, SlimefunItems.LEAD_INGOT, null, SlimefunItems.ELECTRIC_MOTOR, null})
|
||||||
.register(plugin);
|
.register(plugin);
|
||||||
|
Loading…
Reference in New Issue
Block a user