generated from CleanroomMC/TemplateDevEnv
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Arcane Archives: Radiant Chest support * simplify InfinitySlotWrapper using FixedLimitSlot
- Loading branch information
Showing
4 changed files
with
53 additions
and
13 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
32 changes: 32 additions & 0 deletions
32
src/main/java/com/cleanroommc/bogosorter/compat/FixedLimitSlot.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,32 @@ | ||
package com.cleanroommc.bogosorter.compat; | ||
|
||
import net.minecraft.inventory.Slot; | ||
import net.minecraft.item.ItemStack; | ||
|
||
/** | ||
* @author ZZZank | ||
*/ | ||
public class FixedLimitSlot extends SlotDelegate { | ||
private final int sizeLimit; | ||
|
||
public FixedLimitSlot(Slot slot, int sizeLimit) { | ||
super(slot); | ||
if (sizeLimit <= 0) { | ||
throw new IllegalArgumentException(String.format( | ||
"size limit '%s' not valid, must be positive number", | ||
sizeLimit | ||
)); | ||
} | ||
this.sizeLimit = sizeLimit; | ||
} | ||
|
||
@Override | ||
public int bogo$getItemStackLimit(ItemStack itemStack) { | ||
return sizeLimit; | ||
} | ||
|
||
@Override | ||
public int bogo$getMaxStackSize(ItemStack itemStack) { | ||
return sizeLimit; | ||
} | ||
} |
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