-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
132 additions
and
8 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
33 changes: 33 additions & 0 deletions
33
...ain/java/xyz/violaflower/legacy_tweaks/client/gui/extention/VirtualCraftingInventory.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,33 @@ | ||
package xyz.violaflower.legacy_tweaks.client.gui.extention; | ||
|
||
import net.minecraft.world.inventory.Slot; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.Iterator; | ||
|
||
public interface VirtualCraftingInventory extends Iterable<Slot> { | ||
int getWidth(); | ||
int getHeight(); | ||
default int getSize() { return getWidth()*getHeight(); } | ||
Slot getCraftingSlot(int num); | ||
// 0-indexed | ||
default Slot getCraftingSlot(int x, int y) { return getCraftingSlot(x+y*getWidth()); } | ||
Slot getResultSlot(); | ||
|
||
@Override | ||
default @NotNull Iterator<Slot> iterator() { | ||
return new Iterator<>() { | ||
int i = 0; | ||
|
||
@Override | ||
public boolean hasNext() { | ||
return i < getSize(); | ||
} | ||
|
||
@Override | ||
public Slot next() { | ||
return getCraftingSlot(i++); | ||
} | ||
}; | ||
} | ||
} |
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
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