1
0
Fork 0
mirror of https://github.com/PaperMC/Paper.git synced 2025-02-24 13:30:48 +01:00

Apply more API-implementing patches

This commit is contained in:
Jason Penilla 2024-04-24 17:36:24 -07:00
parent 21581c8111
commit faad8cbd62
15 changed files with 26 additions and 37 deletions

View file

@ -64,19 +64,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ itemstack1 = itemstack1.copy(); + itemstack1 = itemstack1.copy();
+ } + }
+ // Paper end - Add PlayerTradeEvent and PlayerPurchaseEvent + // Paper end - Add PlayerTradeEvent and PlayerPurchaseEvent
if (!itemstack1.isEmpty() && ItemStack.isSameItemSameTags(stack, itemstack1)) { if (!itemstack1.isEmpty() && ItemStack.isSameItemSameComponents(stack, itemstack1)) {
int l = itemstack1.getCount() + stack.getCount(); l = itemstack1.getCount() + stack.getCount();
int i1 = slot.getMaxStackSize(itemstack1);
if (l <= stack.getMaxStackSize()) { @@ -0,0 +0,0 @@ public abstract class AbstractContainerMenu {
if (l <= i1) {
stack.setCount(0); stack.setCount(0);
itemstack1.setCount(l); itemstack1.setCount(l);
+ if (!isCheck) { // Paper - Add PlayerTradeEvent and PlayerPurchaseEvent + if (!isCheck) { // Paper - Add PlayerTradeEvent and PlayerPurchaseEvent
slot.setChanged(); slot.setChanged();
+ } // Paper - Add PlayerTradeEvent and PlayerPurchaseEvent + } // Paper - Add PlayerTradeEvent and PlayerPurchaseEvent
flag1 = true; flag1 = true;
} else if (itemstack1.getCount() < stack.getMaxStackSize()) { } else if (itemstack1.getCount() < i1) {
stack.shrink(stack.getMaxStackSize() - itemstack1.getCount()); stack.shrink(i1 - itemstack1.getCount());
itemstack1.setCount(stack.getMaxStackSize()); itemstack1.setCount(i1);
+ if (!isCheck) { // Paper - Add PlayerTradeEvent and PlayerPurchaseEvent + if (!isCheck) { // Paper - Add PlayerTradeEvent and PlayerPurchaseEvent
slot.setChanged(); slot.setChanged();
+ } // Paper - Add PlayerTradeEvent and PlayerPurchaseEvent + } // Paper - Add PlayerTradeEvent and PlayerPurchaseEvent
@ -93,25 +94,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ // Paper end - Add PlayerTradeEvent and PlayerPurchaseEvent + // Paper end - Add PlayerTradeEvent and PlayerPurchaseEvent
if (itemstack1.isEmpty() && slot.mayPlace(stack)) { if (itemstack1.isEmpty() && slot.mayPlace(stack)) {
if (stack.getCount() > slot.getMaxStackSize()) { l = slot.getMaxStackSize(stack);
+ // Paper start - Add PlayerTradeEvent and PlayerPurchaseEvent + // Paper start - Add PlayerTradeEvent and PlayerPurchaseEvent
+ if (isCheck) { + if (isCheck) {
+ stack.shrink(slot.getMaxStackSize()); + stack.shrink(Math.min(stack.getCount(), l));
+ } else { + } else {
+ // Paper end - Add PlayerTradeEvent and PlayerPurchaseEvent + // Paper end - Add PlayerTradeEvent and PlayerPurchaseEvent
slot.setByPlayer(stack.split(slot.getMaxStackSize())); slot.setByPlayer(stack.split(Math.min(stack.getCount(), l)));
+ } // Paper - Add PlayerTradeEvent and PlayerPurchaseEvent
} else {
+ // Paper start - Add PlayerTradeEvent and PlayerPurchaseEvent
+ if (isCheck) {
+ stack.shrink(stack.getCount());
+ } else {
+ // Paper end - Add PlayerTradeEvent and PlayerPurchaseEvent
slot.setByPlayer(stack.split(stack.getCount()));
+ } // Paper - Add PlayerTradeEvent and PlayerPurchaseEvent
}
+ if (!isCheck) { // Paper - Add PlayerTradeEvent and PlayerPurchaseEvent
slot.setChanged(); slot.setChanged();
+ } // Paper - Add PlayerTradeEvent and PlayerPurchaseEvent + } // Paper - Add PlayerTradeEvent and PlayerPurchaseEvent
flag1 = true; flag1 = true;

View file

@ -12,21 +12,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/level/block/entity/ConduitBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/ConduitBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/ConduitBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/ConduitBlockEntity.java
@@ -0,0 +0,0 @@ public class ConduitBlockEntity extends BlockEntity { @@ -0,0 +0,0 @@ public class ConduitBlockEntity extends BlockEntity {
public static int getRange(List<BlockPos> list) {
private static void applyEffects(Level world, BlockPos pos, List<BlockPos> activatingBlocks) { // CraftBukkit end
int i = activatingBlocks.size(); int i = list.size();
- int j = i / 7 * 16; - int j = i / 7 * 16;
+ int j = i / 7 * 16; // Paper - Conduit API; diff on change + int j = i / 7 * 16; // Paper - Conduit API; diff on change
int k = pos.getX(); // CraftBukkit start
int l = pos.getY(); return j;
int i1 = pos.getZ(); }
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftConduit.java b/src/main/java/org/bukkit/craftbukkit/block/CraftConduit.java diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftConduit.java b/src/main/java/org/bukkit/craftbukkit/block/CraftConduit.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftConduit.java --- a/src/main/java/org/bukkit/craftbukkit/block/CraftConduit.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftConduit.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftConduit.java
@@ -0,0 +0,0 @@ public class CraftConduit extends CraftBlockEntityState<ConduitBlockEntity> impl @@ -0,0 +0,0 @@ public class CraftConduit extends CraftBlockEntityState<ConduitBlockEntity> impl
public CraftConduit copy() { AABB bounds = ConduitBlockEntity.getDestroyRangeAABB(this.getPosition());
return new CraftConduit(this); return new BoundingBox(bounds.minX, bounds.minY, bounds.minZ, bounds.maxX, bounds.maxY, bounds.maxZ);
} }
+ +
+ // Paper start - Conduit API + // Paper start - Conduit API

View file

@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
@@ -0,0 +0,0 @@ public final class CraftItemStack extends ItemStack { @@ -0,0 +0,0 @@ public final class CraftItemStack extends ItemStack {
static boolean hasItemMeta(net.minecraft.world.item.ItemStack item) { static boolean hasItemMeta(net.minecraft.world.item.ItemStack item) {
return !(item == null || item.getTag() == null || item.getTag().isEmpty()); return !(item == null || item.getComponentsPatch().isEmpty());
} }
+ // Paper start - with type + // Paper start - with type
+ @Override + @Override

View file

@ -12,8 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftHopper.java --- a/src/main/java/org/bukkit/craftbukkit/block/CraftHopper.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftHopper.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftHopper.java
@@ -0,0 +0,0 @@ public class CraftHopper extends CraftLootable<HopperBlockEntity> implements Hop @@ -0,0 +0,0 @@ public class CraftHopper extends CraftLootable<HopperBlockEntity> implements Hop
public CraftHopper copy() { public CraftHopper copy(Location location) {
return new CraftHopper(this); return new CraftHopper(this, location);
} }
+ +
+ // Paper start - Expanded Hopper API + // Paper start - Expanded Hopper API