Remove simplify remote item matching stuff for now
Twas broken for some time and I haven't had time to address it, this may be revisited later in a different way
This commit is contained in:
@ -1,33 +0,0 @@
|
||||
--- a/net/minecraft/network/HashedStack.java
|
||||
+++ b/net/minecraft/network/HashedStack.java
|
||||
@@ -17,7 +_,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
- public boolean matches(ItemStack stack, HashedPatchMap.HashGenerator hashGenerator) {
|
||||
+ public boolean matches(ItemStack stack, HashedPatchMap.HashGenerator hashGenerator, final boolean simplifyMatching) { // Paper - add flag to simplify remote matching logic
|
||||
return stack.isEmpty();
|
||||
}
|
||||
};
|
||||
@@ -27,7 +_,7 @@
|
||||
hashedStack -> hashedStack instanceof HashedStack.ActualItem actualItem ? Optional.of(actualItem) : Optional.empty()
|
||||
);
|
||||
|
||||
- boolean matches(ItemStack stack, HashedPatchMap.HashGenerator hashGenerator);
|
||||
+ boolean matches(ItemStack stack, HashedPatchMap.HashGenerator hashGenerator, final boolean simplifyMatching); // Paper - add flag to simplify remote matching logic
|
||||
|
||||
static HashedStack create(ItemStack stack, HashedPatchMap.HashGenerator hashGenerator) {
|
||||
return (HashedStack)(stack.isEmpty()
|
||||
@@ -47,10 +_,10 @@
|
||||
);
|
||||
|
||||
@Override
|
||||
- public boolean matches(ItemStack stack, HashedPatchMap.HashGenerator hashGenerator) {
|
||||
+ public boolean matches(ItemStack stack, HashedPatchMap.HashGenerator hashGenerator, final boolean simplifyMatching) { // Paper - add flag to simplify remote matching logic
|
||||
return this.count == stack.getCount()
|
||||
&& this.item.equals(stack.getItemHolder())
|
||||
- && this.components.matches(stack.getComponentsPatch(), hashGenerator);
|
||||
+ && (simplifyMatching || this.components.matches(stack.getComponentsPatch(), hashGenerator)); // Paper - add flag to simplify remote matching logic
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -18,7 +18,7 @@
|
||||
@Nullable
|
||||
private Vec3 startingToFallPosition;
|
||||
@Nullable
|
||||
@@ -281,6 +_,20 @@
|
||||
@@ -281,6 +_,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,26 +28,10 @@
|
||||
+ ServerPlayer.this.connection.send(new ClientboundContainerSetSlotPacket(ServerPlayer.this.inventoryMenu.containerId, ServerPlayer.this.inventoryMenu.incrementStateId(), net.minecraft.world.inventory.InventoryMenu.SHIELD_SLOT, ServerPlayer.this.inventoryMenu.getSlot(net.minecraft.world.inventory.InventoryMenu.SHIELD_SLOT).getItem().copy()));
|
||||
+ }
|
||||
+ // Paper end - Sync offhand slot in menus
|
||||
+
|
||||
+ // Paper start - add flag to simplify remote matching logic
|
||||
+ @Override
|
||||
+ public ServerPlayer player() {
|
||||
+ return ServerPlayer.this;
|
||||
+ }
|
||||
+ // Paper end - add flag to simplify remote matching logic
|
||||
+
|
||||
@Override
|
||||
public void sendSlotChange(AbstractContainerMenu container, int slot, ItemStack itemStack) {
|
||||
ServerPlayer.this.connection.send(new ClientboundContainerSetSlotPacket(container.containerId, container.incrementStateId(), slot, itemStack));
|
||||
@@ -302,7 +_,7 @@
|
||||
|
||||
@Override
|
||||
public RemoteSlot createSlot() {
|
||||
- return new RemoteSlot.Synchronized(this.cache::getUnchecked);
|
||||
+ return new RemoteSlot.Synchronized(this.cache::getUnchecked, ServerPlayer.this.getBukkitEntity().simplifyContainerDesyncCheck()); // Paper - add flag to simplify remote matching logic
|
||||
}
|
||||
};
|
||||
private final ContainerListener containerListener = new ContainerListener() {
|
||||
@@ -316,6 +_,32 @@
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,15 +1,9 @@
|
||||
--- a/net/minecraft/world/inventory/ContainerSynchronizer.java
|
||||
+++ b/net/minecraft/world/inventory/ContainerSynchronizer.java
|
||||
@@ -13,4 +_,12 @@
|
||||
@@ -13,4 +_,6 @@
|
||||
void sendDataChange(AbstractContainerMenu container, int id, int value);
|
||||
|
||||
RemoteSlot createSlot();
|
||||
+
|
||||
+ default void sendOffHandSlotChange() {} // Paper - Sync offhand slot in menus
|
||||
+
|
||||
+ // Paper start - add flag to simplify remote matching logic
|
||||
+ default net.minecraft.server.level.@org.jspecify.annotations.Nullable ServerPlayer player() {
|
||||
+ return null;
|
||||
+ }
|
||||
+ // Paper end - add flag to simplify remote matching logic
|
||||
}
|
||||
|
||||
@ -1,27 +0,0 @@
|
||||
--- a/net/minecraft/world/inventory/RemoteSlot.java
|
||||
+++ b/net/minecraft/world/inventory/RemoteSlot.java
|
||||
@@ -29,12 +_,14 @@
|
||||
|
||||
public static class Synchronized implements RemoteSlot {
|
||||
private final HashedPatchMap.HashGenerator hasher;
|
||||
+ private final boolean simplifyMatching; // Paper - add flag to simplify remote matching logic
|
||||
@Nullable
|
||||
private ItemStack remoteStack = null;
|
||||
@Nullable
|
||||
private HashedStack remoteHash = null;
|
||||
|
||||
- public Synchronized(HashedPatchMap.HashGenerator hasher) {
|
||||
+ public Synchronized(HashedPatchMap.HashGenerator hasher, final boolean simplifyMatching) { // Paper - add flag to simplify remote matching logic
|
||||
+ this.simplifyMatching = simplifyMatching; // Paper - add flag to simplify remote matching logic
|
||||
this.hasher = hasher;
|
||||
}
|
||||
|
||||
@@ -54,7 +_,7 @@
|
||||
public boolean matches(ItemStack stack) {
|
||||
if (this.remoteStack != null) {
|
||||
return ItemStack.matches(this.remoteStack, stack);
|
||||
- } else if (this.remoteHash != null && this.remoteHash.matches(stack, this.hasher)) {
|
||||
+ } else if (this.remoteHash != null && this.remoteHash.matches(stack, this.hasher, this.simplifyMatching)) { // Paper - add flag to simplify remote matching logic
|
||||
this.remoteStack = stack.copy();
|
||||
return true;
|
||||
} else {
|
||||
Reference in New Issue
Block a user