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
* Fixed tab completion for /sf give showing players instead of amounts
* Fixed #1993
* Fixed #1907
## Release Candidate 12 (27 May 2020)
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());
if (ChargableBlock.isChargable(b)) {
if (ChargableBlock.getCharge(b) < getEnergyConsumption()) return;
if (ChargableBlock.getCharge(b) < getEnergyConsumption()) {
return;
}
ChargableBlock.addCharge(b, -getEnergyConsumption());
progress.put(b, timeleft - 1);
}
else progress.put(b, timeleft - 1);
else {
progress.put(b, timeleft - 1);
}
}
else if (ChargableBlock.isChargable(b)) {
if (ChargableBlock.getCharge(b) < getEnergyConsumption()) return;
if (ChargableBlock.getCharge(b) < getEnergyConsumption()) {
return;
}
ChargableBlock.addCharge(b, -getEnergyConsumption());
menu.replaceExistingItem(22, new CustomItem(new ItemStack(Material.BLACK_STAINED_GLASS_PANE), " "));
@ -88,20 +95,9 @@ public abstract class ElectricDustWasher extends AContainer {
private boolean process(Block b, BlockMenu menu, int slot) {
if (SlimefunUtils.isItemSimilar(menu.getItemInSlot(slot), SlimefunItems.SIFTED_ORE, true)) {
if (!legacyMode) {
boolean emptySlot = false;
for (int outputSlot : getOutputSlots()) {
if (menu.getItemInSlot(outputSlot) == null) {
emptySlot = true;
break;
}
}
if (!emptySlot) {
if (!legacyMode && !hasFreeSlot(menu)) {
return true;
}
}
ItemStack adding = oreWasher.getRandomDust();
MachineRecipe r = new MachineRecipe(4 / getSpeed(), new ItemStack[0], new ItemStack[] { adding });
@ -129,6 +125,16 @@ public abstract class ElectricDustWasher extends AContainer {
return false;
}
private boolean hasFreeSlot(BlockMenu menu) {
for (int slot : getOutputSlots()) {
if (menu.getItemInSlot(slot) == null) {
return true;
}
}
return false;
}
@Override
public String getMachineIdentifier() {
return "ELECTRIC_DUST_WASHER";

View File

@ -68,10 +68,14 @@ public abstract class ElectricGoldPan extends AContainer implements RecipeDispla
ChargableBlock.addCharge(b, -getEnergyConsumption());
progress.put(b, timeleft - 1);
}
else progress.put(b, timeleft - 1);
else {
progress.put(b, timeleft - 1);
}
}
else if (ChargableBlock.isChargable(b)) {
if (ChargableBlock.getCharge(b) < getEnergyConsumption()) return;
if (ChargableBlock.getCharge(b) < getEnergyConsumption()) {
return;
}
ChargableBlock.addCharge(b, -getEnergyConsumption());
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 {
for (int slot : getInputSlots()) {
if (process(b, menu, slot)) {
if (hasFreeSlot(menu) && process(b, menu, slot)) {
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) {
if (SlimefunUtils.isItemSimilar(menu.getItemInSlot(slot), new ItemStack(Material.GRAVEL), true)) {
ItemStack output = goldPan.getRandomOutput();