vine boom sound

This commit is contained in:
Owen1212055 2023-06-08 04:47:19 -04:00
parent bab0b3a7c3
commit aa1c25c88d
No known key found for this signature in database
GPG key ID: 2133292072886A30
166 changed files with 545 additions and 628 deletions

View file

@ -0,0 +1,114 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Brokkonaut <hannos17@gmx.de>
Date: Sat, 18 Dec 2021 19:43:36 +0100
Subject: [PATCH] Workaround for client lag spikes (MC-162253)
When crossing certain chunk boundaries, the client needlessly
calculates light maps for chunk neighbours. In some specific map
configurations, these calculations cause a 500ms+ freeze on the Client.
This patch basically serves as a workaround by sending light maps
to the client, so that it doesn't attempt to calculate them.
This mitigates the frametime impact to a minimum (but it's still there).
Original patch by: MeFisto94 <MeFisto94@users.noreply.github.com>
Co-authored-by: =?UTF-8?q?Dani=C3=ABl=20Goossens?= <daniel@goossens.ch>
Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 95c50a36dc1e03ae8ab8ca89a96d1ea56da8d94c..fbe209a66c77c47935ad026dd3e45e682af91fd8 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1376,6 +1376,46 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
});
}
+ // Paper start - Fix MC-162253
+ /**
+ * Returns the light mask for the given chunk consisting of all non-empty sections that may need sending.
+ */
+ private BitSet lightMask(final LevelChunk chunk) {
+ final net.minecraft.world.level.chunk.LevelChunkSection[] sections = chunk.getSections();
+ final BitSet mask = new BitSet(this.lightEngine.getLightSectionCount());
+
+ // There are 2 more light sections than chunk sections so when iterating over
+ // sections we have to increment the index by 1
+ for (int i = 0; i < sections.length; i++) {
+ if (!sections[i].hasOnlyAir()) {
+ // Whenever a section is not empty, it can change lighting for the section itself (i + 1), the section below, and the section above
+ mask.set(i);
+ mask.set(i + 1);
+ mask.set(i + 2);
+ i++; // We can skip the already set upper section
+ }
+ }
+ return mask;
+ }
+
+ /**
+ * Returns the ceiling light mask of all sections that are equal or lower to the highest non-empty section.
+ */
+ private BitSet ceilingLightMask(final LevelChunk chunk) {
+ final net.minecraft.world.level.chunk.LevelChunkSection[] sections = chunk.getSections();
+ for (int i = sections.length - 1; i >= 0; i--) {
+ if (!sections[i].hasOnlyAir()) {
+ // Add one to get the light section, one because blocks in the section above may change, and another because BitSet's toIndex is exclusive
+ final int highest = i + 3;
+ final BitSet mask = new BitSet(highest);
+ mask.set(0, highest);
+ return mask;
+ }
+ }
+ return new BitSet();
+ }
+ // Paper end - Fix MC-162253
+
// Paper start - Anti-Xray - Bypass
private void playerLoadedChunk(ServerPlayer player, MutableObject<java.util.Map<Object, ClientboundLevelChunkWithLightPacket>> cachedDataPackets, LevelChunk chunk) {
if (cachedDataPackets.getValue() == null) {
@@ -1384,6 +1424,45 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
Boolean shouldModify = chunk.getLevel().chunkPacketBlockController.shouldModify(player, chunk);
player.trackChunk(chunk.getPos(), (Packet) cachedDataPackets.getValue().computeIfAbsent(shouldModify, (s) -> {
+ // Paper start - Fix MC-162253
+ final int viewDistance = getEffectiveViewDistance();
+ final int playerChunkX = player.getBlockX() >> 4;
+ final int playerChunkZ = player.getBlockZ() >> 4;
+
+ // For all loaded neighbours, send sky light for empty sections above highest non-empty section (+1) of the center chunk
+ // otherwise the client will try to calculate lighting there on its own
+ final BitSet lightMask = lightMask(chunk);
+ if (!lightMask.isEmpty()) {
+ for (int x = -1; x <= 1; x++) {
+ for (int z = -1; z <= 1; z++) {
+ if (x == 0 && z == 0) {
+ continue;
+ }
+
+ if (!chunk.isNeighbourLoaded(x, z)) {
+ continue;
+ }
+
+ final int neighborChunkX = chunk.getPos().x + x;
+ final int neighborChunkZ = chunk.getPos().z + z;
+ final int distX = Math.abs(playerChunkX - neighborChunkX);
+ final int distZ = Math.abs(playerChunkZ - neighborChunkZ);
+ if (Math.max(distX, distZ) > viewDistance) {
+ continue;
+ }
+
+ final LevelChunk neighbor = chunk.getRelativeNeighbourIfLoaded(x, z);
+ final BitSet updateLightMask = (BitSet) lightMask.clone();
+ updateLightMask.andNot(ceilingLightMask(neighbor));
+ if (updateLightMask.isEmpty()) {
+ continue;
+ }
+
+ player.connection.send(new net.minecraft.network.protocol.game.ClientboundLightUpdatePacket(new ChunkPos(neighborChunkX, neighborChunkZ), this.lightEngine, updateLightMask, null, true));
+ }
+ }
+ }
+ // Paper end - Fix MC-162253
return new ClientboundLevelChunkWithLightPacket(chunk, this.lightEngine, (BitSet) null, (BitSet) null, true, (Boolean) s);
}));
// Paper end

View file

@ -0,0 +1,27 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: elmital <54907162+elmital@users.noreply.github.com>
Date: Fri, 16 Sep 2022 17:44:34 +0200
Subject: [PATCH] Fix: EndDragonFight killed statuses should be false for newly
created worlds
Do we need this
diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
index 230de1c71b0a6d6370df2fedb337cf0e332a7596..8cf4ae35eb66e69de32295d707db6845b4b02962 100644
--- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
+++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
@@ -113,9 +113,11 @@ public class EndDragonFight {
if (nbt.contains("ExitPortalLocation", 10)) {
this.portalLocation = NbtUtils.readBlockPos(nbt.getCompound("ExitPortalLocation"));
}
- } else {
- this.dragonKilled = true;
- this.previouslyKilled = true;
+ // Paper start - Killed statuses should be false for newly created worlds
+ // } else {
+ // this.dragonKilled = true;
+ // this.previouslyKilled = true;
+ // Paper end
}
if (nbt.contains("Gateways", 9)) {

View file

@ -0,0 +1,22 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
Date: Sat, 6 Aug 2022 18:10:14 -0400
Subject: [PATCH] Set position before player sending on dimension change
This causes a moment where the player entity is sent with the previous location, and the
teleport packet which is sent shortly after is meant to correct that.
This was fixed in 1.19.4 iirc
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index b30972c3ab19795e26589cd0cdd54c43414fe368..c5dc769d13fbc2a88a731d42669d0906ee306e4b 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1176,6 +1176,7 @@ public class ServerPlayer extends Player {
// CraftBukkit end
this.setLevel(worldserver);
+ this.moveTo(exit.getX(), exit.getY(), exit.getZ(), exit.getYaw(), exit.getPitch()); // Paper - Set the location before
this.connection.teleport(exit); // CraftBukkit - use internal teleport without event
this.connection.resetPosition();
worldserver.addDuringPortalTeleport(this);

View file

@ -0,0 +1,70 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
Date: Mon, 3 Apr 2023 18:46:49 +0200
Subject: [PATCH] Fix block place logic
TODO: what to do about dropped sign diff
diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java
index b0204af850ee182773ad458208cccd946ad148d5..ebee8de2ed831755b6fd154f6cc77ac993839bb9 100644
--- a/src/main/java/net/minecraft/world/item/BlockItem.java
+++ b/src/main/java/net/minecraft/world/item/BlockItem.java
@@ -131,7 +131,7 @@ public class BlockItem extends Item {
SoundType soundeffecttype = iblockdata1.getSoundType();
- // world.playSound(entityhuman, blockposition, this.getPlaceSound(iblockdata1), SoundCategory.BLOCKS, (soundeffecttype.getVolume() + 1.0F) / 2.0F, soundeffecttype.getPitch() * 0.8F);
+ if (entityhuman == null) world.playSound(entityhuman, blockposition, this.getPlaceSound(iblockdata1), net.minecraft.sounds.SoundSource.BLOCKS, (soundeffecttype.getVolume() + 1.0F) / 2.0F, soundeffecttype.getPitch() * 0.8F); // Paper - reintroduce this for the dispenser (i.e the shulker)
world.gameEvent(GameEvent.BLOCK_PLACE, blockposition, GameEvent.Context.of(entityhuman, iblockdata1));
if ((entityhuman == null || !entityhuman.getAbilities().instabuild) && itemstack != ItemStack.EMPTY) { // CraftBukkit
itemstack.shrink(1);
diff --git a/src/main/java/net/minecraft/world/item/HangingSignItem.java b/src/main/java/net/minecraft/world/item/HangingSignItem.java
index f8f8392ba16838449354e78f0ce69af37b0b7fed..91caa607a21bfb61849826949b59bcdac73af7ab 100644
--- a/src/main/java/net/minecraft/world/item/HangingSignItem.java
+++ b/src/main/java/net/minecraft/world/item/HangingSignItem.java
@@ -33,11 +33,14 @@ public class HangingSignItem extends StandingAndWallBlockItem {
protected boolean updateCustomBlockEntityTag(BlockPos pos, Level world, @Nullable Player player, ItemStack stack, BlockState state) {
boolean bl = super.updateCustomBlockEntityTag(pos, world, player, stack, state);
if (!world.isClientSide && !bl && player != null) {
- BlockEntity var8 = world.getBlockEntity(pos);
+ // Paper start - moved in ItemStack use handler for events cancellation
+ /*BlockEntity var8 = world.getBlockEntity(pos);
if (var8 instanceof SignBlockEntity) {
SignBlockEntity signBlockEntity = (SignBlockEntity)var8;
player.openTextEdit(signBlockEntity);
- }
+ }*/
+ SignItem.openSign = pos;
+ // Paper end
}
return bl;
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index fd6c80d6cb83ab2dc0fca913655eea8cc68dd5a6..a7533d18fe6148d7bfd3106b9cdcb6fa3347cf7c 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -458,13 +458,7 @@ public final class ItemStack {
if (tileentity instanceof JukeboxBlockEntity) {
JukeboxBlockEntity tileentityjukebox = (JukeboxBlockEntity) tileentity;
- // There can only be one
- ItemStack record = this.copy();
- if (!record.isEmpty()) {
- record.setCount(1);
- }
-
- tileentityjukebox.setFirstItem(record);
+ tileentityjukebox.setFirstItem(this.copy()); // Paper - sync this with record item, jukebox has now an inventory
world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.Context.of(entityhuman, world.getBlockState(blockposition)));
}
@@ -490,7 +484,7 @@ public final class ItemStack {
}
// SPIGOT-4678
- if (this.item instanceof SignItem && SignItem.openSign != null) {
+ if ((this.item instanceof SignItem || this.item instanceof HangingSignItem) && SignItem.openSign != null) { // Paper - trigger the hanging sign text editor now
try {
entityhuman.openTextEdit((SignBlockEntity) world.getBlockEntity(SignItem.openSign));
} finally {

View file

@ -0,0 +1,22 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
Date: Sun, 23 Apr 2023 18:22:50 -0400
Subject: [PATCH] Disable allowListing before received from client
The client does not send the packet needed to received this information until a little later, which can cause a condition where
despite a player having disabled listing, they are able to be seen for a brief moment. This causes the player to be listed as an Anonymous
Player until the actual configuration value is received from the client.
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index c4a070d445a0d834152eb53864eb08f4f90947ca..f4526885a57b804a754ab34675649a5466db300d 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -286,7 +286,7 @@ public class ServerPlayer extends Player {
this.recipeBook = new ServerRecipeBook();
this.lastSectionPos = SectionPos.of(0, 0, 0);
this.respawnDimension = Level.OVERWORLD;
- this.allowsListing = true;
+ this.allowsListing = false; // Paper - Set to false by default... wait for packet sent by client to populate
this.wardenSpawnTracker = new WardenSpawnTracker(0, 0, 0);
this.containerSynchronizer = new ContainerSynchronizer() {
@Override