--- 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 { @@ -26,9 +30,7 @@ void setItem(int slot, ItemStack stack); - default int getMaxStackSize() { - return 64; - } + int getMaxStackSize(); // CraftBukkit void setChanged(); @@ -38,11 +40,11 @@ default void stopOpen(Player player) {} - default boolean canPlaceItem(int i, ItemStack itemstack) { + default boolean canPlaceItem(int index, ItemStack stack) { return true; } - default boolean canTakeItem(Container container, int i, ItemStack itemstack) { + default boolean canTakeItem(Container target, int index, ItemStack stack) { return true; } @@ -78,14 +80,39 @@ return false; } - static boolean stillValidBlockEntity(BlockEntity blockentity, Player player) { - return stillValidBlockEntity(blockentity, player, 8); + static boolean stillValidBlockEntity(BlockEntity blockEntity, Player player) { + return stillValidBlockEntity(blockEntity, player, 8); } - static boolean stillValidBlockEntity(BlockEntity blockentity, Player player, int i) { - Level level = blockentity.getLevel(); - BlockPos blockpos = blockentity.getBlockPos(); + static boolean stillValidBlockEntity(BlockEntity blockEntity, Player player, int maxDistance) { + Level world = blockEntity.getLevel(); + BlockPos blockposition = blockEntity.getBlockPos(); - return level == null ? false : (level.getBlockEntity(blockpos) != blockentity ? false : player.distanceToSqr((double) blockpos.getX() + 0.5D, (double) blockpos.getY() + 0.5D, (double) blockpos.getZ() + 0.5D) <= (double) (i * i)); + return world == null ? false : (world.getBlockEntity(blockposition) != blockEntity ? false : player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) <= (double) (maxDistance * maxDistance)); } + + // CraftBukkit start + java.util.List getContents(); + + void onOpen(CraftHumanEntity who); + + void onClose(CraftHumanEntity who); + + java.util.List getViewers(); + + org.bukkit.inventory.InventoryHolder getOwner(); + + void setMaxStackSize(int size); + + org.bukkit.Location getLocation(); + + default RecipeHolder getCurrentRecipe() { + return null; + } + + default void setCurrentRecipe(RecipeHolder recipe) { + } + + int MAX_STACK = 64; + // CraftBukkit end }