mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 03:35:51 +00:00
Allow admins to chose ore washer and dust washer behavior
This commit is contained in:
parent
9270b08d25
commit
17ec56799a
@ -12,6 +12,8 @@ options:
|
||||
emerald-enchantment-limit: 2
|
||||
research-unlock-fireworks: true
|
||||
research-give-fireworks: true
|
||||
legacy-ore-washer: false
|
||||
legacy-dust-washer: false
|
||||
guide:
|
||||
default-view-book: false
|
||||
URID:
|
||||
|
@ -42,6 +42,7 @@ public abstract class ElectricDustWasher extends AContainer {
|
||||
public void registerDefaultRecipes() {}
|
||||
|
||||
public abstract int getSpeed();
|
||||
public static boolean legacy_dust_washer = false;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void tick(Block b) {
|
||||
@ -83,13 +84,19 @@ public abstract class ElectricDustWasher extends AContainer {
|
||||
for (int slot: getInputSlots()) {
|
||||
if (SlimefunManager.isItemSimiliar(BlockStorage.getInventory(b).getItemInSlot(slot), SlimefunItems.SIFTED_ORE, true)) {
|
||||
boolean empty_slot = false;
|
||||
if (!legacy_dust_washer) {
|
||||
for (int output_slot: getOutputSlots()) {
|
||||
if (BlockStorage.getInventory(b).getItemInSlot(output_slot) == null) {
|
||||
empty_slot = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
empty_slot = true;
|
||||
}
|
||||
if (!empty_slot) return;
|
||||
|
||||
ItemStack adding = SlimefunItems.IRON_DUST;
|
||||
if (SlimefunStartup.chance(100, 25)) adding = SlimefunItems.GOLD_DUST;
|
||||
else if (SlimefunStartup.chance(100, 25)) adding = SlimefunItems.ALUMINUM_DUST;
|
||||
@ -101,6 +108,7 @@ public abstract class ElectricDustWasher extends AContainer {
|
||||
else if (SlimefunStartup.chance(100, 25)) adding = SlimefunItems.SILVER_DUST;
|
||||
|
||||
MachineRecipe r = new MachineRecipe(4 / getSpeed(), new ItemStack[0], new ItemStack[] {adding});
|
||||
if (!fits(b, r.getOutput())) return;
|
||||
BlockStorage.getInventory(b).replaceExistingItem(slot, InvUtils.decreaseItem(BlockStorage.getInventory(b).getItemInSlot(slot), 1));
|
||||
processing.put(b, r);
|
||||
progress.put(b, r.getTicks());
|
||||
|
@ -158,6 +158,8 @@ import me.mrCookieSlime.Slimefun.listeners.AncientAltarListener;
|
||||
@SuppressWarnings("deprecation")
|
||||
public class SlimefunSetup {
|
||||
|
||||
public static boolean legacy_ore_washer = false;
|
||||
|
||||
public static void setupItems() throws Exception {
|
||||
new SlimefunItem(Categories.WEAPONS, SlimefunItems.GRANDMAS_WALKING_STICK, "GRANDMAS_WALKING_STICK", RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||
new ItemStack[] {null, new ItemStack(Material.LOG), null, null, new ItemStack(Material.LOG), null, null, new ItemStack(Material.LOG), null})
|
||||
@ -1415,7 +1417,7 @@ public class SlimefunSetup {
|
||||
else if (SlimefunStartup.chance(100, 25)) adding = SlimefunItems.LEAD_DUST;
|
||||
else if (SlimefunStartup.chance(100, 25)) adding = SlimefunItems.SILVER_DUST;
|
||||
|
||||
if (inv.firstEmpty() != -1) {
|
||||
if (inv.firstEmpty() != -1 || (legacy_ore_washer && InvUtils.fits(inv, adding))) {
|
||||
ItemStack removing = current.clone();
|
||||
removing.setAmount(1);
|
||||
inv.removeItem(removing);
|
||||
|
@ -40,6 +40,7 @@ import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunArmorPiece;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.AutoEnchanter;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.ElectricDustWasher;
|
||||
import me.mrCookieSlime.Slimefun.Setup.Files;
|
||||
import me.mrCookieSlime.Slimefun.Setup.Messages;
|
||||
import me.mrCookieSlime.Slimefun.Setup.MiscSetup;
|
||||
@ -387,6 +388,9 @@ public class SlimefunStartup extends JavaPlugin {
|
||||
|
||||
AutoEnchanter.max_emerald_enchantments = config.getInt("options.emerald-enchantment-limit");
|
||||
|
||||
SlimefunSetup.legacy_ore_washer = config.getBoolean("options.legacy-ore-washer");
|
||||
ElectricDustWasher.legacy_dust_washer = config.getBoolean("options.legacy-dust-washer");
|
||||
|
||||
// Do not show /sf elevator command in our Log, it could get quite spammy
|
||||
CSCoreLib.getLib().filterLog("([A-Za-z0-9_]{3,16}) issued server command: /sf elevator (.{0,})");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user