net/minecraft/world + Tadpole?

This commit is contained in:
Noah van der Aa 2024-12-13 19:17:03 +01:00
parent 18a25937bc
commit 7d42b87010
No known key found for this signature in database
GPG Key ID: 547D90BC6FF753CF
8 changed files with 173 additions and 218 deletions

View File

@ -1,14 +1,14 @@
--- a/net/minecraft/world/BossEvent.java --- a/net/minecraft/world/BossEvent.java
+++ b/net/minecraft/world/BossEvent.java +++ b/net/minecraft/world/BossEvent.java
@@ -13,6 +13,7 @@ @@ -13,6 +_,7 @@
protected boolean darkenScreen; protected boolean darkenScreen;
protected boolean playBossMusic; protected boolean playBossMusic;
protected boolean createWorldFog; protected boolean createWorldFog;
+ public net.kyori.adventure.bossbar.BossBar adventure; // Paper + public net.kyori.adventure.bossbar.BossBar adventure; // Paper
public BossEvent(UUID uuid, Component name, BossEvent.BossBarColor color, BossEvent.BossBarOverlay style) { public BossEvent(UUID id, Component name, BossEvent.BossBarColor color, BossEvent.BossBarOverlay overlay) {
this.id = uuid; this.id = id;
@@ -27,61 +28,75 @@ @@ -27,61 +_,75 @@
} }
public Component getName() { public Component getName() {
@ -26,9 +26,9 @@
return this.progress; return this.progress;
} }
public void setProgress(float percent) { public void setProgress(float progress) {
+ if (this.adventure != null) this.adventure.progress(percent); // Paper + if (this.adventure != null) this.adventure.progress(progress); // Paper
this.progress = percent; this.progress = progress;
} }
public BossEvent.BossBarColor getColor() { public BossEvent.BossBarColor getColor() {
@ -46,9 +46,9 @@
return this.overlay; return this.overlay;
} }
public void setOverlay(BossEvent.BossBarOverlay style) { public void setOverlay(BossEvent.BossBarOverlay overlay) {
+ if (this.adventure != null) this.adventure.overlay(io.papermc.paper.adventure.PaperAdventure.asAdventure(style)); // Paper + if (this.adventure != null) this.adventure.overlay(io.papermc.paper.adventure.PaperAdventure.asAdventure(overlay)); // Paper
this.overlay = style; this.overlay = overlay;
} }
public boolean shouldDarkenScreen() { public boolean shouldDarkenScreen() {
@ -67,15 +67,15 @@
return this.playBossMusic; return this.playBossMusic;
} }
public BossEvent setPlayBossMusic(boolean dragonMusic) { public BossEvent setPlayBossMusic(boolean playEndBossMusic) {
+ if (this.adventure != null) io.papermc.paper.adventure.PaperAdventure.setFlag(this.adventure, net.kyori.adventure.bossbar.BossBar.Flag.PLAY_BOSS_MUSIC, dragonMusic); // Paper + if (this.adventure != null) io.papermc.paper.adventure.PaperAdventure.setFlag(this.adventure, net.kyori.adventure.bossbar.BossBar.Flag.PLAY_BOSS_MUSIC, playEndBossMusic); // Paper
this.playBossMusic = dragonMusic; this.playBossMusic = playEndBossMusic;
return this; return this;
} }
public BossEvent setCreateWorldFog(boolean thickenFog) { public BossEvent setCreateWorldFog(boolean createFog) {
+ if (this.adventure != null) io.papermc.paper.adventure.PaperAdventure.setFlag(this.adventure, net.kyori.adventure.bossbar.BossBar.Flag.CREATE_WORLD_FOG, thickenFog); // Paper + if (this.adventure != null) io.papermc.paper.adventure.PaperAdventure.setFlag(this.adventure, net.kyori.adventure.bossbar.BossBar.Flag.CREATE_WORLD_FOG, createFog); // Paper
this.createWorldFog = thickenFog; this.createWorldFog = createFog;
return this; return this;
} }

View File

@ -0,0 +1,60 @@
--- a/net/minecraft/world/CompoundContainer.java
+++ b/net/minecraft/world/CompoundContainer.java
@@ -7,6 +_,48 @@
private final Container container1;
private final Container container2;
+ // Paper start - add fields and methods
+ public java.util.List<org.bukkit.entity.HumanEntity> transaction = new java.util.ArrayList<org.bukkit.entity.HumanEntity>();
+
+ public java.util.List<ItemStack> getContents() {
+ java.util.List<ItemStack> result = new java.util.ArrayList<>(this.getContainerSize());
+ for (int i = 0; i < this.getContainerSize(); i++) {
+ result.add(this.getItem(i));
+ }
+ return result;
+ }
+
+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) {
+ this.container1.onOpen(who);
+ this.container2.onOpen(who);
+ this.transaction.add(who);
+ }
+
+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) {
+ this.container1.onClose(who);
+ this.container2.onClose(who);
+ this.transaction.remove(who);
+ }
+
+ public java.util.List<org.bukkit.entity.HumanEntity> getViewers() {
+ return this.transaction;
+ }
+
+ public org.bukkit.inventory.InventoryHolder getOwner() {
+ return null; // This method won't be called since CraftInventoryDoubleChest doesn't defer to here
+ }
+
+ public void setMaxStackSize(int size) {
+ this.container1.setMaxStackSize(size);
+ this.container2.setMaxStackSize(size);
+ }
+
+ @Override
+ public org.bukkit.Location getLocation() {
+ return this.container1.getLocation(); // TODO: right?
+ }
+ // Paper end
+
public CompoundContainer(Container container1, Container container2) {
this.container1 = container1;
this.container2 = container2;
@@ -58,7 +_,7 @@
@Override
public int getMaxStackSize() {
- return this.container1.getMaxStackSize();
+ return Math.min(this.container1.getMaxStackSize(), this.container2.getMaxStackSize()); // Paper - check both sides
}
@Override

View File

@ -0,0 +1,36 @@
--- a/net/minecraft/world/Container.java
+++ b/net/minecraft/world/Container.java
@@ -24,9 +_,7 @@
void setItem(int slot, ItemStack stack);
- default int getMaxStackSize() {
- return 99;
- }
+ int getMaxStackSize(); // Paper
default int getMaxStackSize(ItemStack stack) {
return Math.min(this.getMaxStackSize(), stack.getMaxStackSize());
@@ -87,4 +_,22 @@
BlockPos blockPos = blockEntity.getBlockPos();
return level != null && level.getBlockEntity(blockPos) == blockEntity && player.canInteractWithBlock(blockPos, distance);
}
+
+ // Paper start
+ java.util.List<ItemStack> getContents();
+
+ void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who);
+
+ void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who);
+
+ java.util.List<org.bukkit.entity.HumanEntity> getViewers();
+
+ org.bukkit.inventory.@org.jetbrains.annotations.Nullable InventoryHolder getOwner(); // Paper - annotation
+
+ void setMaxStackSize(int size);
+
+ org.bukkit.Location getLocation();
+
+ int MAX_STACK = 99;
+ // Paper end
}

View File

@ -1,23 +1,23 @@
--- a/net/minecraft/world/RandomizableContainer.java --- a/net/minecraft/world/RandomizableContainer.java
+++ b/net/minecraft/world/RandomizableContainer.java +++ b/net/minecraft/world/RandomizableContainer.java
@@ -28,7 +28,7 @@ @@ -28,7 +_,7 @@
void setLootTable(@Nullable ResourceKey<LootTable> lootTable); void setLootTable(@Nullable ResourceKey<LootTable> lootTable);
- default void setLootTable(ResourceKey<LootTable> lootTableId, long lootTableSeed) { - default void setLootTable(ResourceKey<LootTable> lootTable, long seed) {
+ default void setLootTable(@Nullable ResourceKey<LootTable> lootTableId, long lootTableSeed) { // Paper - add nullable + default void setLootTable(@Nullable ResourceKey<LootTable> lootTable, long seed) { // Paper - add nullable
this.setLootTable(lootTableId); this.setLootTable(lootTable);
this.setLootTableSeed(lootTableSeed); this.setLootTableSeed(seed);
} }
@@ -50,14 +50,15 @@ @@ -50,14 +_,15 @@
default boolean tryLoadLootTable(CompoundTag nbt) { default boolean tryLoadLootTable(CompoundTag tag) {
if (nbt.contains("LootTable", 8)) { if (tag.contains("LootTable", 8)) {
- this.setLootTable(ResourceKey.create(Registries.LOOT_TABLE, ResourceLocation.parse(nbt.getString("LootTable")))); - this.setLootTable(ResourceKey.create(Registries.LOOT_TABLE, ResourceLocation.parse(tag.getString("LootTable"))));
+ this.setLootTable(net.minecraft.Optionull.map(ResourceLocation.tryParse(nbt.getString("LootTable")), rl -> ResourceKey.create(Registries.LOOT_TABLE, rl))); // Paper - Validate ResourceLocation + this.setLootTable(net.minecraft.Optionull.map(ResourceLocation.tryParse(tag.getString("LootTable")), rl -> ResourceKey.create(Registries.LOOT_TABLE, rl))); // Paper - Validate ResourceLocation
+ if (this.lootableData() != null && this.getLootTable() != null) this.lootableData().loadNbt(nbt); // Paper - LootTable API + if (this.lootableData() != null && this.getLootTable() != null) this.lootableData().loadNbt(tag); // Paper - LootTable API
if (nbt.contains("LootTableSeed", 4)) { if (tag.contains("LootTableSeed", 4)) {
this.setLootTableSeed(nbt.getLong("LootTableSeed")); this.setLootTableSeed(tag.getLong("LootTableSeed"));
} else { } else {
this.setLootTableSeed(0L); this.setLootTableSeed(0L);
} }
@ -27,14 +27,14 @@
} else { } else {
return false; return false;
} }
@@ -69,26 +70,44 @@ @@ -69,26 +_,42 @@
return false; return false;
} else { } else {
nbt.putString("LootTable", resourceKey.location().toString()); tag.putString("LootTable", lootTable.location().toString());
+ if (this.lootableData() != null) this.lootableData().saveNbt(nbt); // Paper - LootTable API + if (this.lootableData() != null) this.lootableData().saveNbt(tag); // Paper - LootTable API
long l = this.getLootTableSeed(); long lootTableSeed = this.getLootTableSeed();
if (l != 0L) { if (lootTableSeed != 0L) {
nbt.putLong("LootTableSeed", l); tag.putLong("LootTableSeed", lootTableSeed);
} }
- return true; - return true;
@ -50,10 +50,10 @@
+ // Paper end - LootTable API + // Paper end - LootTable API
Level level = this.getLevel(); Level level = this.getLevel();
BlockPos blockPos = this.getBlockPos(); BlockPos blockPos = this.getBlockPos();
ResourceKey<LootTable> resourceKey = this.getLootTable(); ResourceKey<LootTable> lootTable = this.getLootTable();
- if (resourceKey != null && level != null && level.getServer() != null) { - if (lootTable != null && level != null && level.getServer() != null) {
+ // Paper start - LootTable API + // Paper start - LootTable API
+ lootReplenish: if (resourceKey != null && level != null && level.getServer() != null) { + lootReplenish: if (lootTable != null && level != null && level.getServer() != null) {
+ if (this.lootableData() != null && !this.lootableData().shouldReplenish(this, com.destroystokyo.paper.loottable.PaperLootableInventoryData.CONTAINER, player)) { + if (this.lootableData() != null && !this.lootableData().shouldReplenish(this, com.destroystokyo.paper.loottable.PaperLootableInventoryData.CONTAINER, player)) {
+ if (forceClearLootTable) { + if (forceClearLootTable) {
+ this.setLootTable(null); + this.setLootTable(null);
@ -61,27 +61,25 @@
+ break lootReplenish; + break lootReplenish;
+ } + }
+ // Paper end - LootTable API + // Paper end - LootTable API
LootTable lootTable = level.getServer().reloadableRegistries().getLootTable(resourceKey); LootTable lootTable1 = level.getServer().reloadableRegistries().getLootTable(lootTable);
if (player instanceof ServerPlayer) { if (player instanceof ServerPlayer) {
CriteriaTriggers.GENERATE_LOOT.trigger((ServerPlayer)player, resourceKey); CriteriaTriggers.GENERATE_LOOT.trigger((ServerPlayer)player, lootTable);
} }
- this.setLootTable(null); + if (forceClearLootTable || this.lootableData() == null || this.lootableData().shouldClearLootTable(this, com.destroystokyo.paper.loottable.PaperLootableInventoryData.CONTAINER, player)) { // Paper - LootTable API
+ // Paper start - LootTable API this.setLootTable(null);
+ if (forceClearLootTable || this.lootableData() == null || this.lootableData().shouldClearLootTable(this, com.destroystokyo.paper.loottable.PaperLootableInventoryData.CONTAINER, player)) { + } // Paper - LootTable API
+ this.setLootTable(null);
+ }
+ // Paper end - LootTable API
LootParams.Builder builder = new LootParams.Builder((ServerLevel)level).withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(blockPos)); LootParams.Builder builder = new LootParams.Builder((ServerLevel)level).withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(blockPos));
if (player != null) { if (player != null) {
builder.withLuck(player.getLuck()).withParameter(LootContextParams.THIS_ENTITY, player); builder.withLuck(player.getLuck()).withParameter(LootContextParams.THIS_ENTITY, player);
@@ -97,4 +116,16 @@ @@ -97,4 +_,17 @@
lootTable.fill(this, builder.create(LootContextParamSets.CHEST), this.getLootTableSeed()); lootTable1.fill(this, builder.create(LootContextParamSets.CHEST), this.getLootTableSeed());
} }
} }
+ +
+ // Paper start - LootTable API + // Paper start - LootTable API
+ @Nullable @org.jetbrains.annotations.Contract(pure = true) + @Nullable
+ @org.jetbrains.annotations.Contract(pure = true)
+ default com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData() { + default com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData() {
+ return null; // some containers don't really have a "replenish" ability like decorated pots + return null; // some containers don't really have a "replenish" ability like decorated pots
+ } + }

View File

@ -1,24 +1,11 @@
--- a/net/minecraft/world/SimpleContainer.java --- a/net/minecraft/world/SimpleContainer.java
+++ b/net/minecraft/world/SimpleContainer.java +++ b/net/minecraft/world/SimpleContainer.java
@@ -14,18 +14,98 @@ @@ -19,7 +_,84 @@
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
+// CraftBukkit start
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+import org.bukkit.entity.HumanEntity;
+// CraftBukkit end
+
public class SimpleContainer implements Container, StackedContentsCompatible {
private final int size;
public final NonNullList<ItemStack> items;
@Nullable @Nullable
private List<ContainerListener> listeners; private List<ContainerListener> listeners;
+
+ // CraftBukkit start - add fields and methods + // Paper start - add fields and methods
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>(); + public List<org.bukkit.entity.HumanEntity> transaction = new java.util.ArrayList<>();
+ private int maxStack = MAX_STACK; + private int maxStack = MAX_STACK;
+ protected @Nullable org.bukkit.inventory.InventoryHolder bukkitOwner; // Paper - annotation + protected @Nullable org.bukkit.inventory.InventoryHolder bukkitOwner; // Paper - annotation
+ +
@ -26,15 +13,15 @@
+ return this.items; + return this.items;
+ } + }
+ +
+ public void onOpen(CraftHumanEntity who) { + public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) {
+ this.transaction.add(who); + this.transaction.add(who);
+ } + }
+ +
+ public void onClose(CraftHumanEntity who) { + public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) {
+ this.transaction.remove(who); + this.transaction.remove(who);
+ } + }
+ +
+ public List<HumanEntity> getViewers() { + public List<org.bukkit.entity.HumanEntity> getViewers() {
+ return this.transaction; + return this.transaction;
+ } + }
+ +
@ -55,9 +42,9 @@
+ // Paper end - Add missing InventoryHolders + // Paper end - Add missing InventoryHolders
+ return this.bukkitOwner; + return this.bukkitOwner;
+ } + }
+
+ @Override + @Override
+ public Location getLocation() { + public org.bukkit.Location getLocation() {
+ // Paper start - Fix inventories returning null Locations + // Paper start - Fix inventories returning null Locations
+ // When the block inventory does not have a tile state that implements getLocation, e. g. composters + // When the block inventory does not have a tile state that implements getLocation, e. g. composters
+ if (this.bukkitOwner instanceof org.bukkit.inventory.BlockInventoryHolder blockInventoryHolder) { + if (this.bukkitOwner instanceof org.bukkit.inventory.BlockInventoryHolder blockInventoryHolder) {
@ -77,27 +64,24 @@
+ this.items.set(slot, original.items.get(slot).copy()); + this.items.set(slot, original.items.get(slot).copy());
+ } + }
+ } + }
+ // Paper end
+ +
public SimpleContainer(int size) { public SimpleContainer(int size) {
- this.size = size;
- this.items = NonNullList.withSize(size, ItemStack.EMPTY);
+ this(size, null); + this(size, null);
+ } + }
+
+ // Paper start - Add missing InventoryHolders + // Paper start - Add missing InventoryHolders
+ private @Nullable java.util.function.Supplier<? extends org.bukkit.inventory.InventoryHolder> bukkitOwnerCreator; + private @Nullable java.util.function.Supplier<? extends org.bukkit.inventory.InventoryHolder> bukkitOwnerCreator;
+
+ public SimpleContainer(java.util.function.Supplier<? extends org.bukkit.inventory.InventoryHolder> bukkitOwnerCreator, int size) { + public SimpleContainer(java.util.function.Supplier<? extends org.bukkit.inventory.InventoryHolder> bukkitOwnerCreator, int size) {
+ this(size); + this(size);
+ this.bukkitOwnerCreator = bukkitOwnerCreator; + this.bukkitOwnerCreator = bukkitOwnerCreator;
}
+ // Paper end - Add missing InventoryHolders
+ public SimpleContainer(int i, org.bukkit.inventory.InventoryHolder owner) {
+ this.bukkitOwner = owner;
+ // CraftBukkit end
+ this.size = i;
+ this.items = NonNullList.withSize(i, ItemStack.EMPTY);
+ } + }
+ // Paper end - Add missing InventoryHolders
+ +
public SimpleContainer(ItemStack... items) { + public SimpleContainer(int size, org.bukkit.inventory.InventoryHolder owner) {
this.size = items.length; + this.bukkitOwner = owner;
this.items = NonNullList.of(ItemStack.EMPTY, items); + // Paper end
this.size = size;
this.items = NonNullList.withSize(size, ItemStack.EMPTY);
}

View File

@ -18,17 +18,17 @@
} }
} }
@@ -122,12 +_,14 @@ @@ -122,12 +_,14 @@
public void addAdditionalSaveData(CompoundTag compound) { public void addAdditionalSaveData(CompoundTag tag) {
super.addAdditionalSaveData(compound); super.addAdditionalSaveData(tag);
compound.putInt("Age", this.age); tag.putInt("Age", this.age);
+ compound.putBoolean("AgeLocked", this.ageLocked); // Paper + tag.putBoolean("AgeLocked", this.ageLocked); // Paper
} }
@Override @Override
public void readAdditionalSaveData(CompoundTag compound) { public void readAdditionalSaveData(CompoundTag tag) {
super.readAdditionalSaveData(compound); super.readAdditionalSaveData(tag);
this.setAge(compound.getInt("Age")); this.setAge(tag.getInt("Age"));
+ this.ageLocked = compound.getBoolean("AgeLocked"); // Paper + this.ageLocked = tag.getBoolean("AgeLocked"); // Paper
} }
@Nullable @Nullable
@ -67,18 +67,18 @@
private void ageUp() { private void ageUp() {
if (this.level() instanceof ServerLevel serverLevel) { if (this.level() instanceof ServerLevel serverLevel) {
- this.convertTo(EntityType.FROG, ConversionParams.single(this, false, false), mob -> { - this.convertTo(EntityType.FROG, ConversionParams.single(this, false, false), mob -> {
+ Frog converted = this.convertTo(EntityType.FROG, ConversionParams.single(this, false, false), mob -> { // CraftBukkit + Frog converted = this.convertTo(EntityType.FROG, ConversionParams.single(this, false, false), mob -> { // Paper
mob.finalizeSpawn(serverLevel, this.level().getCurrentDifficultyAt(mob.blockPosition()), EntitySpawnReason.CONVERSION, null); mob.finalizeSpawn(serverLevel, this.level().getCurrentDifficultyAt(mob.blockPosition()), EntitySpawnReason.CONVERSION, null);
mob.setPersistenceRequired(); mob.setPersistenceRequired();
mob.fudgePositionAfterSizeChange(this.getDimensions(this.getPose())); mob.fudgePositionAfterSizeChange(this.getDimensions(this.getPose()));
this.playSound(SoundEvents.TADPOLE_GROW_UP, 0.15F, 1.0F); this.playSound(SoundEvents.TADPOLE_GROW_UP, 0.15F, 1.0F);
- }); - });
+ // CraftBukkit start + // Paper start
+ }, org.bukkit.event.entity.EntityTransformEvent.TransformReason.METAMORPHOSIS, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.METAMORPHOSIS); + }, org.bukkit.event.entity.EntityTransformEvent.TransformReason.METAMORPHOSIS, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.METAMORPHOSIS);
+ if (converted == null) { + if (converted == null) {
+ this.setAge(0); // Sets the age to 0 for avoid a loop if the event is canceled + this.setAge(0); // Sets the age to 0 for avoid a loop if the event is canceled
+ } + }
+ // CraftBukkit end + // Paper end
} }
} }

View File

@ -1,74 +0,0 @@
--- a/net/minecraft/world/CompoundContainer.java
+++ b/net/minecraft/world/CompoundContainer.java
@@ -3,11 +3,62 @@
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
+// CraftBukkit start
+import java.util.ArrayList;
+import java.util.List;
+import org.bukkit.Location;
+
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+import org.bukkit.entity.HumanEntity;
+// CraftBukkit end
+
public class CompoundContainer implements Container {
public final Container container1;
public final Container container2;
+ // CraftBukkit start - add fields and methods
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
+
+ public List<ItemStack> getContents() {
+ List<ItemStack> result = new ArrayList<ItemStack>(this.getContainerSize());
+ for (int i = 0; i < this.getContainerSize(); i++) {
+ result.add(this.getItem(i));
+ }
+ return result;
+ }
+
+ public void onOpen(CraftHumanEntity who) {
+ this.container1.onOpen(who);
+ this.container2.onOpen(who);
+ this.transaction.add(who);
+ }
+
+ public void onClose(CraftHumanEntity who) {
+ this.container1.onClose(who);
+ this.container2.onClose(who);
+ this.transaction.remove(who);
+ }
+
+ public List<HumanEntity> getViewers() {
+ return this.transaction;
+ }
+
+ public org.bukkit.inventory.InventoryHolder getOwner() {
+ return null; // This method won't be called since CraftInventoryDoubleChest doesn't defer to here
+ }
+
+ public void setMaxStackSize(int size) {
+ this.container1.setMaxStackSize(size);
+ this.container2.setMaxStackSize(size);
+ }
+
+ @Override
+ public Location getLocation() {
+ return this.container1.getLocation(); // TODO: right?
+ }
+ // CraftBukkit end
+
public CompoundContainer(Container first, Container second) {
this.container1 = first;
this.container2 = second;
@@ -54,7 +105,7 @@
@Override
public int getMaxStackSize() {
- return this.container1.getMaxStackSize();
+ return Math.min(this.container1.getMaxStackSize(), this.container2.getMaxStackSize()); // CraftBukkit - check both sides
}
@Override

View File

@ -1,49 +0,0 @@
--- a/net/minecraft/world/Container.java
+++ b/net/minecraft/world/Container.java
@@ -6,8 +6,12 @@
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
+// CraftBukkit start
+import net.minecraft.world.item.crafting.RecipeHolder;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+// CraftBukkit end
public interface Container extends Clearable {
@@ -25,9 +29,7 @@
void setItem(int slot, ItemStack stack);
- default int getMaxStackSize() {
- return 99;
- }
+ int getMaxStackSize(); // CraftBukkit
default int getMaxStackSize(ItemStack stack) {
return Math.min(this.getMaxStackSize(), stack.getMaxStackSize());
@@ -91,4 +93,22 @@
return world == null ? false : (world.getBlockEntity(blockposition) != blockEntity ? false : player.canInteractWithBlock(blockposition, (double) range));
}
+
+ // CraftBukkit start
+ java.util.List<ItemStack> getContents();
+
+ void onOpen(CraftHumanEntity who);
+
+ void onClose(CraftHumanEntity who);
+
+ java.util.List<org.bukkit.entity.HumanEntity> getViewers();
+
+ org.bukkit.inventory.@org.jetbrains.annotations.Nullable InventoryHolder getOwner(); // Paper - annotation
+
+ void setMaxStackSize(int size);
+
+ org.bukkit.Location getLocation();
+
+ int MAX_STACK = 99;
+ // CraftBukkit end
}