mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
Fixes #1897
This commit is contained in:
parent
a90351a18a
commit
ccad2982ab
@ -38,6 +38,7 @@
|
||||
* Fixed #1851
|
||||
* Fixed #1891
|
||||
* Fixed #1893
|
||||
* Fixed #1897
|
||||
|
||||
## Release Candidate 11 (25 Apr 2020)
|
||||
|
||||
|
@ -26,21 +26,7 @@ public class OreWasher extends MultiBlockMachine {
|
||||
private final boolean legacyMode;
|
||||
|
||||
public OreWasher(Category category) {
|
||||
super(category, SlimefunItems.ORE_WASHER,
|
||||
new ItemStack[] {null, new ItemStack(Material.DISPENSER), null, null, new ItemStack(Material.OAK_FENCE), null, null, new ItemStack(Material.CAULDRON), null},
|
||||
new ItemStack[] {
|
||||
SlimefunItems.SIFTED_ORE, SlimefunItems.IRON_DUST,
|
||||
SlimefunItems.SIFTED_ORE, SlimefunItems.GOLD_DUST,
|
||||
SlimefunItems.SIFTED_ORE, SlimefunItems.COPPER_DUST,
|
||||
SlimefunItems.SIFTED_ORE, SlimefunItems.TIN_DUST,
|
||||
SlimefunItems.SIFTED_ORE, SlimefunItems.ZINC_DUST,
|
||||
SlimefunItems.SIFTED_ORE, SlimefunItems.ALUMINUM_DUST,
|
||||
SlimefunItems.SIFTED_ORE, SlimefunItems.MAGNESIUM_DUST,
|
||||
SlimefunItems.SIFTED_ORE, SlimefunItems.LEAD_DUST,
|
||||
SlimefunItems.SIFTED_ORE, SlimefunItems.SILVER_DUST
|
||||
},
|
||||
BlockFace.SELF
|
||||
);
|
||||
super(category, SlimefunItems.ORE_WASHER, new ItemStack[] { null, new ItemStack(Material.DISPENSER), null, null, new ItemStack(Material.OAK_FENCE), null, null, new ItemStack(Material.CAULDRON), null }, new ItemStack[] { SlimefunItems.SIFTED_ORE, SlimefunItems.IRON_DUST, SlimefunItems.SIFTED_ORE, SlimefunItems.GOLD_DUST, SlimefunItems.SIFTED_ORE, SlimefunItems.COPPER_DUST, SlimefunItems.SIFTED_ORE, SlimefunItems.TIN_DUST, SlimefunItems.SIFTED_ORE, SlimefunItems.ZINC_DUST, SlimefunItems.SIFTED_ORE, SlimefunItems.ALUMINUM_DUST, SlimefunItems.SIFTED_ORE, SlimefunItems.MAGNESIUM_DUST, SlimefunItems.SIFTED_ORE, SlimefunItems.LEAD_DUST, SlimefunItems.SIFTED_ORE, SlimefunItems.SILVER_DUST }, BlockFace.SELF);
|
||||
|
||||
legacyMode = SlimefunPlugin.getCfg().getBoolean("options.legacy-ore-washer");
|
||||
}
|
||||
@ -59,24 +45,27 @@ public class OreWasher extends MultiBlockMachine {
|
||||
for (ItemStack current : inv.getContents()) {
|
||||
if (current != null) {
|
||||
if (SlimefunUtils.isItemSimilar(current, SlimefunItems.SIFTED_ORE, true)) {
|
||||
ItemStack adding = getRandomDust();
|
||||
ItemStack output = getRandomDust();
|
||||
Inventory outputInv = null;
|
||||
|
||||
if (!legacyMode) {
|
||||
// This is a fancy way of checking if there is empty space in the inv; by checking if an unobtainable item could fit in it.
|
||||
// However, due to the way the method findValidOutputInv() functions, the dummyAdding will never actually be added to the real inventory,
|
||||
// so it really doesn't matter what item the ItemStack is made by. SlimefunItems.DEBUG_FISH however, signals that it's
|
||||
// This is a fancy way of checking if there is empty space in the inv; by checking if an
|
||||
// unobtainable item could fit in it.
|
||||
// However, due to the way the method findValidOutputInv() functions, the dummyAdding will never
|
||||
// actually be added to the real inventory,
|
||||
// so it really doesn't matter what item the ItemStack is made by. SlimefunItems.DEBUG_FISH
|
||||
// however, signals that it's
|
||||
// not supposed to be given to the player.
|
||||
ItemStack dummyAdding = SlimefunItems.DEBUG_FISH;
|
||||
outputInv = findOutputInventory(dummyAdding, dispBlock, inv);
|
||||
}
|
||||
else outputInv = findOutputInventory(adding, dispBlock, inv);
|
||||
else outputInv = findOutputInventory(output, dispBlock, inv);
|
||||
|
||||
if (outputInv != null) {
|
||||
ItemStack removing = current.clone();
|
||||
removing.setAmount(1);
|
||||
inv.removeItem(removing);
|
||||
outputInv.addItem(adding);
|
||||
outputInv.addItem(output);
|
||||
p.getWorld().playSound(b.getLocation(), Sound.ENTITY_PLAYER_SPLASH, 1, 1);
|
||||
p.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, Material.WATER);
|
||||
if (InvUtils.fits(outputInv, SlimefunItems.STONE_CHUNK)) outputInv.addItem(SlimefunItems.STONE_CHUNK);
|
||||
@ -86,14 +75,14 @@ public class OreWasher extends MultiBlockMachine {
|
||||
return;
|
||||
}
|
||||
else if (SlimefunUtils.isItemSimilar(current, new ItemStack(Material.SAND, 4), false)) {
|
||||
ItemStack adding = SlimefunItems.SALT;
|
||||
Inventory outputInv = findOutputInventory(adding, dispBlock, inv);
|
||||
ItemStack output = SlimefunItems.SALT;
|
||||
Inventory outputInv = findOutputInventory(output, dispBlock, inv);
|
||||
|
||||
if (outputInv != null) {
|
||||
ItemStack removing = current.clone();
|
||||
removing.setAmount(4);
|
||||
removing.setAmount(2);
|
||||
inv.removeItem(removing);
|
||||
outputInv.addItem(adding);
|
||||
outputInv.addItem(output);
|
||||
p.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, Material.WATER);
|
||||
p.getWorld().playSound(b.getLocation(), Sound.ENTITY_PLAYER_SPLASH, 1, 1);
|
||||
}
|
||||
@ -102,14 +91,14 @@ public class OreWasher extends MultiBlockMachine {
|
||||
return;
|
||||
}
|
||||
else if (SlimefunUtils.isItemSimilar(current, SlimefunItems.PULVERIZED_ORE, true)) {
|
||||
ItemStack adding = SlimefunItems.PURE_ORE_CLUSTER;
|
||||
Inventory outputInv = findOutputInventory(adding, dispBlock, inv);
|
||||
ItemStack output = SlimefunItems.PURE_ORE_CLUSTER;
|
||||
Inventory outputInv = findOutputInventory(output, dispBlock, inv);
|
||||
|
||||
if (outputInv != null) {
|
||||
ItemStack removing = current.clone();
|
||||
removing.setAmount(1);
|
||||
inv.removeItem(removing);
|
||||
outputInv.addItem(adding);
|
||||
outputInv.addItem(output);
|
||||
p.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, Material.WATER);
|
||||
p.getWorld().playSound(b.getLocation(), Sound.ENTITY_PLAYER_SPLASH, 1, 1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user