mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 03:48:01 +01:00
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 2b4b6d14 PR-1023: Convert InventoryView to interface CraftBukkit Changes: 68603b1c1 Use expanded interaction ranges for traced interact events eae9f760c PR-1414: Convert InventoryView to interface ee9eafe67 Fix Implementation for DamageSource#isIndirect for internal custom causing entity
This commit is contained in:
parent
35a678ddb3
commit
d04e9fafa4
@ -4310,9 +4310,9 @@ diff --git a/src/main/java/org/bukkit/inventory/InventoryView.java b/src/main/ja
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/InventoryView.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/InventoryView.java
|
||||
@@ -0,0 +0,0 @@ public abstract class InventoryView {
|
||||
return getPlayer().setWindowProperty(prop, value);
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public interface InventoryView {
|
||||
*/
|
||||
public boolean setProperty(@NotNull Property prop, int value);
|
||||
|
||||
+ // Paper start
|
||||
/**
|
||||
@ -4321,7 +4321,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
* @return The title.
|
||||
*/
|
||||
@NotNull
|
||||
+ public /*abstract*/ net.kyori.adventure.text.Component title() {
|
||||
+ default net.kyori.adventure.text.Component title() {
|
||||
+ return net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(this.getTitle());
|
||||
+ }
|
||||
+ // Paper end
|
||||
@ -4334,7 +4334,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ */
|
||||
+ @Deprecated // Paper
|
||||
+ @NotNull
|
||||
public abstract String getTitle();
|
||||
public String getTitle();
|
||||
|
||||
/**
|
||||
diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java
|
||||
|
@ -1139,6 +1139,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
public ItemStack getCursor() {
|
||||
return getView().getCursor();
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/event/inventory/InventoryType.java b/src/main/java/org/bukkit/event/inventory/InventoryType.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/inventory/InventoryType.java
|
||||
+++ b/src/main/java/org/bukkit/event/inventory/InventoryType.java
|
||||
@@ -0,0 +0,0 @@ public enum InventoryType {
|
||||
*
|
||||
* @deprecated use {@link #SMITHING}
|
||||
*/
|
||||
- @Deprecated
|
||||
+ @Deprecated(forRemoval = true) // Paper
|
||||
SMITHING_NEW(4, "Upgrade Gear"),
|
||||
;
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerBedLeaveEvent.java b/src/main/java/org/bukkit/event/player/PlayerBedLeaveEvent.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/player/PlayerBedLeaveEvent.java
|
||||
@ -1372,7 +1385,7 @@ diff --git a/src/main/java/org/bukkit/inventory/InventoryView.java b/src/main/ja
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/InventoryView.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/InventoryView.java
|
||||
@@ -0,0 +0,0 @@ public abstract class InventoryView {
|
||||
@@ -0,0 +0,0 @@ public interface InventoryView {
|
||||
* Gets the id of this view.
|
||||
*
|
||||
* @return the id of this view
|
||||
@ -1384,7 +1397,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public abstract class InventoryView {
|
||||
@@ -0,0 +0,0 @@ public interface InventoryView {
|
||||
/**
|
||||
* Get the item on the cursor of one of the viewing players.
|
||||
*
|
||||
@ -1395,9 +1408,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
*/
|
||||
- @Nullable
|
||||
+ @NotNull // Paper - fix nullability
|
||||
public final ItemStack getCursor() {
|
||||
return getPlayer().getItemOnCursor();
|
||||
}
|
||||
public ItemStack getCursor();
|
||||
|
||||
/**
|
||||
diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/ItemFactory.java
|
||||
|
@ -1,39 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Thu, 8 Jun 2023 14:45:30 -0700
|
||||
Subject: [PATCH] Properly remove the experimental smithing inventory type
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/inventory/InventoryType.java b/src/main/java/org/bukkit/event/inventory/InventoryType.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/inventory/InventoryType.java
|
||||
+++ b/src/main/java/org/bukkit/event/inventory/InventoryType.java
|
||||
@@ -0,0 +0,0 @@ public enum InventoryType {
|
||||
*
|
||||
* @deprecated use {@link #SMITHING}
|
||||
*/
|
||||
- @Deprecated
|
||||
+ @Deprecated(forRemoval = true) // Paper
|
||||
SMITHING_NEW(4, "Upgrade Gear"),
|
||||
;
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/inventory/InventoryView.java b/src/main/java/org/bukkit/inventory/InventoryView.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/InventoryView.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/InventoryView.java
|
||||
@@ -0,0 +0,0 @@ public abstract class InventoryView {
|
||||
type = InventoryType.SlotType.CRAFTING;
|
||||
break;
|
||||
case ANVIL:
|
||||
- case SMITHING:
|
||||
case CARTOGRAPHY:
|
||||
case GRINDSTONE:
|
||||
case MERCHANT:
|
||||
@@ -0,0 +0,0 @@ public abstract class InventoryView {
|
||||
}
|
||||
break;
|
||||
case LOOM:
|
||||
+ case SMITHING: // Paper
|
||||
case SMITHING_NEW:
|
||||
if (slot == 3) {
|
||||
type = InventoryType.SlotType.RESULT;
|
@ -4783,7 +4783,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryView.j
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryView.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryView.java
|
||||
@@ -0,0 +0,0 @@ public class CraftInventoryView extends InventoryView {
|
||||
@@ -0,0 +0,0 @@ public class CraftInventoryView extends CraftAbstractInventoryView {
|
||||
return CraftItemStack.asCraftMirror(this.container.getSlot(slot).getItem());
|
||||
}
|
||||
|
||||
|
@ -198,7 +198,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
@Override
|
||||
public boolean isIndirect() {
|
||||
- return this.getHandle().getEntity() != this.getHandle().getDamager();
|
||||
- return this.getHandle().getCausingDamager() != this.getHandle().getDamager();
|
||||
+ return !this.getHandle().isDirect(); // Paper - fix DamageSource API
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ public Collection<String> getSelectedEntities() {
|
||||
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().commands.fixTargetSelectorTagCompletion && this.source instanceof ServerPlayer player) {
|
||||
+ final Entity cameraEntity = player.getCamera();
|
||||
+ final double pickDistance = player.gameMode.getGameModeForPlayer().isCreative() ? 6.0F : 4.5F;
|
||||
+ final double pickDistance = player.entityInteractionRange();
|
||||
+ final Vec3 min = cameraEntity.getEyePosition(1.0F);
|
||||
+ final Vec3 viewVector = cameraEntity.getViewVector(1.0F);
|
||||
+ final Vec3 max = min.add(viewVector.x * pickDistance, viewVector.y * pickDistance, viewVector.z * pickDistance);
|
||||
|
@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
}
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
double d3 = this.player.gameMode.getGameModeForPlayer() == GameType.CREATIVE ? 5.0D : 4.5D;
|
||||
double d3 = Math.max(this.player.blockInteractionRange(), this.player.entityInteractionRange());
|
||||
// SPIGOT-5607: Only call interact event if no block or entity is being clicked. Use bukkit ray trace method, because it handles blocks and entities at the same time
|
||||
// SPIGOT-7429: Make sure to call PlayerInteractEvent for spectators and non-pickable entities
|
||||
- org.bukkit.util.RayTraceResult result = this.player.level().getWorld().rayTrace(origin, origin.getDirection(), d3, org.bukkit.FluidCollisionMode.NEVER, false, 0.1, entity -> {
|
||||
@ -39,7 +39,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ GameType gameType = this.player.gameMode.getGameModeForPlayer();
|
||||
+ if (gameType == GameType.ADVENTURE && result.getHitBlock() != null) {
|
||||
+ CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, ((org.bukkit.craftbukkit.block.CraftBlock) result.getHitBlock()).getPosition(), org.bukkit.craftbukkit.block.CraftBlock.blockFaceToNotch(result.getHitBlockFace()), this.player.getInventory().getSelected(), InteractionHand.MAIN_HAND);
|
||||
+ } else if (gameType != GameType.CREATIVE && result.getHitEntity() != null && origin.toVector().distanceSquared(result.getHitPosition()) > 3.0D * 3.0D) {
|
||||
+ } else if (gameType != GameType.CREATIVE && result.getHitEntity() != null && origin.toVector().distanceSquared(result.getHitPosition()) > this.player.entityInteractionRange() * this.player.entityInteractionRange()) {
|
||||
+ CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_AIR, this.player.getInventory().getSelected(), InteractionHand.MAIN_HAND);
|
||||
+ }
|
||||
+ } // Paper end - Call interact event
|
||||
|
@ -0,0 +1,26 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Thu, 8 Jun 2023 14:45:18 -0700
|
||||
Subject: [PATCH] Properly remove the experimental smithing inventory type
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftAbstractInventoryView.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftAbstractInventoryView.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftAbstractInventoryView.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftAbstractInventoryView.java
|
||||
@@ -0,0 +0,0 @@ public abstract class CraftAbstractInventoryView implements InventoryView {
|
||||
type = InventoryType.SlotType.CRAFTING;
|
||||
break;
|
||||
case ANVIL:
|
||||
- case SMITHING:
|
||||
case CARTOGRAPHY:
|
||||
case GRINDSTONE:
|
||||
case MERCHANT:
|
||||
@@ -0,0 +0,0 @@ public abstract class CraftAbstractInventoryView implements InventoryView {
|
||||
}
|
||||
break;
|
||||
case LOOM:
|
||||
+ case SMITHING: // Paper - properly remove experimental smithing inventory
|
||||
case SMITHING_NEW:
|
||||
if (slot == 3) {
|
||||
type = InventoryType.SlotType.RESULT;
|
@ -166,7 +166,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java
|
||||
@@ -0,0 +0,0 @@ public class CraftContainer extends AbstractContainerMenu {
|
||||
public CraftContainer(final Inventory inventory, final Player player, int id) {
|
||||
this(new InventoryView() {
|
||||
this(new CraftAbstractInventoryView() {
|
||||
|
||||
- private final String originalTitle = (inventory instanceof CraftInventoryCustom) ? ((CraftInventoryCustom.MinecraftInventory) ((CraftInventory) inventory).getInventory()).getTitle() : inventory.getType().getDefaultTitle();
|
||||
+ private final String originalTitle = inventory instanceof CraftInventoryCustom ? ((CraftInventoryCustom) inventory).getTitle() : inventory.getType().getDefaultTitle(); // Paper
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit e2160a18658bb7d19d303abd7a24605848d6912c
|
||||
Subproject commit 2b4b6d14241d3d96eb6b7d1888176146dc5895d4
|
@ -1 +1 @@
|
||||
Subproject commit 6ce17264243172b5e3d14309388e131f025d90f4
|
||||
Subproject commit 68603b1c1162f168efdfe8d989d8795587ef9842
|
Loading…
Reference in New Issue
Block a user