-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix item combiner menus without a result slot
- Loading branch information
1 parent
044561d
commit 6284b45
Showing
4 changed files
with
41 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/main/java/de/teamlapen/vampirism/inventory/ModifiedItemCombinerMenuSlotDefinition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package de.teamlapen.vampirism.inventory; | ||
|
||
import net.minecraft.world.inventory.ItemCombinerMenuSlotDefinition; | ||
import net.minecraft.world.item.ItemStack; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.function.Predicate; | ||
|
||
public class ModifiedItemCombinerMenuSlotDefinition extends ItemCombinerMenuSlotDefinition { | ||
|
||
public ModifiedItemCombinerMenuSlotDefinition(List<SlotDefinition> pSlots, SlotDefinition pResultSlot) { | ||
super(pSlots, pResultSlot); | ||
} | ||
|
||
public static ModifiedItemCombinerMenuSlotDefinition.Builder createWithoutResult() { | ||
return new ModifiedItemCombinerMenuSlotDefinition.Builder(); | ||
} | ||
|
||
@Override | ||
public int getResultSlotIndex() { | ||
return this.getResultSlot().slotIndex(); | ||
} | ||
|
||
public static class Builder { | ||
private final List<SlotDefinition> slots = new ArrayList<>(); | ||
|
||
public ModifiedItemCombinerMenuSlotDefinition.Builder withSlot(int pSlotIndex, int pX, int pY, Predicate<ItemStack> pMayPlace) { | ||
this.slots.add(new SlotDefinition(pSlotIndex, pX, pY, pMayPlace)); | ||
return this; | ||
} | ||
|
||
public ModifiedItemCombinerMenuSlotDefinition build() { | ||
return new ModifiedItemCombinerMenuSlotDefinition(this.slots, new SlotDefinition(this.slots.size()-1, 0, 0, (p_266823_) -> false)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters