1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00
This commit is contained in:
TheBusyBiscuit 2020-06-15 11:53:38 +02:00
parent 11a0d24fd1
commit 4efc10db15
3 changed files with 45 additions and 24 deletions

View File

@ -63,6 +63,7 @@
* Possibly fixed #1951 * Possibly fixed #1951
* Fixed tab completion for /sf give showing players instead of amounts * Fixed tab completion for /sf give showing players instead of amounts
* Fixed #1993 * Fixed #1993
* Fixed #1907
## Release Candidate 12 (27 May 2020) ## Release Candidate 12 (27 May 2020)
https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#12 https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#12

View File

@ -60,14 +60,21 @@ public abstract class ElectricDustWasher extends AContainer {
ChestMenuUtils.updateProgressbar(menu, 22, timeleft, processing.get(b).getTicks(), getProgressBar()); ChestMenuUtils.updateProgressbar(menu, 22, timeleft, processing.get(b).getTicks(), getProgressBar());
if (ChargableBlock.isChargable(b)) { if (ChargableBlock.isChargable(b)) {
if (ChargableBlock.getCharge(b) < getEnergyConsumption()) return; if (ChargableBlock.getCharge(b) < getEnergyConsumption()) {
return;
}
ChargableBlock.addCharge(b, -getEnergyConsumption()); ChargableBlock.addCharge(b, -getEnergyConsumption());
progress.put(b, timeleft - 1); progress.put(b, timeleft - 1);
} }
else progress.put(b, timeleft - 1); else {
progress.put(b, timeleft - 1);
}
} }
else if (ChargableBlock.isChargable(b)) { else if (ChargableBlock.isChargable(b)) {
if (ChargableBlock.getCharge(b) < getEnergyConsumption()) return; if (ChargableBlock.getCharge(b) < getEnergyConsumption()) {
return;
}
ChargableBlock.addCharge(b, -getEnergyConsumption()); ChargableBlock.addCharge(b, -getEnergyConsumption());
menu.replaceExistingItem(22, new CustomItem(new ItemStack(Material.BLACK_STAINED_GLASS_PANE), " ")); menu.replaceExistingItem(22, new CustomItem(new ItemStack(Material.BLACK_STAINED_GLASS_PANE), " "));
@ -88,19 +95,8 @@ public abstract class ElectricDustWasher extends AContainer {
private boolean process(Block b, BlockMenu menu, int slot) { private boolean process(Block b, BlockMenu menu, int slot) {
if (SlimefunUtils.isItemSimilar(menu.getItemInSlot(slot), SlimefunItems.SIFTED_ORE, true)) { if (SlimefunUtils.isItemSimilar(menu.getItemInSlot(slot), SlimefunItems.SIFTED_ORE, true)) {
if (!legacyMode) { if (!legacyMode && !hasFreeSlot(menu)) {
boolean emptySlot = false; return true;
for (int outputSlot : getOutputSlots()) {
if (menu.getItemInSlot(outputSlot) == null) {
emptySlot = true;
break;
}
}
if (!emptySlot) {
return true;
}
} }
ItemStack adding = oreWasher.getRandomDust(); ItemStack adding = oreWasher.getRandomDust();
@ -129,6 +125,16 @@ public abstract class ElectricDustWasher extends AContainer {
return false; return false;
} }
private boolean hasFreeSlot(BlockMenu menu) {
for (int slot : getOutputSlots()) {
if (menu.getItemInSlot(slot) == null) {
return true;
}
}
return false;
}
@Override @Override
public String getMachineIdentifier() { public String getMachineIdentifier() {
return "ELECTRIC_DUST_WASHER"; return "ELECTRIC_DUST_WASHER";

View File

@ -68,10 +68,14 @@ public abstract class ElectricGoldPan extends AContainer implements RecipeDispla
ChargableBlock.addCharge(b, -getEnergyConsumption()); ChargableBlock.addCharge(b, -getEnergyConsumption());
progress.put(b, timeleft - 1); progress.put(b, timeleft - 1);
} }
else progress.put(b, timeleft - 1); else {
progress.put(b, timeleft - 1);
}
} }
else if (ChargableBlock.isChargable(b)) { else if (ChargableBlock.isChargable(b)) {
if (ChargableBlock.getCharge(b) < getEnergyConsumption()) return; if (ChargableBlock.getCharge(b) < getEnergyConsumption()) {
return;
}
ChargableBlock.addCharge(b, -getEnergyConsumption()); ChargableBlock.addCharge(b, -getEnergyConsumption());
menu.replaceExistingItem(22, new CustomItem(new ItemStack(Material.BLACK_STAINED_GLASS_PANE), " ")); menu.replaceExistingItem(22, new CustomItem(new ItemStack(Material.BLACK_STAINED_GLASS_PANE), " "));
@ -83,13 +87,23 @@ public abstract class ElectricGoldPan extends AContainer implements RecipeDispla
} }
else { else {
for (int slot : getInputSlots()) { for (int slot : getInputSlots()) {
if (process(b, menu, slot)) { if (hasFreeSlot(menu) && process(b, menu, slot)) {
break; break;
} }
} }
} }
} }
private boolean hasFreeSlot(BlockMenu menu) {
for (int slot : getOutputSlots()) {
if (menu.getItemInSlot(slot) == null) {
return true;
}
}
return false;
}
private boolean process(Block b, BlockMenu menu, int slot) { private boolean process(Block b, BlockMenu menu, int slot) {
if (SlimefunUtils.isItemSimilar(menu.getItemInSlot(slot), new ItemStack(Material.GRAVEL), true)) { if (SlimefunUtils.isItemSimilar(menu.getItemInSlot(slot), new ItemStack(Material.GRAVEL), true)) {
ItemStack output = goldPan.getRandomOutput(); ItemStack output = goldPan.getRandomOutput();