readd beacon effect cause

This commit is contained in:
Lulu13022002
2024-12-18 19:09:46 +01:00
parent dedc6b3394
commit 6126012369
102 changed files with 443 additions and 488 deletions

View File

@@ -106,7 +106,7 @@
+ org.bukkit.inventory.InventoryView view = this.getBukkitView();
+ org.bukkit.inventory.ItemStack newcursor = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemStack);
+ newcursor.setAmount(count);
+ java.util.Map<Integer, org.bukkit.inventory.ItemStack> eventmap = new java.util.HashMap<Integer, org.bukkit.inventory.ItemStack>();
+ java.util.Map<Integer, org.bukkit.inventory.ItemStack> eventmap = new java.util.HashMap<>();
+ for (java.util.Map.Entry<Integer, ItemStack> ditem : draggedSlots.entrySet()) {
+ eventmap.put(ditem.getKey(), org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(ditem.getValue()));
+ }
@@ -147,12 +147,11 @@
if (!this.getCarried().isEmpty()) {
if (clickAction == ClickAction.PRIMARY) {
- player.drop(this.getCarried(), true);
- this.setCarried(ItemStack.EMPTY);
+ // CraftBukkit start
+ ItemStack carried = this.getCarried();
+ this.setCarried(ItemStack.EMPTY);
+ player.drop(carried, true);
+ // CraftBukkit start
+ // CraftBukkit start
+ ItemStack carried = this.getCarried();
this.setCarried(ItemStack.EMPTY);
+ player.drop(carried, true);
+ // CraftBukkit end
} else {
player.drop(this.getCarried().split(1), true);
}

View File

@@ -18,7 +18,8 @@
super(MenuType.BREWING_STAND, containerId);
+ this.player = playerInventory; // CraftBukkit
checkContainerSize(brewingStandContainer, 5);
checkContainerDataCount(brewingStandData, 2);
- checkContainerDataCount(brewingStandData, 2);
+ checkContainerDataCount(brewingStandData, 3); // Paper - Add recipeBrewTime
this.brewingStand = brewingStandContainer;
this.brewingStandData = brewingStandData;
PotionBrewing potionBrewing = playerInventory.player.level().potionBrewing();
@@ -61,7 +62,7 @@
return ItemStack.EMPTY;
}
- } else if (BrewingStandMenu.PotionSlot.mayPlaceItem(itemStack)) {
+ } else if (PotionSlot.mayPlaceItem(itemStack, this.player.player.level().potionBrewing())) { // Paper - custom potion mixes
+ } else if (BrewingStandMenu.PotionSlot.mayPlaceItem(itemStack, this.player.player.level().potionBrewing())) { // Paper - custom potion mixes
if (!this.moveItemStackTo(item, 0, 3, false)) {
return ItemStack.EMPTY;
}

View File

@@ -49,7 +49,7 @@
public CartographyTableMenu(int containerId, Inventory playerInventory, final ContainerLevelAccess access) {
super(MenuType.CARTOGRAPHY_TABLE, containerId);
+ // Paper Start - Add missing InventoryHolders - move down
+ // Paper start - Add missing InventoryHolders - move down
+ this.container = new SimpleContainer(this.createBlockHolder(access), 2) { // Paper - Add missing InventoryHolders
+ @Override
+ public void setChanged() {
@@ -66,7 +66,7 @@
+ this.resultContainer = new ResultContainer(this.createBlockHolder(access)) { // Paper - Add missing InventoryHolders
+ @Override
+ public void setChanged() {
+ CartographyTableMenu.this.slotsChanged(this);
+ // CartographyTableMenu.this.slotsChanged(this); // Paper - Add CartographyItemEvent - do not recompute results if the result slot changes - allows to set the result slot via api
+ super.setChanged();
+ }
+ // CraftBukkit start
@@ -76,7 +76,7 @@
+ }
+ // CraftBukkit end
+ };
+ // Paper Start - Add missing InventoryHolders - move down
+ // Paper end - Add missing InventoryHolders - move down
this.access = access;
this.addSlot(new Slot(this.container, 0, 15, 15) {
@Override

View File

@@ -20,7 +20,7 @@
public final int[] levelClue = new int[]{-1, -1, -1};
+ // CraftBukkit start
+ private org.bukkit.craftbukkit.inventory.view.CraftEnchantmentView bukkitEntity = null;
+ private org.bukkit.entity.Player player;
+ private final org.bukkit.entity.Player player;
+ // CraftBukkit end
public EnchantmentMenu(int containerId, Inventory playerInventory) {
@@ -48,13 +48,11 @@
this.access = access;
this.addSlot(new Slot(this.enchantSlots, 0, 15, 47) {
@Override
@@ -80,13 +_,16 @@
@@ -80,13 +_,14 @@
this.addDataSlot(DataSlot.shared(this.levelClue, 0));
this.addDataSlot(DataSlot.shared(this.levelClue, 1));
this.addDataSlot(DataSlot.shared(this.levelClue, 2));
+ // CraftBukkit start
+ this.player = (org.bukkit.entity.Player) playerInventory.player.getBukkitEntity();
+ // CraftBukkit end
+ this.player = (org.bukkit.entity.Player) playerInventory.player.getBukkitEntity(); // CraftBukkit
}
@Override
@@ -180,10 +178,11 @@
return stillValid(this.access, player, Blocks.ENCHANTING_TABLE);
}
@@ -261,4 +_,22 @@
@@ -261,4 +_,23 @@
return itemStack;
}
+
+ // CraftBukkit start
+ @Override
+ public org.bukkit.craftbukkit.inventory.view.CraftEnchantmentView getBukkitView() {

View File

@@ -26,13 +26,13 @@
+ }
+ // CraftBukkit end
+
+ // CraftBukkit start - add player
+ // CraftBukkit start - add player inventory
+ public LecternMenu(int containerId, net.minecraft.world.entity.player.Inventory playerinventory) {
+ this(containerId, new SimpleContainer(1), new SimpleContainerData(1), playerinventory);
+ // CraftBukkit end - add player
+ }
+
+ public LecternMenu(int containerId, Container lectern, ContainerData lecternData, net.minecraft.world.entity.player.Inventory playerinventory) {
+ // CraftBukkit end - add player inventory
super(MenuType.LECTERN, containerId);
checkContainerSize(lectern, 1);
checkContainerDataCount(lecternData, 1);

View File

@@ -5,7 +5,7 @@
public int selectionHint;
private int futureXp;
+ // CraftBukkit 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<org.bukkit.entity.HumanEntity> transaction = new java.util.ArrayList<>();
+ private int maxStack = MAX_STACK;
+
+ public java.util.List<ItemStack> getContents() {
@@ -18,7 +18,7 @@
+
+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {
+ this.transaction.remove(player);
+ this.merchant.setTradingPlayer((Player) null); // SPIGOT-4860
+ this.merchant.setTradingPlayer(null); // SPIGOT-4860
+ }
+
+ public java.util.List<org.bukkit.entity.HumanEntity> getViewers() {
@@ -35,12 +35,12 @@
+ }
+
+ public org.bukkit.inventory.InventoryHolder getOwner() {
+ return (this.merchant instanceof net.minecraft.world.entity.npc.AbstractVillager abstractVillager) ? (org.bukkit.craftbukkit.entity.CraftAbstractVillager) ((net.minecraft.world.entity.npc.AbstractVillager) this.merchant).getBukkitEntity() : null;
+ return (this.merchant instanceof net.minecraft.world.entity.npc.AbstractVillager abstractVillager) ? (org.bukkit.craftbukkit.entity.CraftAbstractVillager) abstractVillager.getBukkitEntity() : null;
+ }
+
+ @Override
+ public org.bukkit.Location getLocation() {
+ return (this.merchant instanceof net.minecraft.world.entity.npc.AbstractVillager) ? ((net.minecraft.world.entity.npc.AbstractVillager) this.merchant).getBukkitEntity().getLocation() : null; // Paper - Fix inventories returning null Locations
+ return (this.merchant instanceof net.minecraft.world.entity.npc.AbstractVillager abstractVillager) ? abstractVillager.getBukkitEntity().getLocation() : null; // Paper - Fix inventories returning null Locations
+ }
+ // CraftBukkit end

View File

@@ -23,7 +23,7 @@
+ final ResultContainer resultContainer; // Paper - Add missing InventoryHolders - move down
+ // CraftBukkit start
+ private org.bukkit.craftbukkit.inventory.view.CraftStonecutterView bukkitEntity = null;
+ private org.bukkit.entity.Player player;
+ private final org.bukkit.entity.Player player;
+
+ @Override
+ public org.bukkit.craftbukkit.inventory.view.CraftStonecutterView getBukkitView() {