Update to 1.19.2

This commit is contained in:
Cryptite
2022-08-12 12:06:07 -05:00
parent 19995071a3
commit a85661d795
24 changed files with 1371 additions and 19 deletions

View File

@@ -4,7 +4,7 @@ plugins {
java
`maven-publish`
id("com.github.johnrengelman.shadow") version "7.1.2" apply false
id("io.papermc.paperweight.patcher") version "1.3.6"
id("io.papermc.paperweight.patcher") version "1.3.8"
}
val paperMavenPublicUrl = "https://papermc.io/repo/repository/maven-public/"
@@ -18,7 +18,7 @@ repositories {
dependencies {
remapper("net.fabricmc:tiny-remapper:0.8.2:fat")
decompiler("net.minecraftforge:forgeflower:1.5.605.7")
decompiler("net.minecraftforge:forgeflower:1.5.498.29")
paperclip("io.papermc:paperclip:3.0.2")
}
@@ -78,7 +78,7 @@ tasks.generateDevelopmentBundle {
libraryRepositories.set(
listOf(
"https://repo.maven.apache.org/maven2/",
"https://ysera.dyndns.org:444/releases", // This should be a repo hosting your API (in this example, 'com.example.paperfork:slice-api'),
"https://test.lokamc.org:444/releases", // This should be a repo hosting your API (in this example, 'com.example.paperfork:slice-api'),
paperMavenPublicUrl
)
)
@@ -91,7 +91,7 @@ allprojects {
repositories {
maven {
name = "Ysera"
url = uri("https://ysera.dyndns.org:444/releases")
url = uri("https://test.lokamc.com:444/releases")
// See Gradle docs for how to provide credentials to PasswordCredentials
// https://docs.gradle.org/current/samples/sample_publishing_credentials.html
credentials(PasswordCredentials::class)

View File

@@ -1,8 +1,8 @@
group=com.lokamc.slice
version=1.18.2-R0.1-SNAPSHOT
version=1.19.2-R0.1-SNAPSHOT
mcVersion=1.18.2
paperRef=b1ac25fdb8e2c011cc0b006d0b478e11879a29d8
mcVersion=1.19.2
paperRef=3f0415b45303568fe5d362dc3fa27b3a4ca680eb
org.gradle.caching=true
org.gradle.parallel=true

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cryptite <cryptite@gmail.com>
Date: Sun, 27 Feb 2022 09:47:57 -0600
Date: Fri, 12 Aug 2022 08:16:16 -0500
Subject: [PATCH] Add PlayerShieldDisableEvent

View File

@@ -0,0 +1,39 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tom <cryptite@gmail.com>
Date: Fri, 12 Aug 2022 08:20:02 -0500
Subject: [PATCH] Set BlockData without light updates
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
index 9930ebe7a23d306c602840fd43652fbdaba481b3..ed65bb8867bc2b8e67726dee07a82ac3671b0306 100644
--- a/src/main/java/org/bukkit/block/Block.java
+++ b/src/main/java/org/bukkit/block/Block.java
@@ -297,6 +297,28 @@ public interface Block extends Metadatable, net.kyori.adventure.translation.Tran
*/
void setBlockData(@NotNull BlockData data, boolean applyPhysics);
+ /**
+ * Sets the complete data for this block
+ *
+ * <br>
+ * Note that applyPhysics = false is not in general safe. It should only be
+ * used when you need to avoid triggering a physics update of neighboring
+ * blocks, for example when creating a {@link Bisected} block. If you are
+ * using a custom populator, then this parameter may also be required to
+ * prevent triggering infinite chunk loads on border blocks. This method
+ * should NOT be used to "hack" physics by placing blocks in impossible
+ * locations. Such blocks are liable to be removed on various events such as
+ * world upgrades. Furthermore setting large amounts of such blocks in close
+ * proximity may overload the server physics engine if an update is
+ * triggered at a later point. If this occurs, the resulting behavior is
+ * undefined.
+ *
+ * @param data new block specific data
+ * @param applyPhysics false to cancel physics from the changed block
+ * @param checkLight false to prevent a light-check update
+ */
+ void setBlockData(@NotNull BlockData data, boolean applyPhysics, boolean checkLight);
+
/**
* Sets the type of this block
*

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cryptite <cryptite@gmail.com>
Date: Mon, 28 Feb 2022 08:54:52 -0600
Date: Fri, 12 Aug 2022 09:54:07 -0500
Subject: [PATCH] Add BlockDestroyedByNeighborEvent

View File

@@ -0,0 +1,31 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cryptite <cryptite@gmail.com>
Date: Fri, 12 Aug 2022 10:40:48 -0500
Subject: [PATCH] Add provided Material to getDrops
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
index ed65bb8867bc2b8e67726dee07a82ac3671b0306..3da43fba552b1cb16b9a5480c46a5d0ea0f9c087 100644
--- a/src/main/java/org/bukkit/block/Block.java
+++ b/src/main/java/org/bukkit/block/Block.java
@@ -639,6 +639,20 @@ public interface Block extends Metadatable, net.kyori.adventure.translation.Tran
@NotNull
Collection<ItemStack> getDrops(@NotNull ItemStack tool, @Nullable Entity entity);
+ // Slice start
+ /**
+ * Returns a list of items which would drop by the entity destroying this
+ * block as though it were a given Material with a specific tool
+ *
+ * @param blockType The block type to use as the source loot
+ * @param tool The tool or item in hand used for digging
+ * @param entity the entity destroying the block
+ * @return a list of dropped items for this type of block
+ */
+ @NotNull
+ Collection<ItemStack> getDrops(@NotNull Material blockType, @NotNull ItemStack tool, @Nullable Entity entity);
+ // Slice end
+
/**
* Returns if the given item is a preferred choice to break this Block.
*

View File

@@ -0,0 +1,52 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cryptite <cryptite@gmail.com>
Date: Fri, 12 Aug 2022 10:41:44 -0500
Subject: [PATCH] Add Player to SpongeAbsorbEvent
diff --git a/src/main/java/org/bukkit/event/block/SpongeAbsorbEvent.java b/src/main/java/org/bukkit/event/block/SpongeAbsorbEvent.java
index 7029cfcd00ed5d9c7f06898ec2b81238ec775a70..0e2f21e0f1983d2e8b67deebf4d12d25107d1582 100644
--- a/src/main/java/org/bukkit/event/block/SpongeAbsorbEvent.java
+++ b/src/main/java/org/bukkit/event/block/SpongeAbsorbEvent.java
@@ -7,6 +7,7 @@ import org.bukkit.block.BlockState;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable; // Paper
/**
* Called when a sponge absorbs water from the world.
@@ -21,11 +22,13 @@ public class SpongeAbsorbEvent extends BlockEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancelled;
+ private final org.bukkit.entity.Player player; // Paper
private final List<BlockState> blocks;
- public SpongeAbsorbEvent(@NotNull Block block, @NotNull List<BlockState> waterblocks) {
+ public SpongeAbsorbEvent(@NotNull Block block, @Nullable org.bukkit.entity.Player player, @NotNull List<BlockState> waterblocks) { // Paper
super(block);
this.blocks = waterblocks;
+ this.player = player; // Paper
}
/**
@@ -41,6 +44,18 @@ public class SpongeAbsorbEvent extends BlockEvent implements Cancellable {
return blocks;
}
+ // Paper start
+ /**
+ * Gets the Player that placed the Sponge Block
+ *
+ * @return The Player that placed the sponge block causing the absorb event, or null if no Player was involved
+ */
+ @Nullable
+ public org.bukkit.entity.Player getPlayer() {
+ return player;
+ }
+ // Paper end
+
@Override
public boolean isCancelled() {
return cancelled;

View File

@@ -0,0 +1,22 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cryptite <cryptite@gmail.com>
Date: Fri, 12 Aug 2022 10:45:51 -0500
Subject: [PATCH] Add World Instance flag
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index e8c0c853eb52d1473c20231660355f77b1f7e016..02e524f718566a13880c9417518ebaeca816a8fc 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -2591,6 +2591,11 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
*/
public void setAutoSave(boolean value);
+ // Slice start
+ public boolean isInstance();
+ public void setInstance(boolean value);
+ // Slice end
+
/**
* Sets the Difficulty of the world.
*

View File

@@ -0,0 +1,133 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tom <cryptite@gmail.com>
Date: Fri, 12 Aug 2022 10:52:37 -0500
Subject: [PATCH] Add player data saving events
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerLoadDataEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerLoadDataEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..ae0132d9c7ae17b478d1d504961e1fd6b479f6d0
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerLoadDataEvent.java
@@ -0,0 +1,63 @@
+package com.destroystokyo.paper.event.player;
+
+import com.google.gson.JsonObject;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.UUID;
+
+/**
+ * Calls an event in which playerdata can be provided. If null, will load from disk, otherwise will use provided data
+ */
+public class PlayerLoadDataEvent extends Event {
+ private static final HandlerList handlers = new HandlerList();
+ private final UUID playerId;
+ private Object playerData;
+ private JsonObject statistics;
+
+ public PlayerLoadDataEvent(@NotNull UUID playerId) {
+ super();
+ this.playerId = playerId;
+ }
+
+ /**
+ * Gets the player's unique ID.
+ *
+ * @return The unique ID
+ */
+ @NotNull
+ public UUID getUniqueId() {
+ return playerId;
+ }
+
+ @Nullable
+ public Object getPlayerData() {
+ return playerData;
+ }
+
+ public void setPlayerData(@NotNull Object playerData) {
+ this.playerData = playerData;
+ }
+
+ @Nullable
+ public JsonObject getStatistics() {
+ return statistics;
+ }
+
+ public void setStatistics(@NotNull JsonObject statistics) {
+ this.statistics = statistics;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerSaveDataEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerSaveDataEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..c706201394d89f4a6f795ebbbac3d1041f395104
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerSaveDataEvent.java
@@ -0,0 +1,52 @@
+package com.destroystokyo.paper.event.player;
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Calls whenever playerdata is attempted to be saved. This is fired even if SpigotConfig.disablePlayerDataSaving is true
+ */
+public class PlayerSaveDataEvent extends Event implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private final Player player;
+ private boolean cancel;
+
+ public PlayerSaveDataEvent(@NotNull Player player) {
+ super();
+ this.player = player;
+ }
+
+ /**
+ * Gets the player
+ *
+ * @return The player
+ */
+ @NotNull
+ public Player getPlayer() {
+ return player;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancel;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ this.cancel = cancel;
+ }
+}

View File

@@ -0,0 +1,65 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cryptite <cryptite@gmail.com>
Date: Fri, 12 Aug 2022 11:00:39 -0500
Subject: [PATCH] Add PlayerGetRespawnLocationEvent
diff --git a/src/main/java/org/bukkit/event/player/PlayerGetRespawnLocationEvent.java b/src/main/java/org/bukkit/event/player/PlayerGetRespawnLocationEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..7eca4d6929fc7a75974d182c1ea692d3823a19c0
--- /dev/null
+++ b/src/main/java/org/bukkit/event/player/PlayerGetRespawnLocationEvent.java
@@ -0,0 +1,53 @@
+package org.bukkit.event.player;
+
+import org.apache.commons.lang3.Validate;
+import org.bukkit.Location;
+import org.bukkit.entity.Player;
+import org.bukkit.event.HandlerList;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Called when a respawn event tries to determine the location of a respawn
+ */
+public class PlayerGetRespawnLocationEvent extends PlayerEvent {
+ private static final HandlerList handlers = new HandlerList();
+ private Location respawnLocation;
+
+ public PlayerGetRespawnLocationEvent(@NotNull final Player respawnPlayer) {
+ super(respawnPlayer);
+ }
+
+ /**
+ * Gets the current respawn location
+ *
+ * @return Location current respawn location
+ */
+ @Nullable
+ public Location getRespawnLocation() {
+ return this.respawnLocation;
+ }
+
+ /**
+ * Sets the new respawn location
+ *
+ * @param respawnLocation new location for the respawn
+ */
+ public void setRespawnLocation(@NotNull Location respawnLocation) {
+ Validate.notNull(respawnLocation, "Respawn location can not be null");
+ Validate.notNull(respawnLocation.getWorld(), "Respawn world can not be null");
+
+ this.respawnLocation = respawnLocation;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}

View File

@@ -0,0 +1,82 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MiniDigger <admin@minidigger.me>
Date: Fri, 12 Aug 2022 08:07:34 -0500
Subject: [PATCH] Build Changes
diff --git a/build.gradle.kts b/build.gradle.kts
index 2374cc9bab5039d0a0dc11d4b2ec573ab75778a7..698300a50aa20b81eac15ebef7586c97aec75b64 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -9,8 +9,12 @@ plugins {
}
dependencies {
- implementation(project(":paper-api"))
- implementation(project(":paper-mojangapi"))
+ // Slice start
+ implementation(project(":slice-api"))
+ implementation("io.papermc.paper:paper-mojangapi:1.19.2-R0.1-SNAPSHOT") {
+ exclude("io.papermc.paper", "paper-api")
+ }
+ // Slice end
// Paper start
implementation("org.jline:jline-terminal-jansi:3.21.0")
implementation("net.minecrell:terminalconsoleappender:1.3.0")
@@ -64,7 +68,7 @@ tasks.jar {
attributes(
"Main-Class" to "org.bukkit.craftbukkit.Main",
"Implementation-Title" to "CraftBukkit",
- "Implementation-Version" to "git-Paper-$implementationVersion",
+ "Implementation-Version" to "git-Slice-$implementationVersion", // Slice
"Implementation-Vendor" to date, // Paper
"Specification-Title" to "Bukkit",
"Specification-Version" to project.version,
@@ -163,7 +167,7 @@ fun TaskContainer.registerRunTask(
name: String,
block: JavaExec.() -> Unit
): TaskProvider<JavaExec> = register<JavaExec>(name) {
- group = "paper"
+ group = "paperweight"
mainClass.set("org.bukkit.craftbukkit.Main")
standardInput = System.`in`
workingDir = rootProject.layout.projectDirectory
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 081c7160cf727646cdec4cd551dbc2aad56326f6..bcf30fc12e3e4e74fdc2bcc30fc67dcb55592e93 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1656,7 +1656,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@DontObfuscate
public String getServerModName() {
- return "Paper"; // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
+ return "Slice"; // Slice - Slice > // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
}
public SystemReport fillSystemReport(SystemReport details) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 964ec590ef5302576ecb3ba2b8ea95dbc2acf103..5d86c4e1de032e8667b3ad2a10848ca9cca2527a 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -248,7 +248,7 @@ import javax.annotation.Nullable; // Paper
import javax.annotation.Nonnull; // Paper
public final class CraftServer implements Server {
- private final String serverName = "Paper"; // Paper
+ private final String serverName = "Slice"; // Slice // Paper
private final String serverVersion;
private final String bukkitVersion = Versioning.getBukkitVersion();
private final Logger logger = Logger.getLogger("Minecraft");
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
index 774556a62eb240da42e84db4502e2ed43495be17..fdd8fa9ec021b4846b59e1693e32d4d02a712efe 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
@@ -11,7 +11,7 @@ public final class Versioning {
public static String getBukkitVersion() {
String result = "Unknown-Version";
- InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/io.papermc.paper/paper-api/pom.properties");
+ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/com.lokamc.slice/slice-api/pom.properties"); // Slice
Properties properties = new Properties();
if (stream != null) {

View File

@@ -1,14 +1,14 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cryptite <cryptite@gmail.com>
Date: Sun, 27 Feb 2022 09:47:57 -0600
Date: Fri, 12 Aug 2022 08:16:16 -0500
Subject: [PATCH] Add PlayerShieldDisableEvent
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index e3227a806d9e19923783122ea94ae19e7dbe71da..61ad475364346efe7cf3f3d8db07753075d6edb9 100644
index 3646b969fa51b9683ab4137e530c3a6f6fc6c465..a1ac0d29b7a2b5afdad4998c249bf4fc27245e30 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1608,7 +1608,10 @@ public abstract class Mob extends LivingEntity {
@@ -1628,7 +1628,10 @@ public abstract class Mob extends LivingEntity {
float f = 0.25F + (float) EnchantmentHelper.getBlockEfficiency(this) * 0.05F;
if (this.random.nextFloat() < f) {
@@ -21,19 +21,19 @@ index e3227a806d9e19923783122ea94ae19e7dbe71da..61ad475364346efe7cf3f3d8db077530
}
}
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 2483d7df7f1bf94344afd38b37602c645a4a2dff..0156525637f8aa2e4e639bc493d8617b5af4cc32 100644
index 9b131f0a827413e9f5d6d0f7491c5481576cb8b1..fb768b689c2bc7d6901bcf98bee4b1d64d82456a 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -949,7 +949,7 @@ public abstract class Player extends LivingEntity {
@@ -993,7 +993,7 @@ public abstract class Player extends LivingEntity {
protected void blockUsingShield(LivingEntity attacker) {
super.blockUsingShield(attacker);
if (attacker.getMainHandItem().getItem() instanceof AxeItem) {
if (attacker.canDisableShield()) {
- this.disableShield(true);
+ this.disableShield(true, attacker); // Slice
}
}
@@ -1420,6 +1420,12 @@ public abstract class Player extends LivingEntity {
@@ -1464,6 +1464,12 @@ public abstract class Player extends LivingEntity {
}
public void disableShield(boolean sprinting) {
@@ -46,7 +46,7 @@ index 2483d7df7f1bf94344afd38b37602c645a4a2dff..0156525637f8aa2e4e639bc493d8617b
float f = 0.25F + (float) EnchantmentHelper.getBlockEfficiency(this) * 0.05F;
if (sprinting) {
@@ -1427,7 +1433,12 @@ public abstract class Player extends LivingEntity {
@@ -1471,7 +1477,12 @@ public abstract class Player extends LivingEntity {
}
if (this.random.nextFloat() < f) {

View File

@@ -0,0 +1,177 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tom <cryptite@gmail.com>
Date: Fri, 12 Aug 2022 08:20:02 -0500
Subject: [PATCH] Set BlockData without light updates
diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
index 80c1e0e47818486a68e0114b063395290365346b..c7aa378d081c43838c6f8169125c46cbbfa72429 100644
--- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java
+++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
@@ -233,7 +233,7 @@ public class WorldGenRegion implements WorldGenLevel {
Block.dropResources(iblockdata, this.level, pos, tileentity, breakingEntity, ItemStack.EMPTY);
}
- return this.setBlock(pos, Blocks.AIR.defaultBlockState(), 3, maxUpdateDepth);
+ return this.setBlock(pos, Blocks.AIR.defaultBlockState(), 3, maxUpdateDepth, true); // Slice
}
}
@@ -308,7 +308,7 @@ public class WorldGenRegion implements WorldGenLevel {
}
@Override
- public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth) {
+ public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth, boolean checkLight) { // Slice
if (!this.ensureCanWrite(pos)) {
return false;
} else {
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 5a2a1d394852d39ea576624586f7fa736dec807c..f9117486a51a1456842b03b2d2f2ee72cf1bc297 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -510,12 +510,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
}
@Override
- public final boolean setBlock(BlockPos pos, BlockState state, int flags) { // Paper - final for inline
- return this.setBlock(pos, state, flags, 512);
+ public final boolean setBlock(BlockPos pos, BlockState state, int flags, boolean checkLight) { // Paper - final for inline
+ return this.setBlock(pos, state, flags, 512, checkLight);
}
@Override
- public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth) {
+ public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth, boolean checkLight) {
// CraftBukkit start - tree generation
if (this.captureTreeGeneration) {
// Paper start
@@ -562,7 +562,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
} else {
BlockState iblockdata2 = this.getBlockState(pos);
- if ((flags & 128) == 0 && iblockdata2 != iblockdata1 && (iblockdata2.getLightBlock(this, pos) != iblockdata1.getLightBlock(this, pos) || iblockdata2.getLightEmission() != iblockdata1.getLightEmission() || iblockdata2.useShapeForLightOcclusion() || iblockdata1.useShapeForLightOcclusion())) {
+ if (checkLight && (flags & 128) == 0 && iblockdata2 != iblockdata1 && (iblockdata2.getLightBlock(this, pos) != iblockdata1.getLightBlock(this, pos) || iblockdata2.getLightEmission() != iblockdata1.getLightEmission() || iblockdata2.useShapeForLightOcclusion() || iblockdata1.useShapeForLightOcclusion())) {
this.getProfiler().push("queueCheckLight");
this.getChunkSource().getLightEngine().checkBlock(pos);
this.getProfiler().pop();
@@ -709,7 +709,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
Block.dropResources(iblockdata, this, pos, tileentity, breakingEntity, ItemStack.EMPTY);
}
- boolean flag1 = this.setBlock(pos, fluid.createLegacyBlock(), 3, maxUpdateDepth);
+ boolean flag1 = this.setBlock(pos, fluid.createLegacyBlock(), 3, maxUpdateDepth, true);
if (flag1) {
this.gameEvent(GameEvent.BLOCK_DESTROY, pos, GameEvent.Context.of(breakingEntity, iblockdata));
diff --git a/src/main/java/net/minecraft/world/level/LevelWriter.java b/src/main/java/net/minecraft/world/level/LevelWriter.java
index 134e5ec79bf2dddd4e31930f8a7cb2c02fa29518..fd72d278a2719911a46b6bc9e7da2dc24bbe681e 100644
--- a/src/main/java/net/minecraft/world/level/LevelWriter.java
+++ b/src/main/java/net/minecraft/world/level/LevelWriter.java
@@ -7,10 +7,14 @@ import net.minecraft.world.level.block.state.BlockState;
public interface LevelWriter {
- boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth);
+ boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth, boolean checkLight);
default boolean setBlock(BlockPos pos, BlockState state, int flags) {
- return this.setBlock(pos, state, flags, 512);
+ return this.setBlock(pos, state, flags, 512, true);
+ }
+
+ default boolean setBlock(BlockPos pos, BlockState state, int flags, boolean checkLight) {
+ return this.setBlock(pos, state, flags, 512, checkLight);
}
boolean removeBlock(BlockPos pos, boolean move);
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
index 2e65b44f10aeb44fd524a58e7eb815a566c1ad61..f85777b5d4003a9fcc6f19976ea6ef23a8674c68 100644
--- a/src/main/java/net/minecraft/world/level/block/Block.java
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
@@ -198,7 +198,7 @@ public class Block extends BlockBehaviour implements ItemLike {
world.destroyBlock(pos, (flags & 32) == 0, (Entity) null, maxUpdateDepth);
}
} else {
- world.setBlock(pos, newState, flags & -33, maxUpdateDepth);
+ world.setBlock(pos, newState, flags & -33, maxUpdateDepth, true); // Slice
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
index 62bca85da6c5d9877e21fecb702370506ddf671c..9e339db1a9257e64f5645ba7e4025debaa4110e9 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
@@ -277,7 +277,7 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
BlockPos pos = new BlockPos(x, y, z);
net.minecraft.world.level.block.state.BlockState old = this.getHandle().getBlockState(pos);
- CraftBlock.setTypeAndData(world, pos, old, ((CraftBlockData) blockData).getState(), true);
+ CraftBlock.setTypeAndData(world, pos, old, ((CraftBlockData) blockData).getState(), true, true);
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index 0d47460494135d4ec4c95260de033e054c2f0404..4d49cc4ceba781bc24ac9b4229483625a996839d 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -187,15 +187,20 @@ public class CraftBlock implements Block {
@Override
public void setBlockData(BlockData data, boolean applyPhysics) {
+ setBlockData(data, applyPhysics, true);
+ }
+
+ @Override
+ public void setBlockData(BlockData data, boolean applyPhysics, boolean checkLight) {
Preconditions.checkArgument(data != null, "BlockData cannot be null");
- this.setTypeAndData(((CraftBlockData) data).getState(), applyPhysics);
+ this.setTypeAndData(((CraftBlockData) data).getState(), applyPhysics, checkLight);
}
- boolean setTypeAndData(final net.minecraft.world.level.block.state.BlockState blockData, final boolean applyPhysics) {
- return CraftBlock.setTypeAndData(this.world, this.position, this.getNMS(), blockData, applyPhysics);
+ boolean setTypeAndData(final net.minecraft.world.level.block.state.BlockState blockData, final boolean applyPhysics, boolean checkLight) {
+ return CraftBlock.setTypeAndData(this.world, this.position, this.getNMS(), blockData, applyPhysics, checkLight);
}
- public static boolean setTypeAndData(LevelAccessor world, BlockPos position, net.minecraft.world.level.block.state.BlockState old, net.minecraft.world.level.block.state.BlockState blockData, boolean applyPhysics) {
+ public static boolean setTypeAndData(LevelAccessor world, BlockPos position, net.minecraft.world.level.block.state.BlockState old, net.minecraft.world.level.block.state.BlockState blockData, boolean applyPhysics, boolean checkLight) {
// SPIGOT-611: need to do this to prevent glitchiness. Easier to handle this here (like /setblock) than to fix weirdness in tile entity cleanup
if (old.hasBlockEntity() && blockData.getBlock() != old.getBlock()) { // SPIGOT-3725 remove old tile entity if block changes
// SPIGOT-4612: faster - just clear tile
@@ -209,7 +214,7 @@ public class CraftBlock implements Block {
if (applyPhysics) {
return world.setBlock(position, blockData, 3);
} else {
- boolean success = world.setBlock(position, blockData, 2 | 16 | 1024); // NOTIFY | NO_OBSERVER | NO_PLACE (custom)
+ boolean success = world.setBlock(position, blockData, 2 | 16 | 1024, checkLight); // NOTIFY | NO_OBSERVER | NO_PLACE (custom)
if (success && world instanceof net.minecraft.world.level.Level) {
world.getMinecraftWorld().sendBlockUpdated(
position,
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java
index 966ac60daebb7bb211ab8096fc0c5f33db67320a..d68b046e30d0f3d186ed90b7c36086ccd889de1f 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java
@@ -213,7 +213,7 @@ public class CraftBlockState implements BlockState {
}
net.minecraft.world.level.block.state.BlockState newBlock = this.data;
- block.setTypeAndData(newBlock, applyPhysics);
+ block.setTypeAndData(newBlock, applyPhysics, true);
if (access instanceof net.minecraft.world.level.Level) {
this.world.getHandle().sendBlockUpdated(
position,
diff --git a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
index cd0dc080fbd8c5b1509d67e2b60264393b2b7dbb..8195cace753c6d044a128f768459303bc2f97588 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
@@ -241,7 +241,7 @@ public class DummyGeneratorAccess implements WorldGenLevel {
}
@Override
- public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth) {
+ public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth, boolean checkLight) {
return false;
}

View File

@@ -0,0 +1,19 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cryptite <cryptite@gmail.com>
Date: Fri, 12 Aug 2022 08:23:13 -0500
Subject: [PATCH] Ignore durability change equipment updates
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index cff7993bdafd2f69e46c9985c7601a69ae47f452..b6b2cbf7223654982b45625484110add216f125d 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3066,7 +3066,7 @@ public abstract class LivingEntity extends Entity {
ItemStack itemstack1 = this.getItemBySlot(enumitemslot);
- if (!ItemStack.matches(itemstack1, itemstack)) {
+ if (!ItemStack.isSameIgnoreDurability(itemstack1, itemstack)) { // Slice
// Paper start - PlayerArmorChangeEvent
if (this instanceof ServerPlayer && enumitemslot.getType() == EquipmentSlot.Type.ARMOR) {
final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(itemstack);

View File

@@ -0,0 +1,43 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cryptite <cryptite@gmail.com>
Date: Fri, 12 Aug 2022 08:28:00 -0500
Subject: [PATCH] Alllow opening covered chests
diff --git a/src/main/java/net/minecraft/world/level/block/ChestBlock.java b/src/main/java/net/minecraft/world/level/block/ChestBlock.java
index c6b57d45383441aa35510e759ce3cb82bc98f305..0f6dc8ab64f2422f636c2792be06f31bafefe3f8 100644
--- a/src/main/java/net/minecraft/world/level/block/ChestBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/ChestBlock.java
@@ -355,9 +355,10 @@ public class ChestBlock extends AbstractChestBlock<ChestBlockEntity> implements
}
private static boolean isBlockedChestByBlock(BlockGetter world, BlockPos pos) {
- BlockPos blockposition1 = pos.above();
-
- return world.getBlockState(blockposition1).isRedstoneConductor(world, blockposition1);
+ return false;
+// BlockPos blockposition1 = pos.above();
+//
+// return world.getBlockState(blockposition1).isRedstoneConductor(world, blockposition1);
}
private static boolean isCatSittingOnChest(LevelAccessor world, BlockPos pos) {
diff --git a/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java b/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java
index 7385e91f32f070e86a4e0fd3d214f55d832c7979..4911b099f865b9202286f51087e5c00ffeaa95a5 100644
--- a/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java
@@ -76,10 +76,10 @@ public class EnderChestBlock extends AbstractChestBlock<EnderChestBlockEntity> i
PlayerEnderChestContainer playerEnderChestContainer = player.getEnderChestInventory();
BlockEntity blockEntity = world.getBlockEntity(pos);
if (playerEnderChestContainer != null && blockEntity instanceof EnderChestBlockEntity) {
- BlockPos blockPos = pos.above();
- if (world.getBlockState(blockPos).isRedstoneConductor(world, blockPos)) {
- return InteractionResult.sidedSuccess(world.isClientSide);
- } else if (world.isClientSide) {
+// BlockPos blockPos = pos.above();
+// if (world.getBlockState(blockPos).isRedstoneConductor(world, blockPos)) {
+// return InteractionResult.sidedSuccess(world.isClientSide);
+ if (world.isClientSide) {
return InteractionResult.SUCCESS;
} else {
EnderChestBlockEntity enderChestBlockEntity = (EnderChestBlockEntity)blockEntity;

View File

@@ -0,0 +1,23 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cryptite <cryptite@gmail.com>
Date: Fri, 12 Aug 2022 08:28:40 -0500
Subject: [PATCH] Don't send fire packets if player has FR
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index f925a8d550ecbf2044a37bfe58b30d6578c5f6af..7e31ac6b1097fc5d4faac98d0f1b5673da4e6694 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -844,7 +844,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
this.checkOutOfWorld();
if (!this.level.isClientSide) {
- this.setSharedFlagOnFire(this.remainingFireTicks > 0);
+ if (this instanceof net.minecraft.world.entity.LivingEntity livingEntity) {
+ this.setSharedFlagOnFire(this.remainingFireTicks > 0 && !livingEntity.hasEffect(net.minecraft.world.effect.MobEffects.FIRE_RESISTANCE));
+ } else {
+ this.setSharedFlagOnFire(this.remainingFireTicks > 0);
+ }
}
this.firstTick = false;

View File

@@ -0,0 +1,137 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cryptite <cryptite@gmail.com>
Date: Fri, 12 Aug 2022 09:54:06 -0500
Subject: [PATCH] Add BlockDestroyedByNeighborEvent
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index 5a60f5dc202c44b06ca34e9a19d45cb715f74fd3..99c7fa99cf25a090859c276301752dcc94a446b4 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -410,6 +410,7 @@ public class ServerPlayerGameMode {
org.bukkit.block.BlockState state = bblock.getState();
level.captureDrops = new ArrayList<>();
// CraftBukkit end
+ level.pendingPlayerBlockEvents.put(pos, new Level.PendingBlockEvent(pos, this.player)); // Paper
block.playerWillDestroy(this.level, pos, iblockdata, this.player);
boolean flag = this.level.removeBlock(pos, false);
@@ -438,6 +439,7 @@ public class ServerPlayerGameMode {
// CraftBukkit start
java.util.List<net.minecraft.world.entity.item.ItemEntity> itemsToDrop = level.captureDrops; // Paper - store current list
level.captureDrops = null; // Paper - Remove this earlier so that we can actually drop stuff
+ level.pendingPlayerBlockEvents.remove(pos); // Paper
if (event.isDropItems()) {
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockDropItemEvent(bblock, state, this.player, itemsToDrop); // Paper - use stored ref
}
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index c18a0bc94d0210396046f4475e49a739088593f3..03f057134831bd119bb8dd820d4a0868b8f90b31 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -345,6 +345,7 @@ public final class ItemStack {
}
}
Item item = this.getItem();
+ if (entityhuman != null) world.pendingPlayerBlockEvents.put(blockposition, new Level.PendingBlockEvent(blockposition, entityhuman)); // Paper
InteractionResult enuminteractionresult = item.useOn(itemactioncontext);
CompoundTag newData = this.getTagClone();
int newCount = this.getCount();
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index f9117486a51a1456842b03b2d2f2ee72cf1bc297..5084cd803c27519115dadb298c46b98ad20059ef 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -182,6 +182,27 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public final Map<Explosion.CacheKey, Float> explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions
public java.util.ArrayDeque<net.minecraft.world.level.block.RedstoneTorchBlock.Toggle> redstoneUpdateInfos; // Paper - Move from Map in BlockRedstoneTorch to here
+ // Paper start - Holder class used to track what Player is responsible the last block event
+ public static class PendingBlockEvent {
+
+ public final BlockPos block;
+ public final Player player;
+ public @Nullable BlockPos sourceBlock;
+
+ public PendingBlockEvent(BlockPos block, Player player) {
+ this(block, player, null);
+ }
+
+ public PendingBlockEvent(BlockPos block, Player player, @Nullable BlockPos sourceBlock) {
+ this.block = block;
+ this.player = player;
+ this.sourceBlock = sourceBlock;
+ }
+
+ }
+ public final Map<BlockPos, PendingBlockEvent> pendingPlayerBlockEvents = new HashMap<>();
+ // Paper end
+
// Paper start - fix and optimise world upgrading
// copied from below
public static ResourceKey<DimensionType> getDimensionKey(DimensionType manager) {
@@ -664,6 +685,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
if (!this.preventPoiUpdated) {
this.onBlockStateChange(blockposition, iblockdata1, iblockdata2);
}
+ pendingPlayerBlockEvents.remove(blockposition); // Paper
// CraftBukkit end
}
}
@@ -685,6 +707,17 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
if (iblockdata.isAir()) {
return false;
} else {
+ // Paper start
+ PendingBlockEvent blockEvent = pendingPlayerBlockEvents.get(pos);
+ if (blockEvent != null && blockEvent.sourceBlock != null) {
+ io.papermc.paper.event.block.BlockDestroyedByNeighborEvent event =
+ new io.papermc.paper.event.block.BlockDestroyedByNeighborEvent(org.bukkit.craftbukkit.block.CraftBlock.at(this, pos),
+ (org.bukkit.entity.Player) blockEvent.player.getBukkitEntity(),
+ org.bukkit.craftbukkit.block.CraftBlock.at(this, blockEvent.sourceBlock));
+ event.callEvent();
+ }
+ // Paper end
+
FluidState fluid = this.getFluidState(pos);
// Paper start - while the above setAir method is named same and looks very similar
// they are NOT used with same intent and the above should not fire this event. The above method is more of a BlockSetToAirEvent,
diff --git a/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java b/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java
index fa97966d39f01301a8ba976c02dc697e0a74bfb1..3f0cbdb4294f3fc1b953d7baa7903d2e5471b337 100644
--- a/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java
@@ -103,6 +103,15 @@ public class DoublePlantBlock extends BushBlock {
BlockPos blockposition1 = pos.below();
BlockState iblockdata1 = world.getBlockState(blockposition1);
+ Level.PendingBlockEvent blockEvent = world.pendingPlayerBlockEvents.remove(pos);
+ if (blockEvent != null) {
+ io.papermc.paper.event.block.BlockDestroyedByNeighborEvent event =
+ new io.papermc.paper.event.block.BlockDestroyedByNeighborEvent(org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition1),
+ (org.bukkit.entity.Player) blockEvent.player.getBukkitEntity(),
+ org.bukkit.craftbukkit.block.CraftBlock.at(world, pos));
+ if (!event.callEvent()) return;
+ }
+
if (iblockdata1.is(state.getBlock()) && iblockdata1.getValue(DoublePlantBlock.HALF) == DoubleBlockHalf.LOWER) {
BlockState iblockdata2 = iblockdata1.hasProperty(BlockStateProperties.WATERLOGGED) && (Boolean) iblockdata1.getValue(BlockStateProperties.WATERLOGGED) ? Blocks.WATER.defaultBlockState() : Blocks.AIR.defaultBlockState();
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
index fd74cc9c0dab84b176f7da3fbbbdbc8fd3a7e26d..94799f653f2888847ffe8733ae0eefe60143e6ca 100644
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
@@ -988,6 +988,16 @@ public abstract class BlockBehaviour {
Direction enumdirection = aenumdirection[l];
blockposition_mutableblockposition.setWithOffset(pos, enumdirection);
+ // Paper start - Propagate the PendingBlockEvent from the current blockPos to the next block
+ // if it will break (!canSurvive)
+ if (this.getMaterial() == Material.AIR && !world.getBlockState(blockposition_mutableblockposition).canSurvive(world, blockposition_mutableblockposition)) {
+ Level.PendingBlockEvent blockEvent = ((Level) world).pendingPlayerBlockEvents.get(pos);
+ if (blockEvent != null) {
+ BlockPos blockPosCopy = blockposition_mutableblockposition.immutable();
+ ((Level) world).pendingPlayerBlockEvents.put(blockPosCopy, new Level.PendingBlockEvent(blockPosCopy, blockEvent.player, pos));
+ }
+ }
+ // Paper end
world.neighborShapeChanged(enumdirection.getOpposite(), this.asState(), blockposition_mutableblockposition, pos, flags, maxUpdateDepth);
}

View File

@@ -0,0 +1,38 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cryptite <cryptite@gmail.com>
Date: Fri, 12 Aug 2022 10:40:48 -0500
Subject: [PATCH] Add provided Material to getDrops
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index 4d49cc4ceba781bc24ac9b4229483625a996839d..1d22923bfd3be24a6f637114613065ae6afeba96 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -592,7 +592,18 @@ public class CraftBlock implements Block {
@Override
public Collection<ItemStack> getDrops(ItemStack item, Entity entity) {
- net.minecraft.world.level.block.state.BlockState iblockdata = this.getNMS();
+ return getDrops(null, item, entity); // Slice start
+ }
+
+ @Override
+ public Collection<ItemStack> getDrops(Material blockType, ItemStack item, Entity entity) {
+ net.minecraft.world.level.block.state.BlockState iblockdata;
+ if (blockType == null) {
+ iblockdata = this.getNMS();
+ } else {
+ iblockdata = ((CraftBlockData) blockType.createBlockData()).getState();
+ }
+
net.minecraft.world.item.ItemStack nms = CraftItemStack.asNMSCopy(item);
// Modelled off EntityHuman#hasBlock
@@ -603,6 +614,7 @@ public class CraftBlock implements Block {
return Collections.emptyList();
}
}
+ // Slice end
@Override
public boolean isPreferredTool(ItemStack item) {

View File

@@ -1,11 +1,11 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cryptite <cryptite@gmail.com>
Date: Mon, 28 Feb 2022 08:55:29 -0600
Date: Fri, 12 Aug 2022 10:41:43 -0500
Subject: [PATCH] Add Player to SpongeAbsorbEvent
diff --git a/src/main/java/net/minecraft/world/level/block/SpongeBlock.java b/src/main/java/net/minecraft/world/level/block/SpongeBlock.java
index 11b40defd5f5362346fd8a70a1141cd6425cefa7..48541be0c1cbe33d4dad1158683ab25447ecf5cf 100644
index 7304b2659eb45bc4bc9fa7c43e6ca07221d0fc73..63e385993022b6e708e981982c18060273d3e019 100644
--- a/src/main/java/net/minecraft/world/level/block/SpongeBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/SpongeBlock.java
@@ -109,7 +109,8 @@ public class SpongeBlock extends Block {

View File

@@ -0,0 +1,41 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cryptite <cryptite@gmail.com>
Date: Fri, 12 Aug 2022 10:45:51 -0500
Subject: [PATCH] Add World Instance flag
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 083349794d5ceb50322c5a645dd33fbfcc1c8155..5237989d7a8622074278ec9ef83ff5c97eac635e 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -218,6 +218,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
public final UUID uuid;
public boolean hasPhysicsEvent = true; // Paper
public boolean hasEntityMoveEvent = false; // Paper
+ public boolean instance; // Slice
private final alternate.current.wire.WireHandler wireHandler = new alternate.current.wire.WireHandler(this); // Paper - optimize redstone (Alternate Current)
public static Throwable getAddToWorldStackTrace(Entity entity) {
return new Throwable(entity + " Added to world at " + new java.util.Date());
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index f0b14914438840bd819fa7da8b76f4fcc13704d0..3237a68087f98825a5f58a6f397db40f35330605 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1289,6 +1289,18 @@ public class CraftWorld extends CraftRegionAccessor implements World {
world.noSave = !value;
}
+ // Slice start
+ @Override
+ public boolean isInstance() {
+ return world.instance;
+ }
+
+ @Override
+ public void setInstance(boolean value) {
+ world.instance = value;
+ }
+ // Slice end
+
@Override
public void setDifficulty(Difficulty difficulty) {
this.getHandle().serverLevelData.setDifficulty(net.minecraft.world.Difficulty.byId(difficulty.getValue()));

View File

@@ -0,0 +1,195 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cryptite <cryptite@gmail.com>
Date: Fri, 12 Aug 2022 10:48:03 -0500
Subject: [PATCH] Packet obfuscation and reduction
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEntityDataPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEntityDataPacket.java
index 3e17f6131bf590d7c4a16b79c1c145cb4f565bc9..e1233fa58d068448d0accef7a7f6725fcb902848 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEntityDataPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEntityDataPacket.java
@@ -22,6 +22,13 @@ public class ClientboundSetEntityDataPacket implements Packet<ClientGamePacketLi
}
+ // Slice start
+ public ClientboundSetEntityDataPacket(int id, List<SynchedEntityData.DataItem<?>> packedItems) {
+ this.id = id;
+ this.packedItems = packedItems;
+ }
+ // Slice end
+
public ClientboundSetEntityDataPacket(FriendlyByteBuf buf) {
this.id = buf.readVarInt();
this.packedItems = SynchedEntityData.unpack(buf);
diff --git a/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java b/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java
index 1c4e812c8b3f85ac5d69b637eb43d4b9751ad150..f647b2fc50a91467f68b1e5f2143d09668b0713c 100644
--- a/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java
+++ b/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java
@@ -137,6 +137,11 @@ public class SynchedEntityData {
}
public <T> void set(EntityDataAccessor<T> key, T value) {
+ //Slice start
+ set(key, value, null);
+ }
+
+ public <T> void set(EntityDataAccessor<T> key, T value, @Nullable T foreignValue) { // Slice end
SynchedEntityData.DataItem<T> datawatcher_item = this.getItem(key);
if (ObjectUtils.notEqual(value, datawatcher_item.getValue())) {
@@ -146,6 +151,11 @@ public class SynchedEntityData {
this.isDirty = true;
}
+ // Slice start
+ if (foreignValue != null && ObjectUtils.notEqual(foreignValue, datawatcher_item.getForeignValue())) {
+ datawatcher_item.setForeignValue(foreignValue);
+ }
+ // Slice end
}
// CraftBukkit start - add method from above
@@ -201,6 +211,28 @@ public class SynchedEntityData {
return list;
}
+ // Slice start
+ @Nullable
+ public List<SynchedEntityData.DataItem<?>> packForeignDirty(List<DataItem<?>> unpackedData) {
+ List<SynchedEntityData.DataItem<?>> list = null;
+
+ for (DataItem<?> dataItem : unpackedData) {
+ DataItem<?> item = itemsById.get(dataItem.accessor.getId());
+ if (item.isDirty(true)) {
+ item.setForeignDirty(false);
+
+ if (list == null) {
+ list = Lists.newArrayList();
+ }
+
+ list.add(item.copy(true));
+ }
+ }
+
+ return list;
+ }
+ // Slice end
+
@Nullable
public List<SynchedEntityData.DataItem<?>> getAll() {
List<SynchedEntityData.DataItem<?>> list = null;
@@ -314,11 +346,14 @@ public class SynchedEntityData {
final EntityDataAccessor<T> accessor;
T value;
private boolean dirty;
+ @Nullable T foreignValue = null; // Slice
+ private boolean foreignDirty; // Slice
public DataItem(EntityDataAccessor<T> data, T value) {
this.accessor = data;
this.value = value;
this.dirty = true;
+ this.foreignDirty = true; // Slice
}
public EntityDataAccessor<T> getAccessor() {
@@ -344,5 +379,34 @@ public class SynchedEntityData {
public SynchedEntityData.DataItem<T> copy() {
return new SynchedEntityData.DataItem<>(this.accessor, this.accessor.getSerializer().copy(this.value));
}
+
+ // Slice start
+ public void setForeignValue(T foreignValue) {
+ this.foreignValue = foreignValue;
+ this.foreignDirty = true;
+ }
+
+ public @Nullable T getForeignValue() {
+ return foreignValue;
+ }
+
+ public boolean isDirty(boolean foreign) {
+ if (foreign) {
+ //There must be a foreign value in order for this to be dirty, otherwise we consider this a normal
+ //value and check the normal dirty flag.
+ return foreignValue == null || this.foreignDirty;
+ }
+
+ return this.dirty;
+ }
+
+ public void setForeignDirty(boolean dirty) {
+ this.foreignDirty = dirty;
+ }
+
+ public SynchedEntityData.DataItem<T> copy(boolean foreign) {
+ return new SynchedEntityData.DataItem<>(this.accessor, this.accessor.getSerializer().copy((foreign && this.foreignValue != null ? this.foreignValue : this.value)));
+ }
+ // Slice end
}
}
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index 3b144c820531122eb37d41be06c182b5f5dc0724..201574cfdd6abbbf346c2feb468409028b4ce7f0 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -360,7 +360,19 @@ public class ServerEntity {
SynchedEntityData datawatcher = this.entity.getEntityData();
if (datawatcher.isDirty()) {
- this.broadcastAndSend(new ClientboundSetEntityDataPacket(this.entity.getId(), datawatcher, false));
+ // Slice start
+ ClientboundSetEntityDataPacket dataPacket = new ClientboundSetEntityDataPacket(this.entity.getId(), datawatcher, false);
+ if (this.entity instanceof ServerPlayer serverPlayer) {
+ serverPlayer.connection.send(dataPacket);
+ }
+
+ //Get the packedData that the original packet has, and then determine if any of those are changed in
+ //the foreign version. If null, nothing to notify foreign trackers about.
+ List<SynchedEntityData.DataItem<?>> dirtyItems = datawatcher.packForeignDirty(dataPacket.getUnpackedData());
+ if (dirtyItems != null) {
+ this.broadcast(new ClientboundSetEntityDataPacket(this.entity.getId(), dirtyItems));
+ }
+ // Slice end
}
if (this.entity instanceof LivingEntity) {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 7e31ac6b1097fc5d4faac98d0f1b5673da4e6694..e6286e7127824d2b605672586ab145f3fad3e099 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3086,7 +3086,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
this.entityData.markDirty(Entity.DATA_AIR_SUPPLY_ID);
return;
}
- this.entityData.set(Entity.DATA_AIR_SUPPLY_ID, event.getAmount());
+ this.entityData.set(Entity.DATA_AIR_SUPPLY_ID, event.getAmount(), getMaxAirSupply()); // Slice
// CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index fb768b689c2bc7d6901bcf98bee4b1d64d82456a..ff0a092563d9a6dea7f2757bb636e3a8ff4d04a8 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -641,7 +641,7 @@ public abstract class Player extends LivingEntity {
public void increaseScore(int score) {
int j = this.getScore();
- this.entityData.set(Player.DATA_SCORE_ID, j + score);
+ this.entityData.set(Player.DATA_SCORE_ID, j + score, 0); // Slice
}
public void startAutoSpinAttack(int riptideTicks) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 067d64ce06f626ce90b3ccf608d98f3c64fce335..6fca2d4de4b74bb24e29b5963a3f500e62760ad1 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2307,7 +2307,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.sendHealthUpdate();
}
}
- this.getHandle().getEntityData().set(net.minecraft.world.entity.LivingEntity.DATA_HEALTH_ID, (float) this.getScaledHealth());
+ this.getHandle().getEntityData().set(net.minecraft.world.entity.LivingEntity.DATA_HEALTH_ID, (float) this.getScaledHealth(), isDead() ? 0f : 20f); // Slice
this.getHandle().maxHealthCache = getMaxHealth();
}

View File

@@ -0,0 +1,121 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cryptite <cryptite@gmail.com>
Date: Fri, 12 Aug 2022 10:52:36 -0500
Subject: [PATCH] Add player data saving events
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index 99c7fa99cf25a090859c276301752dcc94a446b4..63376555eb5356e5eb6976d4027da717289a5eef 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -589,6 +589,8 @@ public class ServerPlayerGameMode {
enuminteractionresult1 = stack.useOn(itemactioncontext, hand);
}
+ world.pendingPlayerBlockEvents.remove(blockposition); // Paper
+
if (enuminteractionresult1.consumesAction()) {
CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger(player, blockposition, itemstack1);
}
diff --git a/src/main/java/net/minecraft/stats/ServerStatsCounter.java b/src/main/java/net/minecraft/stats/ServerStatsCounter.java
index c59f98ca3adfdd90cdc5999aeadbb0834efedc0f..6e819bd376eb9edee6bf8bd8c08a755599f1514a 100644
--- a/src/main/java/net/minecraft/stats/ServerStatsCounter.java
+++ b/src/main/java/net/minecraft/stats/ServerStatsCounter.java
@@ -201,7 +201,12 @@ public class ServerStatsCounter extends StatsCounter {
return nbttagcompound;
}
- protected String toJson() {
+ // Slice start - OBFHELPER
+ public String toJson() {
+ return serialize().toString();
+ }
+
+ public JsonObject serialize() { // Slice end
Map<StatType<?>, JsonObject> map = Maps.newHashMap();
ObjectIterator objectiterator = this.stats.object2IntEntrySet().iterator();
@@ -227,7 +232,7 @@ public class ServerStatsCounter extends StatsCounter {
jsonobject1.add("stats", jsonobject);
jsonobject1.addProperty("DataVersion", SharedConstants.getCurrentVersion().getWorldVersion());
- return jsonobject1.toString();
+ return jsonobject1; // Slice
}
private static <T> ResourceLocation getKey(Stat<T> stat) {
diff --git a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
index 601f8099f74e81c17600566b3c9b7a6dd39c9bcb..cde84f45b67b88ecc410cdff924170b5b5366823 100644
--- a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
+++ b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
@@ -33,6 +33,7 @@ public class PlayerDataStorage {
public void save(Player player) {
if (org.spigotmc.SpigotConfig.disablePlayerDataSaving) return; // Spigot
+ if (!new com.destroystokyo.paper.event.player.PlayerSaveDataEvent((org.bukkit.entity.Player) player.getBukkitEntity()).callEvent()) return; // Slice
try {
CompoundTag nbttagcompound = player.saveWithoutId(new CompoundTag());
File file = File.createTempFile(player.getStringUUID() + "-", ".dat", this.playerDir);
@@ -52,32 +53,40 @@ public class PlayerDataStorage {
public CompoundTag load(Player player) {
CompoundTag nbttagcompound = null;
- try {
- File file = new File(this.playerDir, player.getStringUUID() + ".dat");
- // Spigot Start
- boolean usingWrongFile = false;
- if ( org.bukkit.Bukkit.getOnlineMode() && !file.exists() ) // Paper - Check online mode first
- {
- file = new File( this.playerDir, java.util.UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + player.getScoreboardName() ).getBytes( "UTF-8" ) ).toString() + ".dat");
- if ( file.exists() )
+ // Slice start - If event supplies playerdata, use it. Otherwise just load from disk as usual
+ com.destroystokyo.paper.event.player.PlayerLoadDataEvent event = new com.destroystokyo.paper.event.player.PlayerLoadDataEvent(player.getUUID());
+ org.bukkit.Bukkit.getPluginManager().callEvent(event);
+
+ Object playerData = event.getPlayerData();
+ if (playerData != null) {
+ nbttagcompound = (CompoundTag) playerData;
+ } else {
+ try {
+ File file = new File(this.playerDir, player.getStringUUID() + ".dat");
+ // Spigot Start
+ boolean usingWrongFile = false;
+ if (org.bukkit.Bukkit.getOnlineMode() && !file.exists()) // Paper - Check online mode first
{
- usingWrongFile = true;
- org.bukkit.Bukkit.getServer().getLogger().warning( "Using offline mode UUID file for player " + player.getScoreboardName() + " as it is the only copy we can find." );
+ file = new File(this.playerDir, java.util.UUID.nameUUIDFromBytes(("OfflinePlayer:" + player.getScoreboardName()).getBytes("UTF-8")).toString() + ".dat");
+ if (file.exists()) {
+ usingWrongFile = true;
+ org.bukkit.Bukkit.getServer().getLogger().warning("Using offline mode UUID file for player " + player.getScoreboardName() + " as it is the only copy we can find.");
+ }
}
- }
- // Spigot End
+ // Spigot End
- if (file.exists() && file.isFile()) {
- nbttagcompound = NbtIo.readCompressed(file);
- }
- // Spigot Start
- if ( usingWrongFile )
- {
- file.renameTo( new File( file.getPath() + ".offline-read" ) );
+ if (file.exists() && file.isFile()) {
+ nbttagcompound = NbtIo.readCompressed(file);
+ }
+ // Spigot Start
+ if (usingWrongFile) {
+ file.renameTo(new File(file.getPath() + ".offline-read"));
+ }
+ // Spigot End
+ } catch (Exception exception) {
+ PlayerDataStorage.LOGGER.warn("Failed to load player data for {}", player.getName().getString());
}
- // Spigot End
- } catch (Exception exception) {
- PlayerDataStorage.LOGGER.warn("Failed to load player data for {}", player.getName().getString());
+ // Slice end
}
if (nbttagcompound != null) {

View File

@@ -0,0 +1,102 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cryptite <cryptite@gmail.com>
Date: Fri, 12 Aug 2022 11:00:39 -0500
Subject: [PATCH] Add PlayerGetRespawnLocationEvent
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 71623c84a5b15023189c14a6bf36e1b08f935fc1..3d3a8e1b535cab761aa696ec6bc350e0e83b1589 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -880,49 +880,57 @@ public abstract class PlayerList {
// CraftBukkit start - fire PlayerRespawnEvent
if (location == null) {
- // boolean isBedSpawn = false; // Paper - moved up
- ServerLevel worldserver1 = this.server.getLevel(entityplayer.getRespawnDimension());
- if (worldserver1 != null) {
- Optional optional;
+ // Slice start
+ Player respawnPlayer = entityplayer1.getBukkitEntity();
+ org.bukkit.event.player.PlayerGetRespawnLocationEvent preRespawnEvent = new org.bukkit.event.player.PlayerGetRespawnLocationEvent(respawnPlayer);
+ preRespawnEvent.callEvent();
+ location = preRespawnEvent.getRespawnLocation();
- if (blockposition != null) {
- optional = net.minecraft.world.entity.player.Player.findRespawnPositionAndUseSpawnBlock(worldserver1, blockposition, f, flag1, true); // Paper - Fix SPIGOT-5989
- } else {
- optional = Optional.empty();
- }
+ if (location == null) {
+ // Slice end
+ // boolean isBedSpawn = false; // Paper - moved up
+ ServerLevel worldserver1 = this.server.getLevel(entityplayer.getRespawnDimension());
+ if (worldserver1 != null) {
+ Optional optional;
+
+ if (blockposition != null) {
+ optional = net.minecraft.world.entity.player.Player.findRespawnPositionAndUseSpawnBlock(worldserver1, blockposition, f, flag1, true); // Paper - Fix SPIGOT-5989
+ } else {
+ optional = Optional.empty();
+ }
- if (optional.isPresent()) {
- BlockState iblockdata = worldserver1.getBlockState(blockposition);
- boolean flag3 = iblockdata.is(Blocks.RESPAWN_ANCHOR);
- isAnchorSpawn = flag3; // Paper - Fix anchor respawn acting as a bed respawn from the end portal
- Vec3 vec3d = (Vec3) optional.get();
- float f1;
+ if (optional.isPresent()) {
+ BlockState iblockdata = worldserver1.getBlockState(blockposition);
+ boolean flag3 = iblockdata.is(Blocks.RESPAWN_ANCHOR);
+ isAnchorSpawn = flag3; // Paper - Fix anchor respawn acting as a bed respawn from the end portal
+ Vec3 vec3d = (Vec3) optional.get();
+ float f1;
- if (!iblockdata.is(BlockTags.BEDS) && !flag3) {
- f1 = f;
- } else {
- Vec3 vec3d1 = Vec3.atBottomCenterOf(blockposition).subtract(vec3d).normalize();
+ if (!iblockdata.is(BlockTags.BEDS) && !flag3) {
+ f1 = f;
+ } else {
+ Vec3 vec3d1 = Vec3.atBottomCenterOf(blockposition).subtract(vec3d).normalize();
- f1 = (float) Mth.wrapDegrees(Mth.atan2(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
- }
+ f1 = (float) Mth.wrapDegrees(Mth.atan2(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
+ }
- entityplayer1.setRespawnPosition(worldserver1.dimension(), blockposition, f, flag1, false, com.destroystokyo.paper.event.player.PlayerSetSpawnEvent.Cause.PLAYER_RESPAWN); // Paper - PlayerSetSpawnEvent
- flag2 = !flag && flag3;
- isBedSpawn = true;
- location = new Location(worldserver1.getWorld(), vec3d.x, vec3d.y, vec3d.z, f1, 0.0F);
- } else if (blockposition != null) {
- entityplayer1.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.NO_RESPAWN_BLOCK_AVAILABLE, 0.0F));
- entityplayer1.setRespawnPosition(null, null, 0f, false, false, com.destroystokyo.paper.event.player.PlayerSetSpawnEvent.Cause.PLAYER_RESPAWN); // CraftBukkit - SPIGOT-5988: Clear respawn location when obstructed // Paper - PlayerSetSpawnEvent
+ entityplayer1.setRespawnPosition(worldserver1.dimension(), blockposition, f, flag1, false, com.destroystokyo.paper.event.player.PlayerSetSpawnEvent.Cause.PLAYER_RESPAWN); // Paper - PlayerSetSpawnEvent
+ flag2 = !flag && flag3;
+ isBedSpawn = true;
+ location = new Location(worldserver1.getWorld(), vec3d.x, vec3d.y, vec3d.z, f1, 0.0F);
+ } else if (blockposition != null) {
+ entityplayer1.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.NO_RESPAWN_BLOCK_AVAILABLE, 0.0F));
+ entityplayer1.setRespawnPosition(null, null, 0f, false, false); // CraftBukkit - SPIGOT-5988: Clear respawn location when obstructed // Paper - PlayerSetSpawnEvent
+ }
}
- }
- if (location == null) {
- worldserver1 = this.server.getLevel(Level.OVERWORLD);
- blockposition = entityplayer1.getSpawnPoint(worldserver1);
- location = new Location(worldserver1.getWorld(), (double) ((float) blockposition.getX() + 0.5F), (double) ((float) blockposition.getY() + 0.1F), (double) ((float) blockposition.getZ() + 0.5F), worldserver1.levelData.getSpawnAngle(), 0.0F); // Paper - use world spawn angle
+ if (location == null) {
+ worldserver1 = this.server.getLevel(Level.OVERWORLD);
+ blockposition = entityplayer1.getSpawnPoint(worldserver1);
+ location = new Location(worldserver1.getWorld(), (double) ((float) blockposition.getX() + 0.5F), (double) ((float) blockposition.getY() + 0.1F), (double) ((float) blockposition.getZ() + 0.5F), worldserver1.levelData.getSpawnAngle(), 0.0F); // Paper - use world spawn angle
+ }
}
- Player respawnPlayer = entityplayer1.getBukkitEntity();
PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn && !isAnchorSpawn, isAnchorSpawn, com.google.common.collect.ImmutableSet.<org.bukkit.event.player.PlayerRespawnEvent.RespawnFlag>builder().add(respawnFlags)); // Paper - Fix anchor respawn acting as a bed respawn from the end portal
this.cserver.getPluginManager().callEvent(respawnEvent);
// Spigot Start

View File

@@ -0,0 +1,32 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cryptite <cryptite@gmail.com>
Date: Fri, 12 Aug 2022 11:12:12 -0500
Subject: [PATCH] Disable Azalea generation
diff --git a/src/main/java/net/minecraft/data/worldgen/BiomeDefaultFeatures.java b/src/main/java/net/minecraft/data/worldgen/BiomeDefaultFeatures.java
index 415610172cea5b982222e1c5ad476e43511fcd64..1b544f917dee2b049b7c606c1b1cd87378a15d90 100644
--- a/src/main/java/net/minecraft/data/worldgen/BiomeDefaultFeatures.java
+++ b/src/main/java/net/minecraft/data/worldgen/BiomeDefaultFeatures.java
@@ -161,7 +161,7 @@ public class BiomeDefaultFeatures {
builder.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, CavePlacements.CAVE_VINES);
builder.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, CavePlacements.LUSH_CAVES_CLAY);
builder.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, CavePlacements.LUSH_CAVES_VEGETATION);
- builder.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, CavePlacements.ROOTED_AZALEA_TREE);
+// builder.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, CavePlacements.ROOTED_AZALEA_TREE); // Slice
builder.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, CavePlacements.SPORE_BLOSSOM);
builder.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, CavePlacements.CLASSIC_VINES);
}
diff --git a/src/main/java/net/minecraft/data/worldgen/features/CaveFeatures.java b/src/main/java/net/minecraft/data/worldgen/features/CaveFeatures.java
index ded33cfbda2d0f6e11cc1304c5ee5b1940b6de04..1e13c9c235c5a9d7d6d2270e837031985f152cbb 100644
--- a/src/main/java/net/minecraft/data/worldgen/features/CaveFeatures.java
+++ b/src/main/java/net/minecraft/data/worldgen/features/CaveFeatures.java
@@ -69,7 +69,7 @@ public class CaveFeatures {
private static final RandomizedIntStateProvider CAVE_VINES_HEAD_PROVIDER = new RandomizedIntStateProvider(new WeightedStateProvider(SimpleWeightedRandomList.<BlockState>builder().add(Blocks.CAVE_VINES.defaultBlockState(), 4).add(Blocks.CAVE_VINES.defaultBlockState().setValue(CaveVines.BERRIES, Boolean.valueOf(true)), 1)), CaveVinesBlock.AGE, UniformInt.of(23, 25));
public static final Holder<ConfiguredFeature<BlockColumnConfiguration, ?>> CAVE_VINE = FeatureUtils.register("cave_vine", Feature.BLOCK_COLUMN, new BlockColumnConfiguration(List.of(BlockColumnConfiguration.layer(new WeightedListInt(SimpleWeightedRandomList.<IntProvider>builder().add(UniformInt.of(0, 19), 2).add(UniformInt.of(0, 2), 3).add(UniformInt.of(0, 6), 10).build()), CAVE_VINES_BODY_PROVIDER), BlockColumnConfiguration.layer(ConstantInt.of(1), CAVE_VINES_HEAD_PROVIDER)), Direction.DOWN, BlockPredicate.ONLY_IN_AIR_PREDICATE, true));
public static final Holder<ConfiguredFeature<BlockColumnConfiguration, ?>> CAVE_VINE_IN_MOSS = FeatureUtils.register("cave_vine_in_moss", Feature.BLOCK_COLUMN, new BlockColumnConfiguration(List.of(BlockColumnConfiguration.layer(new WeightedListInt(SimpleWeightedRandomList.<IntProvider>builder().add(UniformInt.of(0, 3), 5).add(UniformInt.of(1, 7), 1).build()), CAVE_VINES_BODY_PROVIDER), BlockColumnConfiguration.layer(ConstantInt.of(1), CAVE_VINES_HEAD_PROVIDER)), Direction.DOWN, BlockPredicate.ONLY_IN_AIR_PREDICATE, true));
- public static final Holder<ConfiguredFeature<SimpleBlockConfiguration, ?>> MOSS_VEGETATION = FeatureUtils.register("moss_vegetation", Feature.SIMPLE_BLOCK, new SimpleBlockConfiguration(new WeightedStateProvider(SimpleWeightedRandomList.<BlockState>builder().add(Blocks.FLOWERING_AZALEA.defaultBlockState(), 4).add(Blocks.AZALEA.defaultBlockState(), 7).add(Blocks.MOSS_CARPET.defaultBlockState(), 25).add(Blocks.GRASS.defaultBlockState(), 50).add(Blocks.TALL_GRASS.defaultBlockState(), 10))));
+ public static final Holder<ConfiguredFeature<SimpleBlockConfiguration, ?>> MOSS_VEGETATION = FeatureUtils.register("moss_vegetation", Feature.SIMPLE_BLOCK, new SimpleBlockConfiguration(new WeightedStateProvider(SimpleWeightedRandomList.<BlockState>builder().add(Blocks.MOSS_CARPET.defaultBlockState(), 25).add(Blocks.GRASS.defaultBlockState(), 50).add(Blocks.TALL_GRASS.defaultBlockState(), 10))));
public static final Holder<ConfiguredFeature<VegetationPatchConfiguration, ?>> MOSS_PATCH = FeatureUtils.register("moss_patch", Feature.VEGETATION_PATCH, new VegetationPatchConfiguration(BlockTags.MOSS_REPLACEABLE, BlockStateProvider.simple(Blocks.MOSS_BLOCK), PlacementUtils.inlinePlaced(MOSS_VEGETATION), CaveSurface.FLOOR, ConstantInt.of(1), 0.0F, 5, 0.8F, UniformInt.of(4, 7), 0.3F));
public static final Holder<ConfiguredFeature<VegetationPatchConfiguration, ?>> MOSS_PATCH_BONEMEAL = FeatureUtils.register("moss_patch_bonemeal", Feature.VEGETATION_PATCH, new VegetationPatchConfiguration(BlockTags.MOSS_REPLACEABLE, BlockStateProvider.simple(Blocks.MOSS_BLOCK), PlacementUtils.inlinePlaced(MOSS_VEGETATION), CaveSurface.FLOOR, ConstantInt.of(1), 0.0F, 5, 0.6F, UniformInt.of(1, 2), 0.75F));
public static final Holder<ConfiguredFeature<SimpleRandomFeatureConfiguration, ?>> DRIPLEAF = FeatureUtils.register("dripleaf", Feature.SIMPLE_RANDOM_SELECTOR, new SimpleRandomFeatureConfiguration(HolderSet.direct(makeSmallDripleaf(), makeDripleaf(Direction.EAST), makeDripleaf(Direction.WEST), makeDripleaf(Direction.SOUTH), makeDripleaf(Direction.NORTH))));