-
Notifications
You must be signed in to change notification settings - Fork 8
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
1 parent
7633619
commit 84e5f52
Showing
13 changed files
with
280 additions
and
163 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
29 changes: 29 additions & 0 deletions
29
src/main/java/io/github/schntgaispock/gastronomicon/api/loot/EmptyItemLootTable.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,29 @@ | ||
package io.github.schntgaispock.gastronomicon.api.loot; | ||
|
||
import java.util.List; | ||
|
||
import org.bukkit.Material; | ||
import org.bukkit.inventory.ItemStack; | ||
|
||
public class EmptyItemLootTable extends LootTable<ItemStack> { | ||
|
||
protected EmptyItemLootTable() { | ||
super(List.of(), 0, new int[0], new int[0]); | ||
} | ||
|
||
@Override | ||
public boolean isEmpty() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public int size() { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public ItemStack generate() { | ||
return new ItemStack(Material.AIR); | ||
} | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
src/main/java/io/github/schntgaispock/gastronomicon/api/loot/ItemLootTableBuilder.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,30 @@ | ||
package io.github.schntgaispock.gastronomicon.api.loot; | ||
|
||
import org.bukkit.inventory.ItemStack; | ||
|
||
import io.github.schntgaispock.gastronomicon.api.loot.LootTable.LootTableBuilder; | ||
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem; | ||
|
||
public class ItemLootTableBuilder extends LootTableBuilder<ItemStack> { | ||
|
||
|
||
@SafeVarargs | ||
public final ItemLootTableBuilder addItems(int weight, ItemStack... drops) { | ||
for (final ItemStack drop : drops) { | ||
final SlimefunItem sfItem = SlimefunItem.getByItem(drop); | ||
if (sfItem != null && sfItem.isDisabled()) { | ||
continue; | ||
} | ||
|
||
weightedDrops.put(drop, weight); | ||
totalWeight += weight; | ||
} | ||
return this; | ||
} | ||
|
||
@SafeVarargs | ||
public final ItemLootTableBuilder addItems(ItemStack... drops) { | ||
return addItems(1, drops); | ||
} | ||
|
||
} |
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
Oops, something went wrong.