LootTable API and replenishable lootables
Provides an API to control the loot table for an object. Also provides a feature that any Lootable Inventory (Chests in Structures) can automatically replenish after a given time. This feature is good for long term worlds so that newer players do not suffer with "Every chest has been looted" == AT == public org.bukkit.craftbukkit.block.CraftBlockEntityState getTileEntity()Lnet/minecraft/world/level/block/entity/BlockEntity; public org.bukkit.craftbukkit.block.CraftLootable setLootTable(Lorg/bukkit/loot/LootTable;J)V public org.bukkit.craftbukkit.entity.CraftMinecartContainer setLootTable(Lorg/bukkit/loot/LootTable;J)V
This commit is contained in:
@@ -58,7 +58,8 @@ public class CraftBrushableBlock extends CraftBlockEntityState<BrushableBlockEnt
|
||||
this.setLootTable(this.getLootTable(), seed);
|
||||
}
|
||||
|
||||
private void setLootTable(LootTable table, long seed) {
|
||||
@Override // Paper - this is now an override
|
||||
public void setLootTable(LootTable table, long seed) { // Paper - make public since it overrides a public method
|
||||
this.getSnapshot().setLootTable(CraftLootTable.bukkitToMinecraft(table), seed);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.bukkit.craftbukkit.CraftLootTable;
|
||||
import org.bukkit.loot.LootTable;
|
||||
import org.bukkit.loot.Lootable;
|
||||
|
||||
public abstract class CraftLootable<T extends RandomizableContainerBlockEntity> extends CraftContainer<T> implements Nameable, Lootable {
|
||||
public abstract class CraftLootable<T extends RandomizableContainerBlockEntity> extends CraftContainer<T> implements Nameable, Lootable, com.destroystokyo.paper.loottable.PaperLootableBlockInventory { // Paper
|
||||
|
||||
public CraftLootable(World world, T tileEntity) {
|
||||
super(world, tileEntity);
|
||||
@@ -27,29 +27,17 @@ public abstract class CraftLootable<T extends RandomizableContainerBlockEntity>
|
||||
}
|
||||
}
|
||||
|
||||
// Paper start - move to PaperLootableBlockInventory
|
||||
@Override
|
||||
public LootTable getLootTable() {
|
||||
return CraftLootTable.minecraftToBukkit(this.getSnapshot().lootTable);
|
||||
public net.minecraft.world.level.Level getNMSWorld() {
|
||||
return ((org.bukkit.craftbukkit.CraftWorld) this.getWorld()).getHandle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLootTable(LootTable table) {
|
||||
this.setLootTable(table, this.getSeed());
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSeed() {
|
||||
return this.getSnapshot().lootTableSeed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSeed(long seed) {
|
||||
this.setLootTable(this.getLootTable(), seed);
|
||||
}
|
||||
|
||||
public void setLootTable(LootTable table, long seed) {
|
||||
this.getSnapshot().setLootTable(CraftLootTable.bukkitToMinecraft(table), seed);
|
||||
public net.minecraft.world.RandomizableContainer getRandomizableContainer() {
|
||||
return this.getSnapshot();
|
||||
}
|
||||
// Paper end - move to PaperLootableBlockInventory
|
||||
|
||||
@Override
|
||||
public abstract CraftLootable<T> copy();
|
||||
|
||||
Reference in New Issue
Block a user