mirror of
https://github.com/Samsuik/Sakura.git
synced 2025-12-21 15:59:26 +00:00
Begin backporting to 1.18.2
This commit is contained in:
@@ -2,8 +2,8 @@ import io.papermc.paperweight.util.constants.PAPERCLIP_CONFIG
|
||||
|
||||
plugins {
|
||||
java
|
||||
id("com.github.johnrengelman.shadow") version "8.1.0" apply false
|
||||
id("io.papermc.paperweight.patcher") version "1.5.2"
|
||||
id("com.github.johnrengelman.shadow") version "7.1.2" apply false
|
||||
id("io.papermc.paperweight.patcher") version "1.3.7"
|
||||
}
|
||||
|
||||
repositories {
|
||||
@@ -14,8 +14,8 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
remapper("net.fabricmc:tiny-remapper:0.8.6:fat")
|
||||
decompiler("net.minecraftforge:forgeflower:2.0.627.2")
|
||||
remapper("net.fabricmc:tiny-remapper:0.8.1:fat")
|
||||
decompiler("net.minecraftforge:forgeflower:1.5.498.22")
|
||||
paperclip("io.papermc:paperclip:3.0.2")
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
group=me.samsuik.sakura
|
||||
version=1.19.3-R0.1-SNAPSHOT
|
||||
version=1.18.2-R0.1-SNAPSHOT
|
||||
|
||||
mcVersion=1.19.3
|
||||
paperRef=155aa36d89b260ef5841615899299756b5983c0a
|
||||
mcVersion=1.18.2
|
||||
paperRef=fc9ee65a32622d03a91db39364b6f106cf88335b
|
||||
|
||||
org.gradle.jvmargs=-Xmx2G
|
||||
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Customise Version Command
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index ac9b690fcccb60b587e5345f12f1383afd0a73a1..80d836d561f9de3f4dba660a065edfe1092582d8 100644
|
||||
index a87399fa4838d4b2c1ff9cc35d433ae76cc149bf..8cfb453c44a4daf308ee562a7e5f7a577bb2dc6c 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -125,6 +125,20 @@ public final class Bukkit {
|
||||
@@ -124,6 +124,20 @@ public final class Bukkit {
|
||||
// Paper end
|
||||
}
|
||||
|
||||
@@ -30,10 +30,10 @@ index ac9b690fcccb60b587e5345f12f1383afd0a73a1..80d836d561f9de3f4dba660a065edfe1
|
||||
* Gets the name of this server implementation.
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/command/defaults/VersionCommand.java b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
|
||||
index e40f017f87d6b6b4770501b106c76dc69ec69abb..2b0e110c1531bae49ee634f2c5904c0ce68e89d7 100644
|
||||
index 57a21495843f3a144cd73473cdc8781d6129b7ca..cfbbe38a8e204aab921a3950ff878dde488128eb 100644
|
||||
--- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java
|
||||
+++ b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
|
||||
@@ -25,6 +25,11 @@ import org.bukkit.plugin.Plugin;
|
||||
@@ -26,6 +26,11 @@ import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.util.StringUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -45,7 +45,7 @@ index e40f017f87d6b6b4770501b106c76dc69ec69abb..2b0e110c1531bae49ee634f2c5904c0c
|
||||
|
||||
public class VersionCommand extends BukkitCommand {
|
||||
private VersionFetcher versionFetcher;
|
||||
@@ -36,6 +41,15 @@ public class VersionCommand extends BukkitCommand {
|
||||
@@ -37,6 +42,15 @@ public class VersionCommand extends BukkitCommand {
|
||||
return versionFetcher;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ index e40f017f87d6b6b4770501b106c76dc69ec69abb..2b0e110c1531bae49ee634f2c5904c0c
|
||||
public VersionCommand(@NotNull String name) {
|
||||
super(name);
|
||||
|
||||
@@ -47,12 +61,18 @@ public class VersionCommand extends BukkitCommand {
|
||||
@@ -48,12 +62,18 @@ public class VersionCommand extends BukkitCommand {
|
||||
|
||||
@Override
|
||||
public boolean execute(@NotNull CommandSender sender, @NotNull String currentAlias, @NotNull String[] args) {
|
||||
|
||||
@@ -209,10 +209,10 @@ index 0000000000000000000000000000000000000000..3df11f07ce533b8b911ec423be850374
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index fd890d0a3a2c92ad821ade7711191bdb0e3e3624..50cda6408fa196e2c3bfdbafe5933d52cbebd915 100644
|
||||
index 6cd0b10d1dc4506cfb1e4db5e1260cb705566cec..0d0bc62b4657fe46a37cb0ef30c4b7f67a1b2221 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -41,6 +41,15 @@ import org.jetbrains.annotations.Nullable;
|
||||
@@ -42,6 +42,15 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginMessageRecipient, net.kyori.adventure.identity.Identified, com.destroystokyo.paper.network.NetworkClient { // Paper
|
||||
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] isPushedByFluid API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
|
||||
index 11cf1bb585e2754bda443b776e9fcaf0a6cc289e..730af8a127ab55a22a7fd576156311dfde1f010c 100644
|
||||
index 8bc6876c82935988436597161fa0ec94c032174b..43024ea9b578c7bf68d237cbca3c9603492fc0e0 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Entity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Entity.java
|
||||
@@ -107,6 +107,22 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
|
||||
@@ -106,6 +106,22 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
|
||||
*/
|
||||
public boolean isInWater();
|
||||
|
||||
|
||||
@@ -155,10 +155,10 @@ index 0000000000000000000000000000000000000000..de18836d1a2a6038a661cdc60161d3ba
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||
index aa04d7df70d99402c91e920fd693d7d4fb655786..44d40c0fcb420199ec6e2c8a4cca3b2887f440ed 100644
|
||||
index 7ad1cabe05277c1f3238da6e121c35d8a9f0d952..519c61c5c83ca4f9434be77b2c07d95c6bf7a198 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -128,6 +128,10 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
@@ -125,6 +125,10 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
return new Location(this, x, y, z);
|
||||
}
|
||||
// Paper end
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Entity tracking range modifier
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 50cda6408fa196e2c3bfdbafe5933d52cbebd915..9075337807b54047b499f9979b03872aa9fa46e5 100644
|
||||
index 0d0bc62b4657fe46a37cb0ef30c4b7f67a1b2221..24910cbb4f674fab5013f3ecaf6e24e43a366431 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -50,6 +50,12 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -51,6 +51,12 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
me.samsuik.sakura.player.visibility.Visibility getVisibility();
|
||||
// Sakura end
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Branding changes
|
||||
From ForkPaper.
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 1919a8e9cb7c995b2a9c876ff4980bdc98977133..8e9b3ebe3b074c4991cd543446fa2d9aafa83251 100644
|
||||
index 0282e3b75470e1a68ea1fc228082483514ba432e..d1b4eb9088d5780f56d8df2d4542e6d408c61e6c 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -7,8 +7,12 @@ plugins {
|
||||
@@ -9,8 +9,12 @@ plugins {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -24,7 +24,7 @@ index 1919a8e9cb7c995b2a9c876ff4980bdc98977133..8e9b3ebe3b074c4991cd543446fa2d9a
|
||||
// Paper start
|
||||
implementation("org.jline:jline-terminal-jansi:3.21.0")
|
||||
implementation("net.minecrell:terminalconsoleappender:1.3.0")
|
||||
@@ -62,7 +66,7 @@ tasks.jar {
|
||||
@@ -60,7 +64,7 @@ tasks.jar {
|
||||
attributes(
|
||||
"Main-Class" to "org.bukkit.craftbukkit.Main",
|
||||
"Implementation-Title" to "CraftBukkit",
|
||||
@@ -34,10 +34,10 @@ index 1919a8e9cb7c995b2a9c876ff4980bdc98977133..8e9b3ebe3b074c4991cd543446fa2d9a
|
||||
"Specification-Title" to "Bukkit",
|
||||
"Specification-Version" to project.version,
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 753a917d34a1e1c1521a8916bc8e44a6acd90a46..777b012f7b3b35b89177d94f2c1d8dd1ee4adf7d 100644
|
||||
index da15a224b8b974e78b9d8d5f514229b3b2a5a63e..9cbb478205af1b12da66d89872ac6d3ef2d43e05 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1654,7 +1654,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1696,7 +1696,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
@DontObfuscate
|
||||
public String getServerModName() {
|
||||
@@ -47,10 +47,10 @@ index 753a917d34a1e1c1521a8916bc8e44a6acd90a46..777b012f7b3b35b89177d94f2c1d8dd1
|
||||
|
||||
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 bbb8335dae0a3e2761e6bbb8dc723bcf28cd82ba..f3c1e3a6951a17b42bff6a32a9b2fe29edfaf81c 100644
|
||||
index 8a248e34fce1e04de4460f98b7627df495c66af1..3d07ef0cbd57d54d131cdc766dd55d210d67fb4c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -261,7 +261,7 @@ import javax.annotation.Nullable; // Paper
|
||||
@@ -249,7 +249,7 @@ import javax.annotation.Nullable; // Paper
|
||||
import javax.annotation.Nonnull; // Paper
|
||||
|
||||
public final class CraftServer implements Server {
|
||||
|
||||
990
patches/server/0003-Sakura-Configuration-Files.patch
Normal file
990
patches/server/0003-Sakura-Configuration-Files.patch
Normal file
@@ -0,0 +1,990 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: "kfian294ma4@gmail.com" <kfian294ma4@gmail.com>
|
||||
Date: Sun, 5 Sep 2021 18:01:34 +0100
|
||||
Subject: [PATCH] Sakura Configuration Files
|
||||
|
||||
|
||||
diff --git a/src/main/java/me/samsuik/sakura/command/BaseSubCommand.java b/src/main/java/me/samsuik/sakura/command/BaseSubCommand.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..9b5af05f7a4593eb44f36fff90d94e98d6999c7f
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/samsuik/sakura/command/BaseSubCommand.java
|
||||
@@ -0,0 +1,47 @@
|
||||
+package me.samsuik.sakura.command;
|
||||
+
|
||||
+import org.bukkit.command.Command;
|
||||
+import org.bukkit.command.CommandSender;
|
||||
+import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
+import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.List;
|
||||
+
|
||||
+@DefaultQualifier(NonNull.class)
|
||||
+public abstract class BaseSubCommand extends Command {
|
||||
+
|
||||
+ public BaseSubCommand(String name) {
|
||||
+ super(name);
|
||||
+ this.description = "Sakura Command " + name;
|
||||
+ this.setPermission("bukkit.command." + name);
|
||||
+ }
|
||||
+
|
||||
+ public abstract void execute(CommandSender sender, String[] args);
|
||||
+
|
||||
+ public void tabComplete(List<String> list, String[] args) throws IllegalArgumentException {}
|
||||
+
|
||||
+ @Override
|
||||
+ @Deprecated
|
||||
+ public final boolean execute(CommandSender sender, String label, String[] args) {
|
||||
+ if (testPermission(sender)) {
|
||||
+ execute(sender, args);
|
||||
+ }
|
||||
+
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ @NotNull
|
||||
+ public List<String> tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException {
|
||||
+ var completions = new ArrayList<String>(0);
|
||||
+
|
||||
+ if (testPermissionSilent(sender)) {
|
||||
+ tabComplete(completions, args);
|
||||
+ }
|
||||
+
|
||||
+ return completions;
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/me/samsuik/sakura/command/SakuraCommand.java b/src/main/java/me/samsuik/sakura/command/SakuraCommand.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..2b145614bf189ae56622016436bfefd63f5271eb
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/samsuik/sakura/command/SakuraCommand.java
|
||||
@@ -0,0 +1,93 @@
|
||||
+package me.samsuik.sakura.command;
|
||||
+
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import net.kyori.adventure.text.format.NamedTextColor;
|
||||
+import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
+import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||
+import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import org.bukkit.command.Command;
|
||||
+import org.bukkit.command.CommandSender;
|
||||
+import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
+import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import javax.annotation.Nullable;
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.Arrays;
|
||||
+import java.util.Collections;
|
||||
+import java.util.List;
|
||||
+
|
||||
+@DefaultQualifier(NonNull.class)
|
||||
+public final class SakuraCommand extends Command {
|
||||
+
|
||||
+ private static final Component INFORMATION_MESSAGE = MiniMessage.miniMessage().deserialize("""
|
||||
+ <dark_purple>.</dark_purple>
|
||||
+ <dark_purple>| <white>This is the main command for <gradient:red:light_purple:0.5>Sakura</gradient>.
|
||||
+ <dark_purple>| <white>All exclusive commands are listed below."""
|
||||
+ );
|
||||
+
|
||||
+ private static final String COMMAND_MSG = "<dark_purple>| <dark_gray>*</dark_gray> /<light_purple><command>";
|
||||
+
|
||||
+ public SakuraCommand(String name) {
|
||||
+ super(name);
|
||||
+
|
||||
+ this.description = "";
|
||||
+ this.usageMessage = "/sakura";
|
||||
+ this.setPermission("bukkit.command.sakura");
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean execute(CommandSender sender, String commandLabel, String[] args) {
|
||||
+ if (args.length > 0) {
|
||||
+ var commands = new ArrayList<>(SakuraCommands.COMMANDS.values());
|
||||
+
|
||||
+ // This part is copied from the VersionCommand SubCommand in paper
|
||||
+ @Nullable
|
||||
+ var internalVersion = MinecraftServer.getServer().server.getCommandMap().getCommand("version");
|
||||
+ if (internalVersion != null) {
|
||||
+ commands.add(internalVersion);
|
||||
+ }
|
||||
+
|
||||
+ for (var base : commands) {
|
||||
+ if (base.getName().equalsIgnoreCase(args[0])) {
|
||||
+ return base.execute(sender, commandLabel, Arrays.copyOfRange(args, 1, args.length));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ sendHelpMessage(sender);
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ private void sendHelpMessage(CommandSender sender) {
|
||||
+ sender.sendMessage(INFORMATION_MESSAGE);
|
||||
+
|
||||
+ var uniqueCommands = SakuraCommands.COMMANDS.values()
|
||||
+ .stream()
|
||||
+ .filter(command -> command != this);
|
||||
+
|
||||
+ uniqueCommands.forEach((command) -> {
|
||||
+ sender.sendMessage(MiniMessage.miniMessage().deserialize(COMMAND_MSG,
|
||||
+ Placeholder.unparsed("command", command.getName()))
|
||||
+ );
|
||||
+ });
|
||||
+
|
||||
+ sender.sendMessage(Component.text("'", NamedTextColor.DARK_PURPLE));
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public List<String> tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException {
|
||||
+ if (!testPermissionSilent(sender)) {
|
||||
+ return Collections.emptyList();
|
||||
+ }
|
||||
+
|
||||
+ return SakuraCommands.COMMANDS.values().stream()
|
||||
+ .filter(command -> command != this) // ahem
|
||||
+ .map(Command::getName)
|
||||
+ .filter(name -> args.length <= 1 || name.startsWith(args[args.length - 1]))
|
||||
+ .toList();
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/me/samsuik/sakura/command/SakuraCommands.java b/src/main/java/me/samsuik/sakura/command/SakuraCommands.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..cd44b3400a1ab9544aa4a9e50b1054ea436a3643
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/samsuik/sakura/command/SakuraCommands.java
|
||||
@@ -0,0 +1,22 @@
|
||||
+package me.samsuik.sakura.command;
|
||||
+
|
||||
+import me.samsuik.sakura.command.subcommands.ConfigCommand;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import org.bukkit.command.Command;
|
||||
+
|
||||
+import java.util.HashMap;
|
||||
+import java.util.Map;
|
||||
+
|
||||
+public final class SakuraCommands {
|
||||
+ static final Map<String, Command> COMMANDS = new HashMap<>();
|
||||
+ static {
|
||||
+ COMMANDS.put("sakura", new SakuraCommand("sakura"));
|
||||
+ COMMANDS.put("config", new ConfigCommand("config"));
|
||||
+ }
|
||||
+
|
||||
+ public static void registerCommands(final MinecraftServer server) {
|
||||
+ COMMANDS.forEach((s, command) -> {
|
||||
+ server.server.getCommandMap().register(s, "sakura", command);
|
||||
+ });
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/me/samsuik/sakura/command/subcommands/ConfigCommand.java b/src/main/java/me/samsuik/sakura/command/subcommands/ConfigCommand.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..93c0f22cdf0c3b7ce4db55171ea397f5673231b1
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/samsuik/sakura/command/subcommands/ConfigCommand.java
|
||||
@@ -0,0 +1,50 @@
|
||||
+package me.samsuik.sakura.command.subcommands;
|
||||
+
|
||||
+import me.samsuik.sakura.command.BaseSubCommand;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import net.minecraft.server.level.ServerLevel;
|
||||
+import org.bukkit.command.Command;
|
||||
+import org.bukkit.command.CommandSender;
|
||||
+import org.bukkit.craftbukkit.CraftServer;
|
||||
+import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
+import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import java.io.File;
|
||||
+import java.util.Collections;
|
||||
+import java.util.List;
|
||||
+
|
||||
+import static net.kyori.adventure.text.Component.text;
|
||||
+import static net.kyori.adventure.text.format.NamedTextColor.GREEN;
|
||||
+import static net.kyori.adventure.text.format.NamedTextColor.RED;
|
||||
+
|
||||
+@DefaultQualifier(NonNull.class)
|
||||
+public final class ConfigCommand extends BaseSubCommand {
|
||||
+
|
||||
+ public ConfigCommand(String name) {
|
||||
+ super(name);
|
||||
+ this.description = "Command for reloading the sakura configuration file";
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void execute(CommandSender sender, String[] args) {
|
||||
+ Command.broadcastCommandMessage(sender, text("Please note that this command is not supported and may cause issues.", RED));
|
||||
+ Command.broadcastCommandMessage(sender, text("If you encounter any issues please use the /stop command to restart your server.", RED));
|
||||
+
|
||||
+ MinecraftServer server = ((CraftServer) sender.getServer()).getServer();
|
||||
+ me.samsuik.sakura.configuration.SakuraGlobalConfig.get().setup((File) server.options.valueOf("sakura-settings"));
|
||||
+ for (ServerLevel world : server.getAllLevels()) {
|
||||
+ world.sakuraConfig.init();
|
||||
+ }
|
||||
+ server.server.reloadCount++;
|
||||
+
|
||||
+ Command.broadcastCommandMessage(sender, text("Sakura config reload complete.", GREEN));
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public List<String> tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException {
|
||||
+ return Collections.emptyList();
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/me/samsuik/sakura/configuration/SakuraGlobalConfig.java b/src/main/java/me/samsuik/sakura/configuration/SakuraGlobalConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7000fa68886057fb742cf4f655a739b0ee3f62e1
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/samsuik/sakura/configuration/SakuraGlobalConfig.java
|
||||
@@ -0,0 +1,92 @@
|
||||
+package me.samsuik.sakura.configuration;
|
||||
+
|
||||
+import org.bukkit.configuration.file.YamlConfiguration;
|
||||
+
|
||||
+import java.io.File;
|
||||
+
|
||||
+public final class SakuraGlobalConfig {
|
||||
+ private static final String HEADER = """
|
||||
+ This is the main configuration file for Sakura.
|
||||
+ As you can see, there's a lot to configure. Some options may impact gameplay, so use
|
||||
+ with caution, and make sure you know what each option does before configuring.
|
||||
+
|
||||
+ This configuration file is not compatible with Sakura for modern versions of minecraft.
|
||||
+ """;
|
||||
+
|
||||
+ private static final SakuraGlobalConfig INSTANCE = new SakuraGlobalConfig();
|
||||
+
|
||||
+ public static SakuraGlobalConfig get() {
|
||||
+ return INSTANCE;
|
||||
+ }
|
||||
+
|
||||
+ private YamlConfiguration config;
|
||||
+ private int version;
|
||||
+
|
||||
+ public void setup(File configFile) {
|
||||
+ this.config = YamlConfigHelper.loadConfig(configFile, HEADER, config -> {
|
||||
+ this.version = this.getInt("config-version", 0);
|
||||
+ this.set("config-version", 0);
|
||||
+ });
|
||||
+ }
|
||||
+
|
||||
+ public YamlConfiguration getYamlConfig() {
|
||||
+ return this.config;
|
||||
+ }
|
||||
+
|
||||
+ private void set(String path, Object val) {
|
||||
+ this.config.set(path, val);
|
||||
+ }
|
||||
+
|
||||
+ private boolean getBoolean(String path, boolean def) {
|
||||
+ this.config.addDefault(path, def);
|
||||
+ return this.config.getBoolean(path, this.config.getBoolean(path));
|
||||
+ }
|
||||
+
|
||||
+ private int getInt(String path, int def) {
|
||||
+ this.config.addDefault(path, def);
|
||||
+ return this.config.getInt(path, this.config.getInt(path));
|
||||
+ }
|
||||
+
|
||||
+ private String getString(String path, String def) {
|
||||
+ this.config.addDefault(path, def);
|
||||
+ return this.config.getString(path, this.config.getString(path));
|
||||
+ }
|
||||
+
|
||||
+ public String fpsMessage = "<dark_gray>(<light_purple>S</light_purple>) <gray><state> <yellow><name>";
|
||||
+ public String fpsMaterial = "pink_stained_glass_pane";
|
||||
+ private void Fps() {
|
||||
+ this.fpsMessage = this.getString("fps.messsage", this.fpsMessage);
|
||||
+ this.fpsMaterial = this.getString("fps.material", this.fpsMaterial);
|
||||
+ }
|
||||
+
|
||||
+ public boolean reducedSearchRays;
|
||||
+ private void Explosion() {
|
||||
+ this.reducedSearchRays = this.getBoolean("cannons.explosion.reduced-search-rays", this.reducedSearchRays);
|
||||
+ }
|
||||
+
|
||||
+ public String potatoMessage = "<dark_gray>(<light_purple>S</light_purple>) <white>This block has <gray><remaining></gray> of <gray><durability>";
|
||||
+ private void Players() {
|
||||
+ this.potatoMessage = this.getString("players.potato-message", this.potatoMessage);
|
||||
+ }
|
||||
+
|
||||
+ public boolean calculateBiomeNoiseOncePerChunkSection = false;
|
||||
+ private void Environment() {
|
||||
+ this.calculateBiomeNoiseOncePerChunkSection = this.getBoolean("environment.calculate-biome-noise-once-per-chunk-section", this.calculateBiomeNoiseOncePerChunkSection);
|
||||
+ }
|
||||
+
|
||||
+ public int minSpawnDelay = 200;
|
||||
+ public int maxSpawnDelay = 800;
|
||||
+ public int spawnCount = 4;
|
||||
+ public int maxNearbyEntities = 6;
|
||||
+ public int requiredPlayerRange = 16;
|
||||
+ public int spawnRange = 4;
|
||||
+ private void MobSpawnerDefaults() {
|
||||
+ // as global and world configs are combined I moved the defaults into its own section
|
||||
+ this.minSpawnDelay = this.getInt("environment.mob-spawner.defaults.min-spawn-delay", this.minSpawnDelay);
|
||||
+ this.maxSpawnDelay = this.getInt("environment.mob-spawner.defaults.max-spawn-delay", this.maxSpawnDelay);
|
||||
+ this.spawnCount = this.getInt("environment.mob-spawner.defaults.spawn-count", this.spawnCount);
|
||||
+ this.maxNearbyEntities = this.getInt("environment.mob-spawner.defaults.max-nearby-entities", this.maxNearbyEntities);
|
||||
+ this.requiredPlayerRange = this.getInt("environment.mob-spawner.defaults.required-player-range", this.requiredPlayerRange);
|
||||
+ this.spawnRange = this.getInt("environment.mob-spawner.defaults.spawn-range", this.spawnRange);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/me/samsuik/sakura/configuration/SakuraWorldConfig.java b/src/main/java/me/samsuik/sakura/configuration/SakuraWorldConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..34c4d0db007753f37cc4ca96c21175ce0f0d56e1
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/samsuik/sakura/configuration/SakuraWorldConfig.java
|
||||
@@ -0,0 +1,325 @@
|
||||
+package me.samsuik.sakura.configuration;
|
||||
+
|
||||
+import it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap;
|
||||
+import me.samsuik.sakura.configuration.serializer.*;
|
||||
+import me.samsuik.sakura.entity.TntSpread;
|
||||
+import me.samsuik.sakura.entity.merge.MergeLevel;
|
||||
+import me.samsuik.sakura.explosion.durable.DurableMaterial;
|
||||
+import me.samsuik.sakura.physics.PhysicsVersion;
|
||||
+import net.minecraft.Util;
|
||||
+import net.minecraft.world.entity.EntityType;
|
||||
+import net.minecraft.world.entity.item.FallingBlockEntity;
|
||||
+import net.minecraft.world.item.Item;
|
||||
+import net.minecraft.world.level.block.Block;
|
||||
+import net.minecraft.world.level.block.Blocks;
|
||||
+import org.bukkit.configuration.ConfigurationSection;
|
||||
+import org.bukkit.configuration.MemoryConfiguration;
|
||||
+import org.bukkit.configuration.file.YamlConfiguration;
|
||||
+
|
||||
+import java.util.*;
|
||||
+
|
||||
+public final class SakuraWorldConfig {
|
||||
+ private final String worldName;
|
||||
+ private YamlConfiguration config;
|
||||
+
|
||||
+ public SakuraWorldConfig(String worldName) {
|
||||
+ this.worldName = worldName;
|
||||
+ this.init();
|
||||
+ }
|
||||
+
|
||||
+ public void init() {
|
||||
+ this.config = SakuraGlobalConfig.get().getYamlConfig(); // grab updated reference
|
||||
+ }
|
||||
+
|
||||
+ private String worldPath(String path) {
|
||||
+ return "world-settings." + this.worldName + "." + path;
|
||||
+ }
|
||||
+
|
||||
+ private void set(String path, Object val) {
|
||||
+ this.config.set(path, val);
|
||||
+ if (this.config.get(this.worldPath(path)) != null) {
|
||||
+ this.config.set(this.worldPath(path), val);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private void remove(String path) {
|
||||
+ this.config.addDefault(path, null);
|
||||
+ this.set(path, null);
|
||||
+ }
|
||||
+
|
||||
+ private boolean getBoolean(String path, boolean def) {
|
||||
+ this.config.addDefault(path, def);
|
||||
+ return this.config.getBoolean(this.worldPath(path), this.config.getBoolean(path, def));
|
||||
+ }
|
||||
+
|
||||
+ private double getDouble(String path, double def) {
|
||||
+ this.config.addDefault(path, def);
|
||||
+ return this.config.getDouble(this.worldPath(path), this.config.getDouble(path));
|
||||
+ }
|
||||
+
|
||||
+ private int getInt(String path, int def) {
|
||||
+ this.config.addDefault(path, def);
|
||||
+ return this.config.getInt(this.worldPath(path), this.config.getInt(path, def));
|
||||
+ }
|
||||
+
|
||||
+ private <T> List<T> getList(String path, List<T> def) {
|
||||
+ this.config.addDefault(path, def);
|
||||
+ return (List<T>) this.config.getList(this.worldPath(path), this.config.getList(path));
|
||||
+ }
|
||||
+
|
||||
+ private String getString(String path, String def) {
|
||||
+ this.config.addDefault(path, def);
|
||||
+ return this.config.getString(this.worldPath(path), this.config.getString(path));
|
||||
+ }
|
||||
+
|
||||
+ private <T extends Enum<T>> T getEnum(String path, T def, Class<T> enumClass) {
|
||||
+ String name = this.getString(path, def.name());
|
||||
+ return Enum.valueOf(enumClass, name);
|
||||
+ }
|
||||
+
|
||||
+ private OptionalDouble getDoubleWithContext(String path, String context) {
|
||||
+ this.config.addDefault(path, context);
|
||||
+ double present = this.config.getDouble(path, this.config.getDouble(this.worldPath(path), Double.MIN_VALUE));
|
||||
+ return present != Double.MIN_VALUE ? OptionalDouble.of(present) : OptionalDouble.empty();
|
||||
+ }
|
||||
+
|
||||
+ private OptionalInt getIntWithContext(String path, String context) {
|
||||
+ this.config.addDefault(path, context);
|
||||
+ int present = this.config.getInt(path, this.config.getInt(this.worldPath(path), Integer.MIN_VALUE));
|
||||
+ return present != Integer.MIN_VALUE ? OptionalInt.of(present) : OptionalInt.empty();
|
||||
+ }
|
||||
+
|
||||
+ private <K, V, C> void loadSerializedMap(String path, Map<K, V> def, MapSerializer<K, V, C> serializer) {
|
||||
+ this.config.addDefault(path, this.getSerializedMapDefaults(def, serializer));
|
||||
+ ConfigurationSection section = this.config.getConfigurationSection(path);
|
||||
+ def.clear();
|
||||
+ for (String serializedKey : section.getKeys(false)) {
|
||||
+ K key = serializer.deserializeKey(serializedKey);
|
||||
+ V value = serializer.deserializeValue((C) this.config.get(serializedKey));
|
||||
+ def.put(key, value);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private <K, V> ConfigurationSection getSerializedMapDefaults(Map<K, V> def, MapSerializer<K, V, ?> serializer) {
|
||||
+ ConfigurationSection section = new MemoryConfiguration();
|
||||
+ def.forEach((k, v) -> {
|
||||
+ String key = serializer.serializeKey(k);
|
||||
+ Object value = serializer.serializeValue(v);
|
||||
+ section.set(key, value);
|
||||
+ });
|
||||
+ return section;
|
||||
+ }
|
||||
+
|
||||
+ private <V, C> void loadSerializedList(String path, List<V> def, ListSerializer<V, C> serializer) {
|
||||
+ List<C> defaults = def.stream()
|
||||
+ .map(serializer::serialize)
|
||||
+ .toList();
|
||||
+ def.clear();
|
||||
+ for (C object : this.getList(path, defaults)) {
|
||||
+ def.add(serializer.deserialize(object));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public MergeLevel mergeLevel = MergeLevel.STRICT;
|
||||
+ public boolean tntAndSandAffectedByBubbleColumns = true;
|
||||
+ public boolean loadChunks = false;
|
||||
+ public boolean collideWhenMoving;
|
||||
+ public double collideMovingFasterThan = 64.0;
|
||||
+ private void Cannons() {
|
||||
+ this.mergeLevel = this.getEnum("cannons.merge-level", this.mergeLevel, MergeLevel.class);
|
||||
+ this.tntAndSandAffectedByBubbleColumns = this.getBoolean("cannons.tnt-and-sand-affected-by-bubble-columns", this.tntAndSandAffectedByBubbleColumns);
|
||||
+ this.loadChunks = this.getBoolean("cannons.load-chunks", this.loadChunks);
|
||||
+
|
||||
+ this.collideWhenMoving = this.getBoolean("cannons.treat-collidable-blocks-as-full.while-moving", this.collideWhenMoving);
|
||||
+ this.collideMovingFasterThan = this.getDouble("cannons.treat-collidable-blocks-as-full.moving-faster-than", this.collideMovingFasterThan);
|
||||
+ }
|
||||
+
|
||||
+ public OptionalInt leftShootingThreshold = OptionalInt.empty();
|
||||
+ public OptionalInt maxAdjustDistance = OptionalInt.empty();
|
||||
+ private void Restrictions() {
|
||||
+ this.leftShootingThreshold = this.getIntWithContext("cannons.restrictions.left-shooting-threshold", "disabled");
|
||||
+ this.maxAdjustDistance = this.getIntWithContext("cannons.restrictions.max-adjust-distance", "disabled");
|
||||
+ }
|
||||
+
|
||||
+ public boolean forcePositionUpdates;
|
||||
+ private void Tnt() {
|
||||
+ this.forcePositionUpdates = this.getBoolean("cannons.tnt.force-position-updates", this.forcePositionUpdates);
|
||||
+ }
|
||||
+
|
||||
+ public boolean despawnInsideMovingPistons = true;
|
||||
+ public boolean concreteSolidifyInWater = true;
|
||||
+ public boolean preventStackingAgainstBorder = false;
|
||||
+ public boolean preventStackingAtWorldHeight = false;
|
||||
+ private void Sand() {
|
||||
+ this.despawnInsideMovingPistons = this.getBoolean("cannons.sand.despawn-inside-moving-pistons", this.despawnInsideMovingPistons);
|
||||
+ this.concreteSolidifyInWater = this.getBoolean("cannons.sand.concrete-solidify-in-water", this.concreteSolidifyInWater);
|
||||
+ this.preventStackingAgainstBorder = this.getBoolean("cannons.sand.prevent-stacking.against-border", this.preventStackingAgainstBorder);
|
||||
+ this.preventStackingAtWorldHeight = this.getBoolean("cannons.sand.prevent-stacking.world-height", this.preventStackingAtWorldHeight);
|
||||
+ }
|
||||
+
|
||||
+ public boolean isFallingBlockInBounds(FallingBlockEntity entity) {
|
||||
+ if (this.preventStackingAtWorldHeight && entity.blockPosition().getY() >= entity.level.getMaxBuildHeight()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ if (this.preventStackingAgainstBorder && io.papermc.paper.util.CollisionUtil.isCollidingWithBorderEdge(entity.level.getWorldBorder(), entity.getBoundingBox().inflate(0.01))) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ public boolean optimiseProtectedRegions = true;
|
||||
+ public boolean avoidRedundantBlockSearches = false;
|
||||
+ public Map<Block, DurableMaterial> durableMaterials = Util.make(new Reference2ObjectOpenHashMap<>(), map -> {
|
||||
+ map.put(Blocks.OBSIDIAN, new DurableMaterial(4, Blocks.COBBLESTONE.getExplosionResistance()));
|
||||
+ map.put(Blocks.ANVIL, new DurableMaterial(3, Blocks.END_STONE.getExplosionResistance()));
|
||||
+ map.put(Blocks.CHIPPED_ANVIL, new DurableMaterial(3, Blocks.END_STONE.getExplosionResistance()));
|
||||
+ map.put(Blocks.DAMAGED_ANVIL, new DurableMaterial(3, Blocks.END_STONE.getExplosionResistance()));
|
||||
+ });
|
||||
+ public boolean protectScaffoldingFromCreepers = false;
|
||||
+ public boolean allowNonTntBreakingDurableBlocks = false;
|
||||
+ public boolean destroyWaterloggedBlocks = false;
|
||||
+ public boolean explodeLava = false;
|
||||
+ public boolean consistentRadius = false;
|
||||
+ public boolean explosionsHurtPlayers = true;
|
||||
+ public boolean explosionsDropItems = true;
|
||||
+ private void Explosion() {
|
||||
+ this.optimiseProtectedRegions = this.getBoolean("cannons.explosion.optimise-protected-regions", this.optimiseProtectedRegions);
|
||||
+ this.avoidRedundantBlockSearches = this.getBoolean("cannons.explosion.avoid-redundant-block-searches", this.avoidRedundantBlockSearches);
|
||||
+ this.loadSerializedMap("cannons.explosion.durable-materials", this.durableMaterials, DurableMaterialSerializer.get());
|
||||
+ this.protectScaffoldingFromCreepers = this.getBoolean("cannons.explosion.protect-scaffolding-from-creepers", this.protectScaffoldingFromCreepers);
|
||||
+ this.allowNonTntBreakingDurableBlocks = this.getBoolean("cannons.explosion.allow-non-tnt-breaking-durable-blocks", this.allowNonTntBreakingDurableBlocks);
|
||||
+ this.destroyWaterloggedBlocks = this.getBoolean("cannons.explosion.destroy-waterlogged-blocks", this.destroyWaterloggedBlocks);
|
||||
+ this.explodeLava = this.getBoolean("cannons.explosion.explode-lava", this.explodeLava);
|
||||
+ this.consistentRadius = this.getBoolean("cannons.explosion.consistent-radius", this.consistentRadius);
|
||||
+ this.explosionsHurtPlayers = this.getBoolean("cannons.explosion.explosions-hurt-players", this.explosionsHurtPlayers);
|
||||
+ this.explosionsDropItems = this.getBoolean("cannons.explosion.explosions-drop-items", this.explosionsDropItems);
|
||||
+ }
|
||||
+
|
||||
+ public TntSpread tntSpread = TntSpread.ALL;
|
||||
+ public boolean tntFlowsInWater = true;
|
||||
+ public boolean fallingBlockParity = false;
|
||||
+ public PhysicsVersion physicsVersion = PhysicsVersion.LATEST;
|
||||
+ private void Mechanics() {
|
||||
+ this.tntSpread = this.getEnum("cannons.mechanics.tnt-spread", this.tntSpread, TntSpread.class);
|
||||
+ this.tntFlowsInWater = this.getBoolean("cannons.mechanics.tnt-flows-in-water", this.tntFlowsInWater);
|
||||
+ this.fallingBlockParity = this.getBoolean("cannons.mechanics.falling-block-parity", this.fallingBlockParity);
|
||||
+ this.physicsVersion = this.getEnum("cannons.mechanics.physics-version", this.physicsVersion, PhysicsVersion.class);
|
||||
+ }
|
||||
+
|
||||
+ public boolean dispenserRandomItemSelection = true;
|
||||
+ public boolean fluidsBreakRedstone = true;
|
||||
+ private void Technical() {
|
||||
+ this.dispenserRandomItemSelection = this.getBoolean("technical.dispenser-random-item-selection", this.dispenserRandomItemSelection);
|
||||
+ this.fluidsBreakRedstone = this.getBoolean("technical.redstone.fluids-break-redstone", this.fluidsBreakRedstone);
|
||||
+ }
|
||||
+
|
||||
+ public boolean legacyCombatMechanics = false;
|
||||
+ public boolean allowSweepAttacks = true;
|
||||
+ public boolean shieldDamageReduction = false;
|
||||
+ public boolean oldEnchantedGoldenApple = false;
|
||||
+ public boolean oldSoundsAndParticleEffects = false;
|
||||
+ public boolean fastHealthRegen = true;
|
||||
+ public OptionalInt maxArmourDamage = OptionalInt.empty();
|
||||
+ private void Combat() {
|
||||
+ this.legacyCombatMechanics = this.getBoolean("players.combat.legacy-combat-mechanics", this.legacyCombatMechanics);
|
||||
+ this.allowSweepAttacks = this.getBoolean("players.combat.allow-sweep-attacks", this.allowSweepAttacks);
|
||||
+ this.shieldDamageReduction = this.getBoolean("players.combat.shield-damage-reduction", this.shieldDamageReduction);
|
||||
+ this.oldEnchantedGoldenApple = this.getBoolean("players.combat.old-enchanted-golden-apple", this.oldEnchantedGoldenApple);
|
||||
+ this.oldSoundsAndParticleEffects = this.getBoolean("players.combat.old-sounds-and-particle-effects", this.oldSoundsAndParticleEffects);
|
||||
+ this.fastHealthRegen = this.getBoolean("players.combat.fast-health-regen", this.fastHealthRegen);
|
||||
+ this.maxArmourDamage = this.getIntWithContext("players.combat.max-armour-damage", "default");
|
||||
+ }
|
||||
+
|
||||
+ public OptionalDouble knockbackVertical = OptionalDouble.empty();
|
||||
+ public double knockbackVerticalLimit = 0.4;
|
||||
+ public boolean verticalKnockbackRequireGround = true;
|
||||
+ public double baseKnockback = 0.4;
|
||||
+ public double sweepingEdgeKnockback = 0.4;
|
||||
+ public boolean sprintingRequireFullAttack = true;
|
||||
+ public double sprintingExtraKnockback = 0.5;
|
||||
+ public OptionalInt sprintingKnockbackDelay = OptionalInt.empty();
|
||||
+ public boolean fishingHooksApplyKnockback;
|
||||
+ public double knockbackResistanceModifier = 1.0;
|
||||
+ public double shieldHitKnockback = 0.5;
|
||||
+ private void Knockback() {
|
||||
+ this.knockbackVertical = this.getDoubleWithContext("players.knockback.knockback-vertical", "default");
|
||||
+ this.knockbackVerticalLimit = this.getDouble("players.knockback.knockback-vertical-limit", this.knockbackVerticalLimit);
|
||||
+ this.verticalKnockbackRequireGround = this.getBoolean("players.knockback.vertical-knockback-require-ground", this.verticalKnockbackRequireGround);
|
||||
+ this.baseKnockback = this.getDouble("players.knockback.base-knockback", this.baseKnockback);
|
||||
+ this.sweepingEdgeKnockback = this.getDouble("players.knockback.sweeping-edge-knockback", this.sweepingEdgeKnockback);
|
||||
+
|
||||
+ this.sprintingRequireFullAttack = this.getBoolean("players.knockback.sprinting.require-full-attack", this.sprintingRequireFullAttack);
|
||||
+ this.sprintingExtraKnockback = this.getDouble("players.knockback.sprinting.extra-knockback", this.sprintingExtraKnockback);
|
||||
+ this.sprintingKnockbackDelay = this.getIntWithContext("players.knockback.sprinting.knockback-delay", "default");
|
||||
+
|
||||
+ this.fishingHooksApplyKnockback = this.getBoolean("players.knockback.projectiles.fishing-hooks-apply-knockback", this.fishingHooksApplyKnockback);
|
||||
+ this.knockbackResistanceModifier = this.getDouble("players.knockback.knockback-resistance-modifier", this.knockbackResistanceModifier);
|
||||
+ this.shieldHitKnockback = this.getDouble("players.knockback.shield-hit-knockback", this.shieldHitKnockback);
|
||||
+ }
|
||||
+
|
||||
+ public boolean posesShrinkCollisionBox = true;
|
||||
+ public boolean fishingHooksPullEntities = true;
|
||||
+ private void Players() {
|
||||
+ this.posesShrinkCollisionBox = this.getBoolean("players.poses-shrink-collision-box", this.posesShrinkCollisionBox);
|
||||
+ this.fishingHooksPullEntities = this.getBoolean("players.fishing-hooks-pull-entities", this.fishingHooksPullEntities);
|
||||
+ }
|
||||
+
|
||||
+ public boolean disableMobAi = false;
|
||||
+ public boolean waterSensitivity = true;
|
||||
+ public boolean instantDeathAnimation = false;
|
||||
+ public boolean ironGolemsTakeFalldamage = false;
|
||||
+ public Map<EntityType<?>, Integer> chunkTravelLimit = Util.make(new Reference2ObjectOpenHashMap<>(), map -> {
|
||||
+ map.put(EntityType.ENDER_PEARL, 8);
|
||||
+ });
|
||||
+ public boolean projectilesLoadChunksForCollisions = false;
|
||||
+ public List<Item> explosionResistantItems = List.of();
|
||||
+ private void Entity() {
|
||||
+ this.disableMobAi = this.getBoolean("entity.disable-mob-ai", this.disableMobAi);
|
||||
+ this.waterSensitivity = this.getBoolean("entity.water-sensitivity", this.waterSensitivity);
|
||||
+ this.instantDeathAnimation = this.getBoolean("entity.instant-death-animation", this.instantDeathAnimation);
|
||||
+ this.ironGolemsTakeFalldamage = this.getBoolean("entity.iron-golems-take-falldamage", this.ironGolemsTakeFalldamage);
|
||||
+ this.loadSerializedMap("entity.chunk-travel-limit", this.chunkTravelLimit, ChunkTravelLimitsSerializer.get());
|
||||
+ this.projectilesLoadChunksForCollisions = this.getBoolean("entity.projectiles-load-chunks-for-collisions", this.projectilesLoadChunksForCollisions);
|
||||
+ this.loadSerializedList("entity.items.explosion-resistant-items", this.explosionResistantItems, ItemListSerializer.get());
|
||||
+ }
|
||||
+
|
||||
+ public double horizontalSpeed = 1.0;
|
||||
+ public double verticalSpeed = 1.0;
|
||||
+ public boolean allowBreakingInsideEntities = false;
|
||||
+ private void ThrownPotion() {
|
||||
+ this.horizontalSpeed = this.getDouble("entity.thrown-potion.horizontal-speed", this.horizontalSpeed);
|
||||
+ this.verticalSpeed = this.getDouble("entity.thrown-potion.vertical-speed", this.verticalSpeed);
|
||||
+ this.allowBreakingInsideEntities = this.getBoolean("entity.thrown-potion.allow-breaking-inside-entities", this.allowBreakingInsideEntities);
|
||||
+ }
|
||||
+
|
||||
+ public boolean useOutlineForCollision = false;
|
||||
+ private void EnderPearl() {
|
||||
+ this.useOutlineForCollision = this.getBoolean("entity.ender-pearl.use-outline-for-collision", this.useOutlineForCollision);
|
||||
+ }
|
||||
+
|
||||
+ public boolean allowWaterInTheNether = false;
|
||||
+ public boolean disableFastNetherLava = false;
|
||||
+ private void Environment() {
|
||||
+ this.allowWaterInTheNether = this.getBoolean("environment.allow-water-in-the-nether", this.allowWaterInTheNether);
|
||||
+ this.disableFastNetherLava = this.getBoolean("environment.disable-fast-nether-lava", this.disableFastNetherLava);
|
||||
+ }
|
||||
+
|
||||
+ public boolean legacyBlockFormation = false;
|
||||
+ private void BlockGeneration() {
|
||||
+ this.legacyBlockFormation = this.getBoolean("environment.block-generation.legacy-block-formation", this.legacyBlockFormation);
|
||||
+ }
|
||||
+
|
||||
+ public boolean useRandomChanceToGrow = false;
|
||||
+ private void Crops() {
|
||||
+ this.useRandomChanceToGrow = this.getBoolean("environment.crops.use-random-chance-to-grow", this.useRandomChanceToGrow);
|
||||
+ }
|
||||
+
|
||||
+ public boolean checkSpawnConditions = true;
|
||||
+ public boolean requireNearbyPlayer = true;
|
||||
+ public boolean ignoreEntityLimit = false;
|
||||
+ private void MobSpawner() {
|
||||
+ this.checkSpawnConditions = this.getBoolean("environment.mob-spawner.check-spawn-conditions", this.checkSpawnConditions);
|
||||
+ this.requireNearbyPlayer = this.getBoolean("environment.mob-spawner.require-nearby-player", this.requireNearbyPlayer);
|
||||
+ this.ignoreEntityLimit = this.getBoolean("environment.mob-spawner.ignore-entity-limit", this.ignoreEntityLimit);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/me/samsuik/sakura/configuration/YamlConfigHelper.java b/src/main/java/me/samsuik/sakura/configuration/YamlConfigHelper.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..9340a0696d2a1bf4d91d67627df49191a40682b6
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/samsuik/sakura/configuration/YamlConfigHelper.java
|
||||
@@ -0,0 +1,60 @@
|
||||
+package me.samsuik.sakura.configuration;
|
||||
+
|
||||
+import com.google.common.base.Throwables;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.configuration.InvalidConfigurationException;
|
||||
+import org.bukkit.configuration.file.YamlConfiguration;
|
||||
+
|
||||
+import java.io.File;
|
||||
+import java.io.IOException;
|
||||
+import java.lang.reflect.InvocationTargetException;
|
||||
+import java.lang.reflect.Method;
|
||||
+import java.lang.reflect.Modifier;
|
||||
+import java.util.function.Consumer;
|
||||
+import java.util.logging.Level;
|
||||
+
|
||||
+public final class YamlConfigHelper {
|
||||
+ public static YamlConfiguration loadConfig(File configFile, String header, Consumer<YamlConfiguration> afterLoad) {
|
||||
+ YamlConfiguration config = new YamlConfiguration();
|
||||
+ try {
|
||||
+ config.load(configFile);
|
||||
+ } catch (IOException ignored) {
|
||||
+ } catch (InvalidConfigurationException ex) {
|
||||
+ Bukkit.getLogger().log(Level.SEVERE, String.format("Could not load %s, please correct your syntax errors", configFile.getName()), ex);
|
||||
+ throw Throwables.propagate(ex);
|
||||
+ }
|
||||
+
|
||||
+ config.options().header(header);
|
||||
+ config.options().copyDefaults(true);
|
||||
+ afterLoad.accept(config);
|
||||
+
|
||||
+ readConfig(SakuraGlobalConfig.class, null);
|
||||
+ saveConfig(config, configFile);
|
||||
+ return config;
|
||||
+ }
|
||||
+
|
||||
+ public static void readConfig(Class<?> clazz, Object instance) {
|
||||
+ for (Method method : clazz.getDeclaredMethods()) {
|
||||
+ if (Modifier.isPrivate(method.getModifiers())) {
|
||||
+ if (method.getParameterTypes().length == 0 && method.getReturnType() == Void.TYPE) {
|
||||
+ try {
|
||||
+ method.setAccessible(true);
|
||||
+ method.invoke(instance);
|
||||
+ } catch (InvocationTargetException ex) {
|
||||
+ throw Throwables.propagate(ex.getCause());
|
||||
+ } catch (Exception ex) {
|
||||
+ Bukkit.getLogger().log(Level.SEVERE, "Error invoking " + method, ex);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void saveConfig(YamlConfiguration config, File configFile) {
|
||||
+ try {
|
||||
+ config.save(configFile);
|
||||
+ } catch (IOException ex) {
|
||||
+ Bukkit.getLogger().log(Level.SEVERE, "Could not save " + configFile, ex);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/me/samsuik/sakura/configuration/serializer/ChunkTravelLimitsSerializer.java b/src/main/java/me/samsuik/sakura/configuration/serializer/ChunkTravelLimitsSerializer.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..37be21e53f33c1aa64e1919092daa4cb0b1515c4
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/samsuik/sakura/configuration/serializer/ChunkTravelLimitsSerializer.java
|
||||
@@ -0,0 +1,33 @@
|
||||
+package me.samsuik.sakura.configuration.serializer;
|
||||
+
|
||||
+import net.minecraft.core.Registry;
|
||||
+import net.minecraft.resources.ResourceLocation;
|
||||
+import net.minecraft.world.entity.EntityType;
|
||||
+
|
||||
+public final class ChunkTravelLimitsSerializer implements MapSerializer<EntityType<?>, Integer, Integer> {
|
||||
+ private static final ChunkTravelLimitsSerializer INSTANCE = new ChunkTravelLimitsSerializer();
|
||||
+
|
||||
+ public static ChunkTravelLimitsSerializer get() {
|
||||
+ return INSTANCE;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String serializeKey(EntityType<?> key) {
|
||||
+ return Registry.ENTITY_TYPE.getKey(key).getPath();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public EntityType<?> deserializeKey(String string) {
|
||||
+ return Registry.ENTITY_TYPE.get(new ResourceLocation(string));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Integer serializeValue(Integer val) {
|
||||
+ return val;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Integer deserializeValue(Integer val) {
|
||||
+ return val;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/me/samsuik/sakura/configuration/serializer/DurableMaterialSerializer.java b/src/main/java/me/samsuik/sakura/configuration/serializer/DurableMaterialSerializer.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0b1670515231be1408780fa6d4cc2daa599b024c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/samsuik/sakura/configuration/serializer/DurableMaterialSerializer.java
|
||||
@@ -0,0 +1,41 @@
|
||||
+package me.samsuik.sakura.configuration.serializer;
|
||||
+
|
||||
+import me.samsuik.sakura.explosion.durable.DurableMaterial;
|
||||
+import net.minecraft.core.Registry;
|
||||
+import net.minecraft.resources.ResourceLocation;
|
||||
+import net.minecraft.world.level.block.Block;
|
||||
+import org.bukkit.configuration.ConfigurationSection;
|
||||
+import org.bukkit.configuration.MemoryConfiguration;
|
||||
+
|
||||
+public final class DurableMaterialSerializer implements MapSerializer<Block, DurableMaterial, ConfigurationSection> {
|
||||
+ private static final DurableMaterialSerializer INSTANCE = new DurableMaterialSerializer();
|
||||
+
|
||||
+ public static DurableMaterialSerializer get() {
|
||||
+ return INSTANCE;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String serializeKey(Block key) {
|
||||
+ return Registry.BLOCK.getKey(key).getPath();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Block deserializeKey(String blockName) {
|
||||
+ return Registry.BLOCK.get(new ResourceLocation(blockName));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public ConfigurationSection serializeValue(DurableMaterial mat) {
|
||||
+ MemoryConfiguration materialSection = new MemoryConfiguration();
|
||||
+ materialSection.set("durability", mat.durability());
|
||||
+ materialSection.set("resistance", mat.resistance());
|
||||
+ return materialSection;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public DurableMaterial deserializeValue(ConfigurationSection materialSection) {
|
||||
+ int durability = materialSection.getInt("durability", 0);
|
||||
+ float resistance = (float) materialSection.getDouble("resistance", 0.0);
|
||||
+ return new DurableMaterial(durability, resistance);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/me/samsuik/sakura/configuration/serializer/ItemListSerializer.java b/src/main/java/me/samsuik/sakura/configuration/serializer/ItemListSerializer.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..1619656cd9d776ce6abb5de15364cc6cf1ba8f12
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/samsuik/sakura/configuration/serializer/ItemListSerializer.java
|
||||
@@ -0,0 +1,23 @@
|
||||
+package me.samsuik.sakura.configuration.serializer;
|
||||
+
|
||||
+import net.minecraft.core.Registry;
|
||||
+import net.minecraft.resources.ResourceLocation;
|
||||
+import net.minecraft.world.item.Item;
|
||||
+
|
||||
+public final class ItemListSerializer implements ListSerializer<Item, String> {
|
||||
+ private static final ItemListSerializer INSTANCE = new ItemListSerializer();
|
||||
+
|
||||
+ public static ItemListSerializer get() {
|
||||
+ return INSTANCE;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String serialize(Item val) {
|
||||
+ return Registry.ITEM.getKey(val).getPath();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Item deserialize(String any) {
|
||||
+ return Registry.ITEM.get(new ResourceLocation(any));
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/me/samsuik/sakura/configuration/serializer/ListSerializer.java b/src/main/java/me/samsuik/sakura/configuration/serializer/ListSerializer.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0937a8dd5b8dcb1c594c0afb82b5dfda3f6c8305
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/samsuik/sakura/configuration/serializer/ListSerializer.java
|
||||
@@ -0,0 +1,7 @@
|
||||
+package me.samsuik.sakura.configuration.serializer;
|
||||
+
|
||||
+public interface ListSerializer<V, C> {
|
||||
+ C serialize(V val);
|
||||
+
|
||||
+ V deserialize(C any);
|
||||
+}
|
||||
diff --git a/src/main/java/me/samsuik/sakura/configuration/serializer/MapSerializer.java b/src/main/java/me/samsuik/sakura/configuration/serializer/MapSerializer.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7eec08f2263ec1eef5571bcef33bb01771b36833
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/samsuik/sakura/configuration/serializer/MapSerializer.java
|
||||
@@ -0,0 +1,13 @@
|
||||
+package me.samsuik.sakura.configuration.serializer;
|
||||
+
|
||||
+public interface MapSerializer<K, V, C> {
|
||||
+
|
||||
+
|
||||
+ String serializeKey(K key);
|
||||
+
|
||||
+ K deserializeKey(String string);
|
||||
+
|
||||
+ C serializeValue(V val);
|
||||
+
|
||||
+ V deserializeValue(C object);
|
||||
+}
|
||||
diff --git a/src/main/java/me/samsuik/sakura/entity/TntSpread.java b/src/main/java/me/samsuik/sakura/entity/TntSpread.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..83275db7686a656f8d932d03e092cc6ddaf31ebb
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/samsuik/sakura/entity/TntSpread.java
|
||||
@@ -0,0 +1,5 @@
|
||||
+package me.samsuik.sakura.entity;
|
||||
+
|
||||
+public enum TntSpread {
|
||||
+ ALL, Y, NONE;
|
||||
+}
|
||||
diff --git a/src/main/java/me/samsuik/sakura/explosion/durable/DurableMaterial.java b/src/main/java/me/samsuik/sakura/explosion/durable/DurableMaterial.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..4024f9738e039ffffd560a07a2210f758879d3c0
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/samsuik/sakura/explosion/durable/DurableMaterial.java
|
||||
@@ -0,0 +1,7 @@
|
||||
+package me.samsuik.sakura.explosion.durable;
|
||||
+
|
||||
+import org.spongepowered.configurate.objectmapping.ConfigSerializable;
|
||||
+
|
||||
+@ConfigSerializable
|
||||
+public record DurableMaterial(int durability, float resistance) {
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 257c94f7c1cb00c9a91ab82e311dfd8eca29c538..edd21098ee4c2773acf61fd073d8c87fe2880201 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -235,6 +235,10 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
io.papermc.paper.util.ObfHelper.INSTANCE.getClass(); // load mappings for stacktrace deobf and etc.
|
||||
io.papermc.paper.brigadier.PaperBrigadierProviderImpl.INSTANCE.getClass(); // init PaperBrigadierProvider
|
||||
// Paper end
|
||||
+ // Sakura start
|
||||
+ me.samsuik.sakura.configuration.SakuraGlobalConfig.get().setup((java.io.File) this.options.valueOf("sakura-settings"));
|
||||
+ me.samsuik.sakura.command.SakuraCommands.registerCommands(this);
|
||||
+ // Sakura end
|
||||
|
||||
this.setPvpAllowed(dedicatedserverproperties.pvp);
|
||||
this.setFlightAllowed(dedicatedserverproperties.allowFlight);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index fee8996f35b38fd79946cdfd677763e0201eb57d..db7335a079cf711a829b2e4fb7354717da2f8789 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -162,6 +162,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot
|
||||
|
||||
public final com.destroystokyo.paper.PaperWorldConfig paperConfig; // Paper
|
||||
+ public final me.samsuik.sakura.configuration.SakuraWorldConfig sakuraConfig; // Sakura
|
||||
public final com.destroystokyo.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray
|
||||
|
||||
public final co.aikar.timings.WorldTimingsHandler timings; // Paper
|
||||
@@ -264,6 +265,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.concurrent.Executor executor) { // Paper - Async-Anti-Xray - Pass executor
|
||||
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
|
||||
this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName(), this.spigotConfig); // Paper
|
||||
+ this.sakuraConfig = new me.samsuik.sakura.configuration.SakuraWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Sakura
|
||||
this.generator = gen;
|
||||
this.world = new CraftWorld((ServerLevel) this, gen, biomeProvider, env);
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 3d07ef0cbd57d54d131cdc766dd55d210d67fb4c..62ee1aebdea1acb3c213d768f82f9131141343ad 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -956,6 +956,7 @@ public final class CraftServer implements Server {
|
||||
|
||||
org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot
|
||||
com.destroystokyo.paper.PaperConfig.init((File) console.options.valueOf("paper-settings")); // Paper
|
||||
+ me.samsuik.sakura.configuration.SakuraGlobalConfig.get().setup((File) console.options.valueOf("sakura-settings")); // Sakura
|
||||
for (ServerLevel world : this.console.getAllLevels()) {
|
||||
// world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty
|
||||
world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && config.spawnMonsters, config.spawnAnimals); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean))
|
||||
@@ -972,6 +973,7 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
world.spigotConfig.init(); // Spigot
|
||||
world.paperConfig.init(); // Paper
|
||||
+ world.sakuraConfig.init(); // Sakura
|
||||
}
|
||||
|
||||
Plugin[] pluginClone = pluginManager.getPlugins().clone(); // Paper
|
||||
@@ -987,6 +989,7 @@ public final class CraftServer implements Server {
|
||||
this.reloadData();
|
||||
org.spigotmc.SpigotConfig.registerCommands(); // Spigot
|
||||
com.destroystokyo.paper.PaperConfig.registerCommands(); // Paper
|
||||
+ me.samsuik.sakura.command.SakuraCommands.registerCommands(this.console); // Sakura
|
||||
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
|
||||
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
index fbe68bd4739d9a0e7d9bc4c3d5ba8ecfd2d13954..c779e4a4df4c954167a7445f2ac29da232e04f20 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -153,6 +153,14 @@ public class Main {
|
||||
.describedAs("Jar file");
|
||||
// Paper end
|
||||
|
||||
+ // Sakura start
|
||||
+ acceptsAll(asList("sakura", "sakura-settings"), "File for sakura settings")
|
||||
+ .withRequiredArg()
|
||||
+ .ofType(File.class)
|
||||
+ .defaultsTo(new File("sakura.yml"))
|
||||
+ .describedAs("Yml file");
|
||||
+ // Sakura end
|
||||
+
|
||||
// Paper start
|
||||
acceptsAll(asList("server-name"), "Name of the server")
|
||||
.withRequiredArg()
|
||||
@@ -155,13 +155,13 @@ index 0000000000000000000000000000000000000000..a3a09b8d58589883c7c465597bc64502
|
||||
+}
|
||||
diff --git a/src/main/java/me/samsuik/sakura/local/config/LocalValueConfig.java b/src/main/java/me/samsuik/sakura/local/config/LocalValueConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..529087b8b5158e96a66e1cafc19979cd4afc8cf3
|
||||
index 0000000000000000000000000000000000000000..d50f51e3486e498adf32013c46b34d0d26a68221
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/samsuik/sakura/local/config/LocalValueConfig.java
|
||||
@@ -0,0 +1,75 @@
|
||||
+package me.samsuik.sakura.local.config;
|
||||
+
|
||||
+import io.papermc.paper.configuration.WorldConfiguration.Misc.RedstoneImplementation;
|
||||
+import com.destroystokyo.paper.PaperWorldConfig;
|
||||
+import it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap;
|
||||
+import me.samsuik.sakura.explosion.durable.DurableMaterial;
|
||||
+import me.samsuik.sakura.local.LocalValueKey;
|
||||
@@ -179,7 +179,7 @@ index 0000000000000000000000000000000000000000..529087b8b5158e96a66e1cafc19979cd
|
||||
+ private final Expiry expiry;
|
||||
+ public Map<Block, DurableMaterial> durableMaterials;
|
||||
+ public PhysicsVersion physicsVersion;
|
||||
+ public RedstoneImplementation redstoneImplementation;
|
||||
+ public PaperWorldConfig.RedstoneImplementation redstoneImplementation;
|
||||
+ public boolean consistentRadius;
|
||||
+ public boolean redstoneCache;
|
||||
+ public int lavaFlowSpeed = -1;
|
||||
@@ -190,19 +190,19 @@ index 0000000000000000000000000000000000000000..529087b8b5158e96a66e1cafc19979cd
|
||||
+
|
||||
+ void init(Level level) {
|
||||
+ // default materials
|
||||
+ this.durableMaterials = new Reference2ObjectOpenHashMap<>(level.sakuraConfig().cannons.explosion.durableMaterials);
|
||||
+ this.durableMaterials = new Reference2ObjectOpenHashMap<>(level.sakuraConfig.durableMaterials);
|
||||
+
|
||||
+ // physics version
|
||||
+ this.physicsVersion = level.sakuraConfig().cannons.mechanics.physicsVersion;
|
||||
+ this.physicsVersion = level.sakuraConfig.physicsVersion;
|
||||
+
|
||||
+ // redstone implementation
|
||||
+ this.redstoneImplementation = level.paperConfig().misc.redstoneImplementation;
|
||||
+ this.redstoneImplementation = level.paperConfig.redstoneImplementation;
|
||||
+
|
||||
+ // consistent explosion radius
|
||||
+ this.consistentRadius = level.sakuraConfig().cannons.explosion.consistentRadius;
|
||||
+ this.consistentRadius = level.sakuraConfig.consistentRadius;
|
||||
+
|
||||
+ // redstone cache
|
||||
+ this.redstoneCache = level.sakuraConfig().technical.redstone.redstoneCache;
|
||||
+ //this.redstoneCache = level.sakuraConfig.redstoneCache;
|
||||
+ }
|
||||
+
|
||||
+ void load(LocalValueStorage storage) {
|
||||
@@ -216,14 +216,14 @@ index 0000000000000000000000000000000000000000..529087b8b5158e96a66e1cafc19979cd
|
||||
+
|
||||
+ // redstone implementation
|
||||
+ if (storage.exists(LocalValueKey.REDSTONE_IMPLEMENTATION)) {
|
||||
+ this.redstoneImplementation = RedstoneImplementation.values()[storage.value(LocalValueKey.REDSTONE_IMPLEMENTATION).ordinal()];
|
||||
+ this.redstoneImplementation = PaperWorldConfig.RedstoneImplementation.values()[storage.value(LocalValueKey.REDSTONE_IMPLEMENTATION).ordinal()];
|
||||
+ }
|
||||
+
|
||||
+ // consistent explosion radius
|
||||
+ this.consistentRadius = storage.getOrDefault(LocalValueKey.CONSISTENT_EXPLOSION_RADIUS, this.consistentRadius);
|
||||
+
|
||||
+ // redstone cache
|
||||
+ this.redstoneCache = storage.getOrDefault(LocalValueKey.REDSTONE_CACHE, this.redstoneCache);
|
||||
+ //this.redstoneCache = storage.getOrDefault(LocalValueKey.REDSTONE_CACHE, this.redstoneCache);
|
||||
+
|
||||
+ // lava flow speed
|
||||
+ this.lavaFlowSpeed = storage.getOrDefault(LocalValueKey.LAVA_FLOW_SPEED, this.lavaFlowSpeed);
|
||||
@@ -235,10 +235,10 @@ index 0000000000000000000000000000000000000000..529087b8b5158e96a66e1cafc19979cd
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 36ebba2b3cab5a7e92cceae1b295db10f5cd7c70..0e83e4e0fc1123dadca03dc0e3e1011640722c0a 100644
|
||||
index 9cbb478205af1b12da66d89872ac6d3ef2d43e05..80538dd6b0a02e1f5e9ac2e6942eeb453d6f39b2 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1562,6 +1562,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1615,6 +1615,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.profiler.pop();
|
||||
this.profiler.pop();
|
||||
worldserver.explosionDensityCache.clear(); // Paper - Optimize explosions
|
||||
@@ -247,13 +247,13 @@ index 36ebba2b3cab5a7e92cceae1b295db10f5cd7c70..0e83e4e0fc1123dadca03dc0e3e10116
|
||||
this.isIteratingOverLevels = false; // Paper
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index fa3ed1b2292abafa9f7cc79bc20f7c7beba02224..7c22957714c182579885a1a6197c09ce84755593 100644
|
||||
index db7335a079cf711a829b2e4fb7354717da2f8789..6a777b6de479e11f112a01afbbc3226ce1dcd10c 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -177,6 +177,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
return this.sakuraConfig;
|
||||
@@ -259,6 +259,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
return this.getNearestPlayer(null, d0, d1, d2, d3, predicate);
|
||||
}
|
||||
// Sakura end
|
||||
// Paper end - optimise checkDespawn
|
||||
+ // Sakura start
|
||||
+ private final me.samsuik.sakura.local.config.LocalConfigManager localConfig = new me.samsuik.sakura.local.config.LocalConfigManager(this);
|
||||
+ public final me.samsuik.sakura.local.config.LocalConfigManager localConfig() {
|
||||
@@ -261,13 +261,13 @@ index fa3ed1b2292abafa9f7cc79bc20f7c7beba02224..7c22957714c182579885a1a6197c09ce
|
||||
+ }
|
||||
+ // Sakura end
|
||||
|
||||
public final com.destroystokyo.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray
|
||||
public final co.aikar.timings.WorldTimingsHandler timings; // Paper
|
||||
public abstract ResourceKey<LevelStem> getTypeKey();
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index c91bac6f3f1d60c950b93d157531cd8f7500e8d8..e4d38a83905a8ae8afd3c376429d383fbd84e9ee 100644
|
||||
index 43244a479a112786539a905a22cb12e3cf55b2dd..14ece3838a62a8330b975f75a5d0e2df8ace7f11 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -226,6 +226,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -223,6 +223,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
}
|
||||
// Paper end
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,12 +5,12 @@ Subject: [PATCH] Visibility API and Command
|
||||
|
||||
|
||||
diff --git a/src/main/java/me/samsuik/sakura/command/SakuraCommands.java b/src/main/java/me/samsuik/sakura/command/SakuraCommands.java
|
||||
index 3b08454cf7411d12bb33225df59800bd73312123..22676ec7a7ae9494b198e5e65e6be6d32e0feb85 100644
|
||||
index cd44b3400a1ab9544aa4a9e50b1054ea436a3643..a5020f97cfeefe5eaadc22321d89518ed3aa4b37 100644
|
||||
--- a/src/main/java/me/samsuik/sakura/command/SakuraCommands.java
|
||||
+++ b/src/main/java/me/samsuik/sakura/command/SakuraCommands.java
|
||||
@@ -2,6 +2,9 @@ package me.samsuik.sakura.command;
|
||||
@@ -1,6 +1,9 @@
|
||||
package me.samsuik.sakura.command;
|
||||
|
||||
import io.papermc.paper.command.PaperPluginsCommand;
|
||||
import me.samsuik.sakura.command.subcommands.ConfigCommand;
|
||||
+import me.samsuik.sakura.command.subcommands.FPSCommand;
|
||||
+import me.samsuik.sakura.command.subcommands.VisualCommand;
|
||||
@@ -18,7 +18,7 @@ index 3b08454cf7411d12bb33225df59800bd73312123..22676ec7a7ae9494b198e5e65e6be6d3
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import org.bukkit.command.Command;
|
||||
|
||||
@@ -14,6 +17,10 @@ public final class SakuraCommands {
|
||||
@@ -12,6 +15,10 @@ public final class SakuraCommands {
|
||||
static {
|
||||
COMMANDS.put("sakura", new SakuraCommand("sakura"));
|
||||
COMMANDS.put("config", new ConfigCommand("config"));
|
||||
@@ -63,14 +63,14 @@ index 0000000000000000000000000000000000000000..aa5ddf696b09226a0bd3d967d2ac2b11
|
||||
+}
|
||||
diff --git a/src/main/java/me/samsuik/sakura/command/subcommands/VisualCommand.java b/src/main/java/me/samsuik/sakura/command/subcommands/VisualCommand.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..148a583279333eeb3e5db16652623082cd5e0e60
|
||||
index 0000000000000000000000000000000000000000..6e1ec244731012cf0b75d9ee81de036a77cf46ca
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/samsuik/sakura/command/subcommands/VisualCommand.java
|
||||
@@ -0,0 +1,45 @@
|
||||
+package me.samsuik.sakura.command.subcommands;
|
||||
+
|
||||
+import me.samsuik.sakura.command.BaseSubCommand;
|
||||
+import me.samsuik.sakura.configuration.GlobalConfiguration;
|
||||
+import me.samsuik.sakura.configuration.SakuraGlobalConfig;
|
||||
+import me.samsuik.sakura.player.visibility.Visibility;
|
||||
+import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
+import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||
@@ -105,7 +105,7 @@ index 0000000000000000000000000000000000000000..148a583279333eeb3e5db16652623082
|
||||
+
|
||||
+ // Send message to player
|
||||
+ var state = visibility.isEnabled(type) ? "Enabled" : "Disabled";
|
||||
+ player.sendMessage(MiniMessage.miniMessage().deserialize(GlobalConfiguration.get().fps.message,
|
||||
+ player.sendMessage(MiniMessage.miniMessage().deserialize(SakuraGlobalConfig.get().fpsMessage,
|
||||
+ Placeholder.unparsed("name", type.friendlyName()),
|
||||
+ Placeholder.unparsed("state", state))
|
||||
+ );
|
||||
@@ -114,13 +114,13 @@ index 0000000000000000000000000000000000000000..148a583279333eeb3e5db16652623082
|
||||
+}
|
||||
diff --git a/src/main/java/me/samsuik/sakura/player/visibility/VisibilityGUI.java b/src/main/java/me/samsuik/sakura/player/visibility/VisibilityGUI.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0380753ce7d65a98b9d008f13bc9bc7908c6dc8a
|
||||
index 0000000000000000000000000000000000000000..d2bdd2693dd64add54369990a4c05f122c04e394
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/samsuik/sakura/player/visibility/VisibilityGUI.java
|
||||
@@ -0,0 +1,124 @@
|
||||
+package me.samsuik.sakura.player.visibility;
|
||||
+
|
||||
+import me.samsuik.sakura.configuration.GlobalConfiguration;
|
||||
+import me.samsuik.sakura.configuration.SakuraGlobalConfig;
|
||||
+import me.samsuik.sakura.player.gui.ItemIcon;
|
||||
+import me.samsuik.sakura.player.gui.PlayerGUI;
|
||||
+import net.kyori.adventure.text.Component;
|
||||
@@ -147,7 +147,7 @@ index 0000000000000000000000000000000000000000..0380753ce7d65a98b9d008f13bc9bc79
|
||||
+ int row = (i + 1) / 9;
|
||||
+
|
||||
+ Material background = column > 0 && column < 8 ? (row > 0 && row < 4 || column > 1 && column < 7)
|
||||
+ ? Material.matchMaterial(GlobalConfiguration.get().fps.material)
|
||||
+ ? Material.matchMaterial(SakuraGlobalConfig.get().fpsMaterial)
|
||||
+ : Material.WHITE_STAINED_GLASS_PANE
|
||||
+ : Material.BLACK_STAINED_GLASS_PANE;
|
||||
+
|
||||
@@ -231,7 +231,7 @@ index 0000000000000000000000000000000000000000..0380753ce7d65a98b9d008f13bc9bc79
|
||||
+ String state = visibility.isEnabled(setting) ? "Enabled" : "Disabled";
|
||||
+
|
||||
+ // Send message to player
|
||||
+ player.sendMessage(MiniMessage.miniMessage().deserialize(GlobalConfiguration.get().fps.message,
|
||||
+ player.sendMessage(MiniMessage.miniMessage().deserialize(SakuraGlobalConfig.get().fpsMessage,
|
||||
+ Placeholder.unparsed("name", setting.friendlyName()),
|
||||
+ Placeholder.unparsed("state", state)
|
||||
+ ));
|
||||
@@ -243,7 +243,7 @@ index 0000000000000000000000000000000000000000..0380753ce7d65a98b9d008f13bc9bc79
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSectionBlocksUpdatePacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSectionBlocksUpdatePacket.java
|
||||
index 24c677e80af652952263253409c050641e72e3b5..62b08f8216abc1bc82bc5457e74811c823e900e0 100644
|
||||
index 652bea6868a03a5315965f79c76172fb9dbb93fb..7bdec48862e3a3e20b824f1384d5a80aefa933f7 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSectionBlocksUpdatePacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSectionBlocksUpdatePacket.java
|
||||
@@ -16,7 +16,7 @@ public class ClientboundSectionBlocksUpdatePacket implements Packet<ClientGamePa
|
||||
@@ -256,10 +256,10 @@ index 24c677e80af652952263253409c050641e72e3b5..62b08f8216abc1bc82bc5457e74811c8
|
||||
|
||||
public ClientboundSectionBlocksUpdatePacket(SectionPos sectionPos, ShortSet positions, LevelChunkSection section, boolean noLightingUpdates) {
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 0e83e4e0fc1123dadca03dc0e3e1011640722c0a..0fa8b271c58c74820461f7bec213062b266ec18b 100644
|
||||
index 80538dd6b0a02e1f5e9ac2e6942eeb453d6f39b2..6c65c3235271d181ef5efc1263fe2161f1e6a157 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1563,6 +1563,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1616,6 +1616,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.profiler.pop();
|
||||
worldserver.explosionDensityCache.clear(); // Paper - Optimize explosions
|
||||
worldserver.localConfig().expire(currentTickLong); // Sakura
|
||||
@@ -268,10 +268,10 @@ index 0e83e4e0fc1123dadca03dc0e3e1011640722c0a..0fa8b271c58c74820461f7bec213062b
|
||||
this.isIteratingOverLevels = false; // Paper
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index 2212f9f48636357265d8e44aba415ea4f09f1fe7..500d0b297de5234b4c622d407d511b161acc2233 100644
|
||||
index 6ce27675103d4b691216c6b701b6ceb821af528f..1dc2bc400afe5012fe03ea3799c100ed453d1148 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -1604,6 +1604,22 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -2335,6 +2335,22 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
double d2 = d0 * d0;
|
||||
boolean flag = d1 <= d2 && this.entity.broadcastToPlayer(player);
|
||||
|
||||
@@ -295,10 +295,10 @@ index 2212f9f48636357265d8e44aba415ea4f09f1fe7..500d0b297de5234b4c622d407d511b16
|
||||
if (!player.getBukkitEntity().canSee(this.entity.getBukkitEntity())) {
|
||||
flag = false;
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 037fe86f11f0245c265393b3a0eaee13dbabd835..c4f4d06a10b24e9def2458ce1297da5f830c84c9 100644
|
||||
index 98209532ad3e692d7e459640123f78bbd9a65889..ffa6c8ec5a23f25f58ba88300196b9f19a0bbf22 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -1748,7 +1748,16 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -1653,7 +1653,16 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
ServerPlayer entityplayer = (ServerPlayer) iterator.next();
|
||||
|
||||
if (entityplayer.distanceToSqr(x, y, z) < 4096.0D) {
|
||||
@@ -317,10 +317,10 @@ index 037fe86f11f0245c265393b3a0eaee13dbabd835..c4f4d06a10b24e9def2458ce1297da5f
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 289429eb464548acc80262a49444f49f8f57fc0c..5f38f9a7aca3af47dc3454035a7faf1d30d05932 100644
|
||||
index a6edf5117d4ae03d8294e7bb74dd2d77048895a5..8aea11619f256bcfd91cf9af968bee4daf0f3381 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -247,6 +247,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -235,6 +235,7 @@ public class ServerPlayer extends Player {
|
||||
public final int[] mobCounts = new int[MOBCATEGORY_TOTAL_ENUMS]; // Paper
|
||||
public final com.destroystokyo.paper.util.PooledHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleMobDistanceMap;
|
||||
// Paper end
|
||||
@@ -328,8 +328,8 @@ index 289429eb464548acc80262a49444f49f8f57fc0c..5f38f9a7aca3af47dc3454035a7faf1d
|
||||
|
||||
// CraftBukkit start
|
||||
public String displayName;
|
||||
@@ -505,6 +506,15 @@ public class ServerPlayer extends Player {
|
||||
this.respawnDimension = (ResourceKey) dataresult1.resultOrPartial(logger1::error).orElse(Level.OVERWORLD);
|
||||
@@ -426,6 +427,15 @@ public class ServerPlayer extends Player {
|
||||
this.setPos(this.getX(), this.getY() + 1.0D, this.getZ());
|
||||
}
|
||||
}
|
||||
+ // Sakura start - visibility api
|
||||
@@ -344,7 +344,7 @@ index 289429eb464548acc80262a49444f49f8f57fc0c..5f38f9a7aca3af47dc3454035a7faf1d
|
||||
|
||||
}
|
||||
|
||||
@@ -571,6 +581,13 @@ public class ServerPlayer extends Player {
|
||||
@@ -532,6 +542,13 @@ public class ServerPlayer extends Player {
|
||||
});
|
||||
}
|
||||
this.getBukkitEntity().setExtraData(nbt); // CraftBukkit
|
||||
@@ -359,10 +359,10 @@ index 289429eb464548acc80262a49444f49f8f57fc0c..5f38f9a7aca3af47dc3454035a7faf1d
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index bac6b62419d85b3772ef243aa3d5f73311abdda7..60fc19f25245f491c31018ec7cb065ced3516c44 100644
|
||||
index 3faf67d100e49836eb9b408e88c296e615ca33f8..f451ed92f75a6f5553790ca97cabbcdfd0d3d169 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -3162,6 +3162,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@@ -2858,6 +2858,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
|
||||
event.setCancelled(cancelled);
|
||||
AbstractContainerMenu oldContainer = this.player.containerMenu; // SPIGOT-1224
|
||||
@@ -371,10 +371,10 @@ index bac6b62419d85b3772ef243aa3d5f73311abdda7..60fc19f25245f491c31018ec7cb065ce
|
||||
if (this.player.containerMenu != oldContainer) {
|
||||
return;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 1eaab1f6923e6aa34b643293347348e5cc19af3c..0636aab71c93413ee40d842daae1b4232f7b2b9d 100644
|
||||
index dfd1f37757af1bd808cc2e2d8bf97123adf638bb..65e53582f3d2b49e795f0f98325ddf8063f5f752 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -541,6 +541,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -428,6 +428,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
this.teleportTo(worldserver, null);
|
||||
}
|
||||
// Paper end - make end portalling safe
|
||||
@@ -383,13 +383,13 @@ index 1eaab1f6923e6aa34b643293347348e5cc19af3c..0636aab71c93413ee40d842daae1b423
|
||||
+ public boolean isFallingBlock;
|
||||
+ // Sakura end - visibility api and command
|
||||
|
||||
public Entity(EntityType<?> type, Level world) {
|
||||
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
|
||||
// Paper start
|
||||
/**
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
index eacb8a407fe99af2c13f23c12b5544696bda8890..d693fb7fd81f046615ad062153c1a2599948d391 100644
|
||||
index 318ea6ebf4c13a984b3815f00bf6cb3856ff6fe0..cd587ad749699e14351e75be82363759b7ce4235 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
@@ -70,6 +70,7 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -68,6 +68,7 @@ public class FallingBlockEntity extends Entity {
|
||||
this.blockState = Blocks.SAND.defaultBlockState();
|
||||
this.dropItem = true;
|
||||
this.fallDamageMax = 40;
|
||||
@@ -398,10 +398,10 @@ index eacb8a407fe99af2c13f23c12b5544696bda8890..d693fb7fd81f046615ad062153c1a259
|
||||
|
||||
public FallingBlockEntity(Level world, double x, double y, double z, BlockState block) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
index bedee2c93bd0aff148f93dcf111e0fc3d9bce4a0..e2d016561d68901d86819bd830d516cad2a3bedd 100644
|
||||
index 445d9d1ec6f02f32d819d8555ceddb8e1ada7acd..29830c07e61aaf74bfd876f2624c0fea859ddf4f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
@@ -27,6 +27,7 @@ public class PrimedTnt extends Entity {
|
||||
@@ -30,6 +30,7 @@ public class PrimedTnt extends Entity {
|
||||
public PrimedTnt(EntityType<? extends PrimedTnt> type, Level world) {
|
||||
super(type, world);
|
||||
this.blocksBuilding = true;
|
||||
@@ -410,23 +410,22 @@ index bedee2c93bd0aff148f93dcf111e0fc3d9bce4a0..e2d016561d68901d86819bd830d516ca
|
||||
|
||||
public PrimedTnt(Level world, double x, double y, double z, @Nullable LivingEntity igniter) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 7c22957714c182579885a1a6197c09ce84755593..00ebe6b2e3068a3b9c1c4a7566685191f21ed379 100644
|
||||
index 6a777b6de479e11f112a01afbbc3226ce1dcd10c..9c28594590c57ced725f3e0c6fdb9c6a5ab9bfa2 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -282,6 +282,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -265,6 +265,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
return this.localConfig;
|
||||
}
|
||||
// Sakura end
|
||||
+ public final it.unimi.dsi.fastutil.longs.Long2IntMap minimalTNT = new it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap(); // Sakura - visibility api
|
||||
|
||||
public abstract ResourceKey<LevelStem> getTypeKey();
|
||||
|
||||
+ public final it.unimi.dsi.fastutil.longs.Long2IntMap minimalTNT = new it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap(); // Sakura - visibility api
|
||||
+
|
||||
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, Supplier<me.samsuik.sakura.configuration.WorldConfiguration> sakuraWorldConfigCreator, java.util.concurrent.Executor executor) { // Sakura // Paper - Async-Anti-Xray - Pass executor
|
||||
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
|
||||
this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index c546a465a2f85e1b0e785074af15546637619e8f..aaa3b2aa8e8791d88e2fb08342ec8c133cd219d6 100644
|
||||
index ce78e024244c14530270b8276e5b0fd853f0a110..f16ba5860484de0e211d954436d2e5106a651808 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -494,6 +494,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -415,6 +415,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
this.getHandle().displayName = name == null ? getName() : name;
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Reduce deltaMovement Allocations
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 0636aab71c93413ee40d842daae1b4232f7b2b9d..3b6efce07745df062d5d3ef60011718842217336 100644
|
||||
index 65e53582f3d2b49e795f0f98325ddf8063f5f752..078ec45f7e0b51f6b78f71d909d43b8966fc1b0a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -1166,7 +1166,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -1100,7 +1100,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
this.tryCheckInsideBlocks();
|
||||
float f2 = this.getBlockSpeedFactor();
|
||||
|
||||
@@ -17,7 +17,7 @@ index 0636aab71c93413ee40d842daae1b4232f7b2b9d..3b6efce07745df062d5d3ef600117188
|
||||
// Paper start - remove expensive streams from here
|
||||
boolean noneMatch = true;
|
||||
AABB fireSearchBox = this.getBoundingBox().deflate(1.0E-6D);
|
||||
@@ -1895,6 +1895,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -1781,6 +1781,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
public void moveTo(double x, double y, double z, float yaw, float pitch) {
|
||||
// Paper - cancel entity velocity if teleported
|
||||
if (!preserveMotion) {
|
||||
@@ -25,7 +25,7 @@ index 0636aab71c93413ee40d842daae1b4232f7b2b9d..3b6efce07745df062d5d3ef600117188
|
||||
this.deltaMovement = Vec3.ZERO;
|
||||
} else {
|
||||
this.preserveMotion = false;
|
||||
@@ -3199,29 +3200,33 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -3053,29 +3054,33 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
}
|
||||
|
||||
public void onAboveBubbleCol(boolean drag) {
|
||||
@@ -67,7 +67,7 @@ index 0636aab71c93413ee40d842daae1b4232f7b2b9d..3b6efce07745df062d5d3ef600117188
|
||||
this.resetFallDistance();
|
||||
}
|
||||
|
||||
@@ -4155,16 +4160,19 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -3950,16 +3955,19 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
vec3d = vec3d.normalize();
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ index 0636aab71c93413ee40d842daae1b4232f7b2b9d..3b6efce07745df062d5d3ef600117188
|
||||
}
|
||||
|
||||
this.fluidHeight.put(tag, d1);
|
||||
@@ -4231,11 +4239,53 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -4024,18 +4032,64 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
return this.chunkPosition;
|
||||
}
|
||||
|
||||
@@ -144,7 +144,6 @@ index 0636aab71c93413ee40d842daae1b4232f7b2b9d..3b6efce07745df062d5d3ef600117188
|
||||
synchronized (this.posLock) { // Paper
|
||||
this.deltaMovement = velocity;
|
||||
} // Paper
|
||||
@@ -4246,7 +4296,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
}
|
||||
|
||||
public void setDeltaMovement(double x, double y, double z) {
|
||||
@@ -158,10 +157,10 @@ index 0636aab71c93413ee40d842daae1b4232f7b2b9d..3b6efce07745df062d5d3ef600117188
|
||||
|
||||
public final int getBlockX() {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
index d693fb7fd81f046615ad062153c1a2599948d391..1a83f88e7759b168d6f3c2f6ed4532d65a7cf437 100644
|
||||
index cd587ad749699e14351e75be82363759b7ce4235..597efc61bdd46b951b62c2584a846942508983cf 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
@@ -142,7 +142,7 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -140,7 +140,7 @@ public class FallingBlockEntity extends Entity {
|
||||
|
||||
++this.time;
|
||||
if (!this.isNoGravity()) {
|
||||
@@ -170,7 +169,7 @@ index d693fb7fd81f046615ad062153c1a2599948d391..1a83f88e7759b168d6f3c2f6ed4532d6
|
||||
}
|
||||
|
||||
this.move(MoverType.SELF, this.getDeltaMovement());
|
||||
@@ -189,7 +189,7 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -187,7 +187,7 @@ public class FallingBlockEntity extends Entity {
|
||||
} else {
|
||||
BlockState iblockdata = this.level.getBlockState(blockposition);
|
||||
|
||||
@@ -179,7 +178,7 @@ index d693fb7fd81f046615ad062153c1a2599948d391..1a83f88e7759b168d6f3c2f6ed4532d6
|
||||
if (!iblockdata.is(Blocks.MOVING_PISTON)) {
|
||||
if (!this.cancelDrop) {
|
||||
boolean flag2 = iblockdata.canBeReplaced((BlockPlaceContext) (new DirectionalPlaceContext(this.level, blockposition, Direction.DOWN, ItemStack.EMPTY, Direction.UP)));
|
||||
@@ -256,7 +256,7 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -254,7 +254,7 @@ public class FallingBlockEntity extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,10 +188,10 @@ index d693fb7fd81f046615ad062153c1a2599948d391..1a83f88e7759b168d6f3c2f6ed4532d6
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
index e2d016561d68901d86819bd830d516cad2a3bedd..80e495688b00d1297357350f9abebe5fbbf24cd8 100644
|
||||
index 29830c07e61aaf74bfd876f2624c0fea859ddf4f..f997647a7ff29100acd5bab1d77ac3a6305e4717 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
@@ -62,7 +62,7 @@ public class PrimedTnt extends Entity {
|
||||
@@ -65,7 +65,7 @@ public class PrimedTnt extends Entity {
|
||||
public void tick() {
|
||||
if (level.spigotConfig.maxTntTicksPerTick > 0 && ++level.spigotConfig.currentPrimedTnt > level.spigotConfig.maxTntTicksPerTick) { return; } // Spigot
|
||||
if (!this.isNoGravity()) {
|
||||
@@ -201,7 +200,7 @@ index e2d016561d68901d86819bd830d516cad2a3bedd..80e495688b00d1297357350f9abebe5f
|
||||
}
|
||||
|
||||
this.move(MoverType.SELF, this.getDeltaMovement());
|
||||
@@ -72,9 +72,9 @@ public class PrimedTnt extends Entity {
|
||||
@@ -75,9 +75,9 @@ public class PrimedTnt extends Entity {
|
||||
return;
|
||||
}
|
||||
// Paper end
|
||||
@@ -214,11 +213,11 @@ index e2d016561d68901d86819bd830d516cad2a3bedd..80e495688b00d1297357350f9abebe5f
|
||||
|
||||
int i = this.getFuse() - 1;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index 5ef6b5ad4dd69a57595914c7af8422ee2f6ad054..e60410d2d1a09f935caffe0cfb9b6232c00b1c8c 100644
|
||||
index 29f6c10e2c2626a9726d295acf12efea2b463cd3..22ceea2deb22bc8bd082a5ad94de9a9ca02a4ec7 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -273,7 +273,7 @@ public class Explosion {
|
||||
d14 = entity instanceof Player && level.paperConfig().environment.disableExplosionKnockback ? 0 : ProtectionEnchantment.getExplosionKnockbackAfterDampener((LivingEntity) entity, d13); // Paper - Disable explosion knockback
|
||||
@@ -277,7 +277,7 @@ public class Explosion {
|
||||
d14 = entity instanceof Player && level.paperConfig.disableExplosionKnockback ? 0 : ProtectionEnchantment.getExplosionKnockbackAfterDampener((LivingEntity) entity, d13); // Paper - Disable explosion knockback
|
||||
}
|
||||
|
||||
- entity.setDeltaMovement(entity.getDeltaMovement().add(d8 * d14, d9 * d14, d10 * d14));
|
||||
@@ -227,7 +226,7 @@ index 5ef6b5ad4dd69a57595914c7af8422ee2f6ad054..e60410d2d1a09f935caffe0cfb9b6232
|
||||
Player entityhuman = (Player) entity;
|
||||
|
||||
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 7b71073027f4cf79736546500ededdfbb83d968e..90e4d105754a1c8fba4e9b63e1c4f6096da3eabd 100644
|
||||
index a80f4dc0a642c744223a155232291ace6e007636..db023572478d44398ea0454f3c01eca382752b43 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
@@ -461,7 +461,7 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Optional Force Position Updates
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
index 80e495688b00d1297357350f9abebe5fbbf24cd8..7d2a2d69241344593b691321ba859e5ba246d15d 100644
|
||||
index f997647a7ff29100acd5bab1d77ac3a6305e4717..2e618e8d930f95ef74497097f1ab205e712b2f58 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
@@ -60,7 +60,9 @@ public class PrimedTnt extends Entity {
|
||||
@@ -63,7 +63,9 @@ public class PrimedTnt extends Entity {
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
@@ -19,12 +19,12 @@ index 80e495688b00d1297357350f9abebe5fbbf24cd8..7d2a2d69241344593b691321ba859e5b
|
||||
if (!this.isNoGravity()) {
|
||||
this.addDeltaMovement(0.0D, -0.04D, 0.0D); // Sakura - reduce movement allocations
|
||||
}
|
||||
@@ -95,6 +97,14 @@ public class PrimedTnt extends Entity {
|
||||
@@ -98,6 +100,14 @@ public class PrimedTnt extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Sakura start - configure force position updates
|
||||
+ if (this.level.sakuraConfig().cannons.tnt.forcePositionUpdates) {
|
||||
+ if (this.level.sakuraConfig.forcePositionUpdates) {
|
||||
+ this.forcePositionUpdate();
|
||||
+ }
|
||||
+ }
|
||||
@@ -32,5 +32,5 @@ index 80e495688b00d1297357350f9abebe5fbbf24cd8..7d2a2d69241344593b691321ba859e5b
|
||||
+ private void forcePositionUpdate() {
|
||||
+ // Sakura end - configure force position updates
|
||||
// Paper start - Optional prevent TNT from moving in water
|
||||
if (!this.isRemoved() && this.wasTouchingWater && this.level.paperConfig().fixes.preventTntFromMovingInWater) {
|
||||
if (!this.isRemoved() && this.wasTouchingWater && this.level.paperConfig.preventTntFromMovingInWater) {
|
||||
/*
|
||||
@@ -75,46 +75,46 @@ index a87f6380b2c387fb0cdd40d5087b5c93492e3c88..4db0a1b1270e2ff1ea1a4723b3dd2886
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/TicketType.java b/src/main/java/net/minecraft/server/level/TicketType.java
|
||||
index 97d1ff2af23bac14e67bca5896843325aaa5bfc1..c90b265a9cd92d40960d5513d9585e47d93fed3c 100644
|
||||
index ae46429264e6a7e5c88b6b6a41a6df4db7b3e70d..1686abebbf0c99cd589f70c2f5259728f34f4f2a 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/TicketType.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/TicketType.java
|
||||
@@ -35,6 +35,7 @@ public class TicketType<T> {
|
||||
public static final TicketType<Long> POI_LOAD = create("poi_load", Long::compareTo);
|
||||
public static final TicketType<Unit> UNLOAD_COOLDOWN = create("unload_cooldown", (u1, u2) -> 0, 5 * 20);
|
||||
// Paper end - rewrite chunk system
|
||||
@@ -33,6 +33,7 @@ public class TicketType<T> {
|
||||
public static final TicketType<Long> DELAY_UNLOAD = create("delay_unload", Long::compareTo, 300); // Paper
|
||||
public static final TicketType<Long> REQUIRED_LOAD = create("required_load", Long::compareTo); // Paper - make sure getChunkAt does not fail
|
||||
public static final TicketType<Long> CHUNK_RELIGHT = create("light_update", Long::compareTo); // Paper - ensure chunks stay loaded for lighting
|
||||
+ public static final TicketType<Long> ENTITY_MOVEMENT = create("entity_movement", Long::compareTo, 10 * 20); // Sakura
|
||||
|
||||
public static <T> TicketType<T> create(String name, Comparator<T> argumentComparator) {
|
||||
return new TicketType<>(name, argumentComparator, 0L);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 3b6efce07745df062d5d3ef60011718842217336..0025d08527f41c0d19f4a713ef072fae008cec25 100644
|
||||
index 078ec45f7e0b51f6b78f71d909d43b8966fc1b0a..67963fc50e1039192468a418335ba2bb581174cd 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -545,6 +545,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -432,6 +432,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
public boolean isPrimedTNT;
|
||||
public boolean isFallingBlock;
|
||||
// Sakura end - visibility api and command
|
||||
+ public boolean loadChunks = false; // Sakura - load chunks on cannon entity movement
|
||||
|
||||
public Entity(EntityType<?> type, Level world) {
|
||||
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
|
||||
@@ -1393,8 +1394,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
// Paper start
|
||||
/**
|
||||
@@ -1309,8 +1310,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
}
|
||||
}
|
||||
|
||||
- io.papermc.paper.util.CollisionUtil.getCollisions(world, this, collisionBox, potentialCollisions, false, this.level.paperConfig().chunks.preventMovingIntoUnloadedChunks,
|
||||
- io.papermc.paper.util.CollisionUtil.getCollisions(world, this, collisionBox, potentialCollisions, false, true,
|
||||
- false, false, null, null);
|
||||
+ io.papermc.paper.util.CollisionUtil.getCollisions(world, this, collisionBox, potentialCollisions, this.loadChunks, this.level.paperConfig().chunks.preventMovingIntoUnloadedChunks, // Sakura - load chunks on movement
|
||||
+ io.papermc.paper.util.CollisionUtil.getCollisions(world, this, collisionBox, potentialCollisions, this.loadChunks, !this.loadChunks, // Sakura - load chunks on movement
|
||||
+ false, this.loadChunks, false, null, null); // Sakura - load chunks on movement
|
||||
|
||||
if (collidingWithWorldBorder = io.papermc.paper.util.CollisionUtil.isCollidingWithBorderEdge(world.getWorldBorder(), collisionBox)) { // Paper - this line *is* correct, ignore the IDE warning about assignments being used as a condition
|
||||
if (io.papermc.paper.util.CollisionUtil.isCollidingWithBorderEdge(world.getWorldBorder(), collisionBox)) {
|
||||
io.papermc.paper.util.CollisionUtil.addBoxesToIfIntersects(world.getWorldBorder().getCollisionShape(), collisionBox, potentialCollisions);
|
||||
@@ -4532,12 +4533,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -4309,12 +4310,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
|
||||
@Override
|
||||
public boolean shouldBeSaved() {
|
||||
- return this.removalReason != null && !this.removalReason.shouldSave() ? false : (this.isPassenger() ? false : !this.isVehicle() || !this.hasAnyPlayerPassengers()); // Paper - rewrite chunk system - it should check if the entity has ANY player passengers
|
||||
+ return this.removalReason != null && !this.removalReason.shouldSave() ? false : (this.loadChunks || this.isPassenger() ? false : !this.isVehicle() || !this.hasAnyPlayerPassengers()); // Sakura - used to determine whether a chunk should unload // Paper - rewrite chunk system - it should check if the entity has ANY player passengers
|
||||
- return this.removalReason != null && !this.removalReason.shouldSave() ? false : (this.isPassenger() ? false : !this.isVehicle() || !this.hasExactlyOnePlayerPassenger());
|
||||
+ return this.removalReason != null && !this.removalReason.shouldSave() ? false : (this.loadChunks || this.isPassenger() ? false : !this.isVehicle() || !this.hasExactlyOnePlayerPassenger()); // Sakura - used to determine whether a chunk should unload
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -125,34 +125,34 @@ index 3b6efce07745df062d5d3ef60011718842217336..0025d08527f41c0d19f4a713ef072fae
|
||||
|
||||
public boolean mayInteract(Level world, BlockPos pos) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
index 1a83f88e7759b168d6f3c2f6ed4532d65a7cf437..3559457024f5c9bef4c44a27514e338c7d2b4172 100644
|
||||
index 597efc61bdd46b951b62c2584a846942508983cf..e4a7d8decdd86b1cdd645ec36bee48792ef3a944 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
@@ -71,6 +71,7 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -69,6 +69,7 @@ public class FallingBlockEntity extends Entity {
|
||||
this.dropItem = true;
|
||||
this.fallDamageMax = 40;
|
||||
this.isFallingBlock = true; // Sakura
|
||||
+ this.loadChunks = world.sakuraConfig().cannons.loadChunks; // Sakura - falling blocks load chunks
|
||||
+ this.loadChunks = world.sakuraConfig.loadChunks; // Sakura - falling blocks load chunks
|
||||
}
|
||||
|
||||
public FallingBlockEntity(Level world, double x, double y, double z, BlockState block) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
index 7d2a2d69241344593b691321ba859e5ba246d15d..5761b786f036df1516189edd67ea4439d64c6ea8 100644
|
||||
index 2e618e8d930f95ef74497097f1ab205e712b2f58..5cbda5c5d7f1a110548110959dfe1edddcc67def 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
@@ -28,6 +28,7 @@ public class PrimedTnt extends Entity {
|
||||
@@ -31,6 +31,7 @@ public class PrimedTnt extends Entity {
|
||||
super(type, world);
|
||||
this.blocksBuilding = true;
|
||||
this.isPrimedTNT = true; // Sakura
|
||||
+ this.loadChunks = world.sakuraConfig().cannons.loadChunks; // Sakura - tnt load chunks
|
||||
+ this.loadChunks = world.sakuraConfig.loadChunks; // Sakura - tnt load chunks
|
||||
}
|
||||
|
||||
public PrimedTnt(Level world, double x, double y, double z, @Nullable LivingEntity igniter) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
index 28e4b302284f955a73e75d0f4276d55fb51826f5..2bb7195bdb977de6b899cade0847cd6414f3eae2 100644
|
||||
index f667dafd44b6652788d3367cbbc76eef3bead23b..8a48d3234aa8819cdeeb85df1a37c72e341ca2ac 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
@@ -361,6 +361,17 @@ public class LevelChunk extends ChunkAccess {
|
||||
@@ -368,6 +368,17 @@ public class LevelChunk extends ChunkAccess {
|
||||
}
|
||||
}
|
||||
// Paper end - optimise checkDespawn
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] TPS Graph Command
|
||||
|
||||
|
||||
diff --git a/src/main/java/me/samsuik/sakura/command/SakuraCommands.java b/src/main/java/me/samsuik/sakura/command/SakuraCommands.java
|
||||
index 22676ec7a7ae9494b198e5e65e6be6d32e0feb85..6edc5195c3b496a12b17b2b9b528505d37ffdb12 100644
|
||||
index a5020f97cfeefe5eaadc22321d89518ed3aa4b37..80e31b13509bc13d4e52a01e6d72ee6d9b28cdc9 100644
|
||||
--- a/src/main/java/me/samsuik/sakura/command/SakuraCommands.java
|
||||
+++ b/src/main/java/me/samsuik/sakura/command/SakuraCommands.java
|
||||
@@ -4,6 +4,7 @@ import io.papermc.paper.command.PaperPluginsCommand;
|
||||
@@ -3,6 +3,7 @@ package me.samsuik.sakura.command;
|
||||
import me.samsuik.sakura.command.subcommands.ConfigCommand;
|
||||
import me.samsuik.sakura.command.subcommands.FPSCommand;
|
||||
import me.samsuik.sakura.command.subcommands.VisualCommand;
|
||||
@@ -16,7 +16,7 @@ index 22676ec7a7ae9494b198e5e65e6be6d32e0feb85..6edc5195c3b496a12b17b2b9b528505d
|
||||
import me.samsuik.sakura.player.visibility.Visibility;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import org.bukkit.command.Command;
|
||||
@@ -21,6 +22,7 @@ public final class SakuraCommands {
|
||||
@@ -19,6 +20,7 @@ public final class SakuraCommands {
|
||||
COMMANDS.put("tntvisibility", new VisualCommand(Visibility.Setting.TNT_VISIBILITY, "tnttoggle"));
|
||||
COMMANDS.put("sandvisibility", new VisualCommand(Visibility.Setting.SAND_VISIBILITY, "sandtoggle"));
|
||||
COMMANDS.put("minimal", new VisualCommand(Visibility.Setting.MINIMAL, "minimaltnt", "tntlag"));
|
||||
@@ -418,18 +418,18 @@ index 0000000000000000000000000000000000000000..6903863ad293a335a8ed1aeaa06fccb4
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 0fa8b271c58c74820461f7bec213062b266ec18b..321bd1d6c2cbf8384b08708abb837ed3ad4a0078 100644
|
||||
index 6c65c3235271d181ef5efc1263fe2161f1e6a157..7908e2f0aef64241db1a030f8ed4dbc85930fee9 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1097,6 +1097,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1157,6 +1157,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
private static final java.math.BigDecimal TPS_BASE = new java.math.BigDecimal(1E9).multiply(new java.math.BigDecimal(SAMPLE_INTERVAL));
|
||||
// Paper End
|
||||
// Spigot End
|
||||
+ public static final me.samsuik.sakura.utils.tps.TickTracking tickTracking = new me.samsuik.sakura.utils.tps.TickTracking(120); // Sakura - tps graph command
|
||||
|
||||
public static volatile RuntimeException chunkSystemCrash; // Paper - rewrite chunk system
|
||||
|
||||
@@ -1153,6 +1154,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
protected void runServer() {
|
||||
try {
|
||||
@@ -1201,6 +1202,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
{
|
||||
final long diff = curTime - tickSection;
|
||||
java.math.BigDecimal currentTps = TPS_BASE.divide(new java.math.BigDecimal(diff), 30, java.math.RoundingMode.HALF_UP);
|
||||
@@ -437,7 +437,7 @@ index 0fa8b271c58c74820461f7bec213062b266ec18b..321bd1d6c2cbf8384b08708abb837ed3
|
||||
tps1.add(currentTps, diff);
|
||||
tps5.add(currentTps, diff);
|
||||
tps15.add(currentTps, diff);
|
||||
@@ -1176,6 +1178,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1224,6 +1226,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.startMetricsRecordingTick();
|
||||
this.profiler.push("tick");
|
||||
this.tickServer(this::haveTime);
|
||||
@@ -446,10 +446,10 @@ index 0fa8b271c58c74820461f7bec213062b266ec18b..321bd1d6c2cbf8384b08708abb837ed3
|
||||
this.mayHaveDelayedTasks = true;
|
||||
this.delayedTasksMaxNextTickTime = Math.max(Util.getMillis() + 50L, this.nextTickTime);
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
index ca84eddbdb1e198b899750e5f6b3eafd25ce970f..c060ffdaba7b3bd2020577b8e0a60d9d4f2b0d42 100644
|
||||
index fb0757d4bb32123641535a88a22bc074b8d2623f..880a3dc6b31be5950bbc3130172be1c2d7b6ebf8 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
@@ -312,6 +312,11 @@ public class ServerChunkCache extends ChunkSource {
|
||||
@@ -413,6 +413,11 @@ public class ServerChunkCache extends ChunkSource {
|
||||
this.clearCache();
|
||||
}
|
||||
|
||||
@@ -462,18 +462,18 @@ index ca84eddbdb1e198b899750e5f6b3eafd25ce970f..c060ffdaba7b3bd2020577b8e0a60d9d
|
||||
public boolean isChunkLoaded(int chunkX, int chunkZ) {
|
||||
ChunkHolder chunk = this.chunkMap.getUpdatingChunkIfPresent(ChunkPos.asLong(chunkX, chunkZ));
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index c4f4d06a10b24e9def2458ce1297da5f830c84c9..0aea28a20f775b5df2ae2f92e435c84152b4d4be 100644
|
||||
index ffa6c8ec5a23f25f58ba88300196b9f19a0bbf22..6794accac49b876ef8e7563a11b254178aa0e3cc 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -192,7 +192,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -181,7 +181,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
public final ServerChunkCache chunkSource;
|
||||
private final MinecraftServer server;
|
||||
public final PrimaryLevelData serverLevelData; // CraftBukkit - type
|
||||
- final EntityTickList entityTickList;
|
||||
+ public final EntityTickList entityTickList; // Sakura - public!
|
||||
//public final PersistentEntitySectionManager<Entity> entityManager; // Paper - rewrite chunk system
|
||||
private final GameEventDispatcher gameEventDispatcher;
|
||||
public final PersistentEntitySectionManager<Entity> entityManager;
|
||||
public boolean noSave;
|
||||
private final SleepStatus sleepStatus;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/entity/EntityTickList.java b/src/main/java/net/minecraft/world/level/entity/EntityTickList.java
|
||||
index 4cdfc433df67afcd455422e9baf56f167dd712ae..0d64ec654fe7af4961facc2554df757deddad7f6 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/entity/EntityTickList.java
|
||||
@@ -488,7 +488,7 @@ index 4cdfc433df67afcd455422e9baf56f167dd712ae..0d64ec654fe7af4961facc2554df757d
|
||||
private void ensureActiveIsNotIterated() {
|
||||
// Paper - replace with better logic, do not delay removals
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
|
||||
index 612c3169c3463d702b85975e1db79ae6e47d60d0..2063a6c6ab0786aee51be027950c2a936f593b55 100644
|
||||
index d509187ca63963fdd7f1a44d89d2aa1a1b1ce3bd..56fe9e602df9ae6bf2bd3435203a5063eca8494e 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
|
||||
@@ -283,7 +283,7 @@ public class SpigotConfig
|
||||
@@ -19,18 +19,19 @@ The current packets modified/obfuscated are the following:
|
||||
# with packets instead of every single player within tracking distance
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java b/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java
|
||||
index 37e193f57938047c8b886ed7d2816411392f94b4..6ca522b4a56eb210e15c914d13615ef497b33626 100644
|
||||
index 1d88edfd09a909044f6e3175af652914b4d06311..c5bcddb4562ce249e7676a72a5836efae700e27e 100644
|
||||
--- a/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java
|
||||
+++ b/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java
|
||||
@@ -34,6 +34,7 @@ public class SynchedEntityData {
|
||||
private final Int2ObjectMap<SynchedEntityData.DataItem<?>> itemsById = new Int2ObjectOpenHashMap();
|
||||
@@ -34,6 +34,8 @@ public class SynchedEntityData {
|
||||
// private final ReadWriteLock lock = new ReentrantReadWriteLock(); // Spigot - not required
|
||||
private boolean isEmpty = true;
|
||||
private boolean isDirty;
|
||||
+ private boolean isForeignDirty; // Slice
|
||||
+ private boolean packForeign; // Slice
|
||||
|
||||
public SynchedEntityData(Entity trackedEntity) {
|
||||
this.entity = trackedEntity;
|
||||
@@ -135,6 +136,12 @@ public class SynchedEntityData {
|
||||
@@ -136,6 +138,12 @@ public class SynchedEntityData {
|
||||
}
|
||||
|
||||
public <T> void set(EntityDataAccessor<T> key, T value) {
|
||||
@@ -43,7 +44,7 @@ index 37e193f57938047c8b886ed7d2816411392f94b4..6ca522b4a56eb210e15c914d13615ef4
|
||||
SynchedEntityData.DataItem<T> datawatcher_item = this.getItem(key);
|
||||
|
||||
if (ObjectUtils.notEqual(value, datawatcher_item.getValue())) {
|
||||
@@ -144,6 +151,12 @@ public class SynchedEntityData {
|
||||
@@ -145,6 +153,12 @@ public class SynchedEntityData {
|
||||
this.isDirty = true;
|
||||
}
|
||||
|
||||
@@ -56,11 +57,15 @@ index 37e193f57938047c8b886ed7d2816411392f94b4..6ca522b4a56eb210e15c914d13615ef4
|
||||
}
|
||||
|
||||
// CraftBukkit start - add method from above
|
||||
@@ -153,6 +166,12 @@ public class SynchedEntityData {
|
||||
@@ -154,6 +168,16 @@ public class SynchedEntityData {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
+ // Slice start
|
||||
+ public void packForeign(boolean shouldPackForeignData) {
|
||||
+ this.packForeign = shouldPackForeignData;
|
||||
+ }
|
||||
+
|
||||
+ public boolean isForeignDirty() {
|
||||
+ return this.isForeignDirty;
|
||||
+ }
|
||||
@@ -69,55 +74,50 @@ index 37e193f57938047c8b886ed7d2816411392f94b4..6ca522b4a56eb210e15c914d13615ef4
|
||||
public boolean isDirty() {
|
||||
return this.isDirty;
|
||||
}
|
||||
@@ -185,6 +204,29 @@ public class SynchedEntityData {
|
||||
@@ -178,18 +202,19 @@ public class SynchedEntityData {
|
||||
|
||||
if (this.isDirty) {
|
||||
// this.lock.readLock().lock(); // Spigot - not required
|
||||
+ final boolean packForeignData = this.packForeign; // Slice
|
||||
ObjectIterator objectiterator = this.itemsById.values().iterator();
|
||||
|
||||
while (objectiterator.hasNext()) {
|
||||
SynchedEntityData.DataItem<?> datawatcher_item = (SynchedEntityData.DataItem) objectiterator.next();
|
||||
|
||||
- if (datawatcher_item.isDirty()) {
|
||||
+ if (datawatcher_item.isDirty(packForeignData)) { // Slice
|
||||
datawatcher_item.setDirty(false);
|
||||
if (list == null) {
|
||||
list = Lists.newArrayList();
|
||||
}
|
||||
|
||||
- list.add(datawatcher_item.copy());
|
||||
+ list.add(datawatcher_item.copy(packForeignData)); // Slice
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,6 +222,7 @@ public class SynchedEntityData {
|
||||
}
|
||||
|
||||
this.isDirty = false;
|
||||
+ this.isForeignDirty = false; // Slice
|
||||
return list;
|
||||
}
|
||||
|
||||
+ // Slice start
|
||||
+ @Nullable
|
||||
+ public List<SynchedEntityData.DataValue<?>> packForeignDirty(List<DataValue<?>> unpackedData) {
|
||||
+ List<SynchedEntityData.DataValue<?>> list = null;
|
||||
+
|
||||
+ for (DataValue<?> dataItem : unpackedData) {
|
||||
+ DataItem<?> item = itemsById.get(dataItem.id());
|
||||
+ if (item.isDirty(true)) {
|
||||
+ item.setForeignDirty(false);
|
||||
+
|
||||
+ if (list == null) {
|
||||
+ list = new ArrayList<>();
|
||||
+ }
|
||||
+
|
||||
+ list.add(item.copy(true));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ this.isForeignDirty = false;
|
||||
+ return list;
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
@Nullable
|
||||
public List<SynchedEntityData.DataValue<?>> getNonDefaultValues() {
|
||||
List<SynchedEntityData.DataValue<?>> list = null;
|
||||
@@ -291,11 +333,14 @@ public class SynchedEntityData {
|
||||
@@ -313,12 +339,44 @@ public class SynchedEntityData {
|
||||
final EntityDataAccessor<T> accessor;
|
||||
T value;
|
||||
private final T initialValue;
|
||||
private boolean dirty;
|
||||
+ @Nullable T foreignValue = null; // Slice
|
||||
+ private boolean foreignDirty; // Slice
|
||||
|
||||
public DataItem(EntityDataAccessor<T> data, T value) {
|
||||
this.accessor = data;
|
||||
this.initialValue = value;
|
||||
this.value = value;
|
||||
this.dirty = true;
|
||||
+ this.foreignDirty = true; // Slice
|
||||
}
|
||||
|
||||
public EntityDataAccessor<T> getAccessor() {
|
||||
@@ -322,6 +367,35 @@ public class SynchedEntityData {
|
||||
return this.initialValue.equals(this.value);
|
||||
}
|
||||
|
||||
+ }
|
||||
+
|
||||
+ // Slice start
|
||||
+ public void setForeignValue(T foreignValue) {
|
||||
+ this.foreignValue = foreignValue;
|
||||
@@ -142,20 +142,27 @@ index 37e193f57938047c8b886ed7d2816411392f94b4..6ca522b4a56eb210e15c914d13615ef4
|
||||
+ this.foreignDirty = dirty;
|
||||
+ }
|
||||
+
|
||||
+ public SynchedEntityData.DataValue<T> copy(boolean foreign) {
|
||||
+ return SynchedEntityData.DataValue.create(this.accessor, this.accessor.getSerializer().copy((foreign && this.foreignValue != null ? this.foreignValue : this.value)));
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
public SynchedEntityData.DataValue<T> value() {
|
||||
return SynchedEntityData.DataValue.create(this.accessor, this.value);
|
||||
+ 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
|
||||
|
||||
public EntityDataAccessor<T> getAccessor() {
|
||||
return this.accessor;
|
||||
@@ -338,6 +396,7 @@ public class SynchedEntityData {
|
||||
|
||||
public void setDirty(boolean dirty) {
|
||||
this.dirty = dirty;
|
||||
+ this.foreignDirty &= dirty; // Slice
|
||||
}
|
||||
|
||||
public SynchedEntityData.DataItem<T> copy() {
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index 190e9761087baec5827d722a8281f0ffb6798341..18676547ee697bea691c0ee69df5906455c5f238 100644
|
||||
index f91e1a876ad4c46a7c92cead18947a941b4d9e68..96e45c6a8ac366bd9248b26389a5c99008d2ebf9 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -129,7 +129,7 @@ public class ServerEntity {
|
||||
}
|
||||
@@ -121,7 +121,7 @@ public class ServerEntity {
|
||||
this.sendDirtyEntityData();
|
||||
}
|
||||
|
||||
- if (this.tickCount % this.updateInterval == 0 || this.entity.hasImpulse || this.entity.getEntityData().isDirty()) {
|
||||
@@ -163,28 +170,21 @@ index 190e9761087baec5827d722a8281f0ffb6798341..18676547ee697bea691c0ee69df59064
|
||||
int i;
|
||||
int j;
|
||||
|
||||
@@ -367,7 +367,15 @@ public class ServerEntity {
|
||||
@@ -371,7 +371,9 @@ public class ServerEntity {
|
||||
SynchedEntityData datawatcher = this.entity.getEntityData();
|
||||
|
||||
if (list != null) {
|
||||
this.trackedDataValues = datawatcher.getNonDefaultValues();
|
||||
- this.broadcastAndSend(new ClientboundSetEntityDataPacket(this.entity.getId(), list));
|
||||
+ // Slice start
|
||||
+ if (!(this.entity instanceof ServerPlayer)) {
|
||||
+ list = datawatcher.packForeignDirty(list);
|
||||
+ }
|
||||
+
|
||||
+ if (list != null) {
|
||||
+ this.broadcastAndSend(new ClientboundSetEntityDataPacket(this.entity.getId(), list));
|
||||
+ }
|
||||
+ // Slice end
|
||||
if (datawatcher.isDirty()) {
|
||||
+ datawatcher.packForeign(true); // Slice
|
||||
this.broadcastAndSend(new ClientboundSetEntityDataPacket(this.entity.getId(), datawatcher, false));
|
||||
+ datawatcher.packForeign(false); // Slice
|
||||
}
|
||||
|
||||
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 c0fb35497cfab69e5d28a70a2756f0d74a406630..35c4253e1ee951c31958bb9275a4f497fd5b16bb 100644
|
||||
index 67963fc50e1039192468a418335ba2bb581174cd..296b7b5a3c5bd80f51a5cea3e37f08dca5df2c53 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -3131,7 +3131,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -2989,7 +2989,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
this.entityData.markDirty(Entity.DATA_AIR_SUPPLY_ID);
|
||||
return;
|
||||
}
|
||||
@@ -194,10 +194,10 @@ index c0fb35497cfab69e5d28a70a2756f0d74a406630..35c4253e1ee951c31958bb9275a4f497
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
index 3559457024f5c9bef4c44a27514e338c7d2b4172..6b85eecde57a809391d531bb11d189d0a25ccfdc 100644
|
||||
index e4a7d8decdd86b1cdd645ec36bee48792ef3a944..39b27750df3c93c3b6481d1663b854750ee646db 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
@@ -107,7 +107,7 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -105,7 +105,7 @@ public class FallingBlockEntity extends Entity {
|
||||
}
|
||||
|
||||
public void setStartPos(BlockPos pos) {
|
||||
@@ -207,10 +207,10 @@ index 3559457024f5c9bef4c44a27514e338c7d2b4172..6b85eecde57a809391d531bb11d189d0
|
||||
|
||||
public BlockPos getStartPos() {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
index 5761b786f036df1516189edd67ea4439d64c6ea8..c2f04fca63ebef48a3092b60c703277abcb9b586 100644
|
||||
index 5cbda5c5d7f1a110548110959dfe1edddcc67def..6a97e77b81359a6722293837088c01b6618a0976 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
@@ -171,7 +171,7 @@ public class PrimedTnt extends Entity {
|
||||
@@ -174,7 +174,7 @@ public class PrimedTnt extends Entity {
|
||||
}
|
||||
|
||||
public void setFuse(int fuse) {
|
||||
@@ -220,10 +220,10 @@ index 5761b786f036df1516189edd67ea4439d64c6ea8..c2f04fca63ebef48a3092b60c703277a
|
||||
|
||||
public int getFuse() {
|
||||
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 1116116e4ba6c5ecec400cd371b70b9e14efd92b..407401198c21dd5887aa3b7d86cdb112ef369007 100644
|
||||
index 2483d7df7f1bf94344afd38b37602c645a4a2dff..5c16235115a9233bce1f5b30bb020d105bdca3d1 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -637,7 +637,7 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -632,7 +632,7 @@ public abstract class Player extends LivingEntity {
|
||||
public void increaseScore(int score) {
|
||||
int j = this.getScore();
|
||||
|
||||
@@ -5,15 +5,15 @@ Subject: [PATCH] Use Optimised TrackedEntityMap
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index 500d0b297de5234b4c622d407d511b161acc2233..c3b3e984f8a19252b6feabb9ba1f7169dcec2fa2 100644
|
||||
index 1dc2bc400afe5012fe03ea3799c100ed453d1148..759ac36b32eaddcc0cff4c2308030b692d6fc7f4 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -295,7 +295,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
// Paper - rewrite chunk system
|
||||
@@ -415,7 +415,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
this.toDrop = new LongOpenHashSet();
|
||||
this.tickingGenerated = new AtomicInteger();
|
||||
this.playerMap = new PlayerMap();
|
||||
- this.entityMap = new Int2ObjectOpenHashMap();
|
||||
+ this.entityMap = new me.samsuik.sakura.utils.collections.TrackedEntityChunkMap(); // Sakura - optimised tracked entity map
|
||||
this.chunkTypeCache = new Long2ByteOpenHashMap();
|
||||
this.chunkSaveCooldowns = new Long2LongOpenHashMap();
|
||||
this.unloadQueue = Queues.newConcurrentLinkedQueue();
|
||||
this.structureManager = structureManager;
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Copy EntityList methods to BasicEntityList
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java b/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
|
||||
index f597d65d56964297eeeed6c7e77703764178fee0..1d6b96fd6dae9524c31e71a778351e8b2d325b7f 100644
|
||||
index 47b5f75d9f27cf3ab947fd1f69cbd609fb9f2749..546c72143b7e94681b37a94f81be1303f608ae40 100644
|
||||
--- a/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
|
||||
+++ b/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
|
||||
@@ -24,6 +24,8 @@ import java.util.Iterator;
|
||||
@@ -16,6 +16,8 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
@@ -17,7 +17,7 @@ index f597d65d56964297eeeed6c7e77703764178fee0..1d6b96fd6dae9524c31e71a778351e8b
|
||||
public final class ChunkEntitySlices {
|
||||
|
||||
protected final int minSection;
|
||||
@@ -298,6 +300,13 @@ public final class ChunkEntitySlices {
|
||||
@@ -189,6 +191,13 @@ public final class ChunkEntitySlices {
|
||||
|
||||
protected static final class BasicEntityList<E extends Entity> {
|
||||
|
||||
@@ -31,7 +31,7 @@ index f597d65d56964297eeeed6c7e77703764178fee0..1d6b96fd6dae9524c31e71a778351e8b
|
||||
protected static final Entity[] EMPTY = new Entity[0];
|
||||
protected static final int DEFAULT_CAPACITY = 4;
|
||||
|
||||
@@ -320,55 +329,52 @@ public final class ChunkEntitySlices {
|
||||
@@ -211,55 +220,52 @@ public final class ChunkEntitySlices {
|
||||
return this.size;
|
||||
}
|
||||
|
||||
@@ -5,12 +5,12 @@ Subject: [PATCH] Add utility methods to EntitySlices
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java b/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
|
||||
index 1d6b96fd6dae9524c31e71a778351e8b2d325b7f..ce231d8b230d4983b21c597357c0b22377e4bcca 100644
|
||||
index 546c72143b7e94681b37a94f81be1303f608ae40..f2753ad52b07236c702b41892ec98415b1dd7bbd 100644
|
||||
--- a/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
|
||||
+++ b/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
|
||||
@@ -246,6 +246,12 @@ public final class ChunkEntitySlices {
|
||||
|
||||
return true;
|
||||
@@ -131,6 +131,12 @@ public final class ChunkEntitySlices {
|
||||
}
|
||||
}
|
||||
}
|
||||
+
|
||||
+ // Sakura start
|
||||
@@ -21,7 +21,7 @@ index 1d6b96fd6dae9524c31e71a778351e8b2d325b7f..ce231d8b230d4983b21c597357c0b223
|
||||
|
||||
public void getHardCollidingEntities(final Entity except, final AABB box, final List<Entity> into, final Predicate<? super Entity> predicate) {
|
||||
this.hardCollidingEntities.getEntities(except, box, into, predicate);
|
||||
@@ -424,6 +430,18 @@ public final class ChunkEntitySlices {
|
||||
@@ -315,6 +321,18 @@ public final class ChunkEntitySlices {
|
||||
this.nonEmptyBitset[sectionIndex >>> 6] ^= (1L << (sectionIndex & (Long.SIZE - 1)));
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Optimise paper explosions
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index e60410d2d1a09f935caffe0cfb9b6232c00b1c8c..0547588fba8cbb7871afd8601c9cb605f8bf09d2 100644
|
||||
index 22ceea2deb22bc8bd082a5ad94de9a9ca02a4ec7..2301773137d004b1fbfa030caea6a4f436d1beae 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -96,7 +96,196 @@ public class Explosion {
|
||||
@@ -104,7 +104,196 @@ public class Explosion {
|
||||
this.damageCalculator = behavior == null ? this.makeDamageCalculator(entity) : behavior;
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ index e60410d2d1a09f935caffe0cfb9b6232c00b1c8c..0547588fba8cbb7871afd8601c9cb605
|
||||
+ BlockPos explodedPosition = mutableBlockPos.immutable();
|
||||
+ this.toBlow.add(explodedPosition);
|
||||
+ // Paper start - prevent headless pistons from forming
|
||||
+ if (!io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowHeadlessPistons && blockstate.getBlock() == Blocks.MOVING_PISTON) {
|
||||
+ if (!com.destroystokyo.paper.PaperConfig.allowHeadlessPistons && blockstate.getBlock() == Blocks.MOVING_PISTON) {
|
||||
+ BlockEntity extension = this.level.getBlockEntity(explodedPosition);
|
||||
+ if (extension instanceof net.minecraft.world.level.block.piston.PistonMovingBlockEntity blockEntity && blockEntity.isSourcePiston()) {
|
||||
+ net.minecraft.core.Direction direction = blockstate.getValue(net.minecraft.world.level.block.piston.PistonHeadBlock.FACING);
|
||||
@@ -175,7 +175,7 @@ index e60410d2d1a09f935caffe0cfb9b6232c00b1c8c..0547588fba8cbb7871afd8601c9cb605
|
||||
+ int minChunkZ = Mth.floor(this.z - f2) >> 4;
|
||||
+ int maxChunkZ = Mth.floor(this.z + f2) >> 4;
|
||||
+
|
||||
+ io.papermc.paper.chunk.system.entity.EntityLookup entityLookup = ((net.minecraft.server.level.ServerLevel) this.level).getEntityLookup();
|
||||
+ io.papermc.paper.world.EntitySliceManager entityLookup = ((ServerLevel) this.level.getEntities()).entitySliceManager;
|
||||
+ for (int chunkX = minChunkX; chunkX <= maxChunkX; ++chunkX) {
|
||||
+ for (int chunkZ = minChunkZ; chunkZ <= maxChunkZ; ++chunkZ) {
|
||||
+ io.papermc.paper.world.ChunkEntitySlices chunk = entityLookup.getChunk(chunkX, chunkZ);
|
||||
@@ -205,7 +205,7 @@ index e60410d2d1a09f935caffe0cfb9b6232c00b1c8c..0547588fba8cbb7871afd8601c9cb605
|
||||
return (ExplosionDamageCalculator) (entity == null ? Explosion.EXPLOSION_DAMAGE_CALCULATOR : new EntityBasedExplosionDamageCalculator(entity));
|
||||
}
|
||||
|
||||
@@ -148,76 +337,34 @@ public class Explosion {
|
||||
@@ -156,76 +345,34 @@ public class Explosion {
|
||||
int i;
|
||||
int j;
|
||||
|
||||
@@ -245,10 +245,10 @@ index e60410d2d1a09f935caffe0cfb9b6232c00b1c8c..0547588fba8cbb7871afd8601c9cb605
|
||||
- if (f > 0.0F && this.damageCalculator.shouldBlockExplode(this, this.level, blockposition, iblockdata, f)) {
|
||||
- set.add(blockposition);
|
||||
- // Paper start - prevent headless pistons from forming
|
||||
- if (!io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowHeadlessPistons && iblockdata.getBlock() == Blocks.MOVING_PISTON) {
|
||||
- if (!com.destroystokyo.paper.PaperConfig.allowHeadlessPistons && iblockdata.getBlock() == Blocks.MOVING_PISTON) {
|
||||
- BlockEntity extension = this.level.getBlockEntity(blockposition);
|
||||
- if (extension instanceof net.minecraft.world.level.block.piston.PistonMovingBlockEntity blockEntity && blockEntity.isSourcePiston()) {
|
||||
- net.minecraft.core.Direction direction = iblockdata.getValue(net.minecraft.world.level.block.piston.PistonHeadBlock.FACING);
|
||||
- if (extension instanceof PistonMovingBlockEntity && ((PistonMovingBlockEntity) extension).isSourcePiston()) {
|
||||
- net.minecraft.core.Direction direction = iblockdata.getValue(PistonHeadBlock.FACING);
|
||||
- set.add(blockposition.relative(direction.getOpposite()));
|
||||
- }
|
||||
- }
|
||||
@@ -266,7 +266,7 @@ index e60410d2d1a09f935caffe0cfb9b6232c00b1c8c..0547588fba8cbb7871afd8601c9cb605
|
||||
+ BlockPos explosionBlockPos = new BlockPos(this.x, this.y, this.z);
|
||||
+ BlockState blockstate = this.level.getBlockState(explosionBlockPos);
|
||||
+ float resistance = blockstate.getBlock().getExplosionResistance();
|
||||
+ if ((resistance + 0.3f) * 0.3f < (this.radius * 1.3f) && this.interactsWithBlocks()) {
|
||||
+ if ((resistance + 0.3f) * 0.3f < (this.radius * 1.3f) && this.blockInteraction != Explosion.BlockInteraction.NONE) {
|
||||
+ this.searchForBlocks();
|
||||
}
|
||||
|
||||
@@ -298,7 +298,7 @@ index e60410d2d1a09f935caffe0cfb9b6232c00b1c8c..0547588fba8cbb7871afd8601c9cb605
|
||||
if (!entity.ignoreExplosion()) {
|
||||
double d7 = Math.sqrt(entity.distanceToSqr(vec3d)) / (double) f2;
|
||||
|
||||
@@ -243,17 +390,18 @@ public class Explosion {
|
||||
@@ -253,12 +400,13 @@ public class Explosion {
|
||||
// - Damaging EntityEnderDragon does nothing
|
||||
// - EntityEnderDragon hitbock always covers the other parts and is therefore always present
|
||||
if (entity instanceof EnderDragonPart) {
|
||||
@@ -306,20 +306,15 @@ index e60410d2d1a09f935caffe0cfb9b6232c00b1c8c..0547588fba8cbb7871afd8601c9cb605
|
||||
+ return; // Sakura - optimise vanilla explosions
|
||||
}
|
||||
|
||||
CraftEventFactory.entityDamage = this.source;
|
||||
entity.lastDamageCancelled = false;
|
||||
|
||||
if (entity instanceof EnderDragon) {
|
||||
+ final AABB bounds = this.getExplosionBounds(f2); // Sakura - optimise vanilla explosions
|
||||
for (EnderDragonPart entityComplexPart : ((EnderDragon) entity).subEntities) {
|
||||
// Calculate damage separately for each EntityComplexPart
|
||||
double d7part;
|
||||
- if (list.contains(entityComplexPart) && (d7part = Math.sqrt(entityComplexPart.distanceToSqr(vec3d)) / f2) <= 1.0D) {
|
||||
+ if (entityComplexPart.getBoundingBox().intersects(bounds) && (d7part = Math.sqrt(entityComplexPart.distanceToSqr(vec3d)) / f2) <= 1.0D) { // Sakura - optimise vanilla explosions
|
||||
double d13part = (1.0D - d7part) * Explosion.getSeenPercent(vec3d, entityComplexPart);
|
||||
entityComplexPart.hurt(this.getDamageSource(), (float) ((int) ((d13part * d13part + d13part) / 2.0D * 7.0D * (double) f2 + 1.0D)));
|
||||
- if (list.contains(entityComplexPart)) {
|
||||
+ if (entityComplexPart.getBoundingBox().intersects(bounds)) { // Sakura - optimise vanilla explosions
|
||||
entityComplexPart.hurt(this.getDamageSource(), (float) ((int) ((d13 * d13 + d13) / 2.0D * 7.0D * (double) f2 + 1.0D)));
|
||||
}
|
||||
@@ -264,7 +412,7 @@ public class Explosion {
|
||||
}
|
||||
@@ -268,7 +416,7 @@ public class Explosion {
|
||||
|
||||
CraftEventFactory.entityDamage = null;
|
||||
if (entity.lastDamageCancelled) { // SPIGOT-5339, SPIGOT-6252, SPIGOT-6777: Skip entity if damage event was cancelled
|
||||
@@ -46,10 +46,10 @@ index 0000000000000000000000000000000000000000..5b72f13e6fb5d9999940e640c0341c2e
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 35c4253e1ee951c31958bb9275a4f497fd5b16bb..106e03e0eae24f47a49d2495e98cb30195b27013 100644
|
||||
index 296b7b5a3c5bd80f51a5cea3e37f08dca5df2c53..7e1868bb483adefdab085f753acd71c65cb9c8c5 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -546,6 +546,25 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -433,6 +433,25 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
public boolean isFallingBlock;
|
||||
// Sakura end - visibility api and command
|
||||
public boolean loadChunks = false; // Sakura - load chunks on cannon entity movement
|
||||
@@ -57,15 +57,15 @@ index 35c4253e1ee951c31958bb9275a4f497fd5b16bb..106e03e0eae24f47a49d2495e98cb301
|
||||
+ private @Nullable me.samsuik.sakura.entity.EntityState entityState = null;
|
||||
+
|
||||
+ public final Vec3 stuckSpeedMultiplier() {
|
||||
+ return stuckSpeedMultiplier;
|
||||
+ return this.stuckSpeedMultiplier;
|
||||
+ }
|
||||
+
|
||||
+ public final void storeEntityState() {
|
||||
+ entityState = me.samsuik.sakura.entity.EntityState.of(this);
|
||||
+ this.entityState = me.samsuik.sakura.entity.EntityState.of(this);
|
||||
+ }
|
||||
+
|
||||
+ public final @Nullable me.samsuik.sakura.entity.EntityState entityState() {
|
||||
+ return entityState;
|
||||
+ return this.entityState;
|
||||
+ }
|
||||
+
|
||||
+ public final boolean compareState(Entity to) {
|
||||
@@ -73,13 +73,13 @@ index 35c4253e1ee951c31958bb9275a4f497fd5b16bb..106e03e0eae24f47a49d2495e98cb301
|
||||
+ }
|
||||
+ // Sakura end - store entity data/state
|
||||
|
||||
public Entity(EntityType<?> type, Level world) {
|
||||
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
|
||||
// Paper start
|
||||
/**
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 00ebe6b2e3068a3b9c1c4a7566685191f21ed379..d80cdbbd9cd569e6db31950f05695c1cf476be3c 100644
|
||||
index 9c28594590c57ced725f3e0c6fdb9c6a5ab9bfa2..ff6c4664c22aca6a7be44e3ccb7bff543c6a2a1b 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -932,6 +932,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -942,6 +942,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
|
||||
public <T extends Entity> void guardEntityTick(Consumer<T> tickConsumer, T entity) {
|
||||
try {
|
||||
@@ -169,10 +169,10 @@ index 0000000000000000000000000000000000000000..e63935c17e213bf60571d120ad9ce311
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 321bd1d6c2cbf8384b08708abb837ed3ad4a0078..1358f800a29ef15163442331100816bb418ae3f6 100644
|
||||
index 7908e2f0aef64241db1a030f8ed4dbc85930fee9..536dd6fd0317779e04f133d2ae32a251da9e4394 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1567,6 +1567,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1620,6 +1620,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
worldserver.explosionDensityCache.clear(); // Paper - Optimize explosions
|
||||
worldserver.localConfig().expire(currentTickLong); // Sakura
|
||||
worldserver.minimalTNT.clear(); // Sakura - visibility api
|
||||
@@ -181,10 +181,10 @@ index 321bd1d6c2cbf8384b08708abb837ed3ad4a0078..1358f800a29ef15163442331100816bb
|
||||
this.isIteratingOverLevels = false; // Paper
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 0aea28a20f775b5df2ae2f92e435c84152b4d4be..839ab14b901f7deae5c53626c16ff1e74b57a531 100644
|
||||
index 6794accac49b876ef8e7563a11b254178aa0e3cc..451f7facb950c98b67713d6e7d012bf25bb89e31 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -708,6 +708,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -651,6 +651,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
|
||||
org.spigotmc.ActivationRange.activateEntities(this); // Spigot
|
||||
timings.entityTick.startTiming(); // Spigot
|
||||
@@ -192,7 +192,7 @@ index 0aea28a20f775b5df2ae2f92e435c84152b4d4be..839ab14b901f7deae5c53626c16ff1e7
|
||||
this.entityTickList.forEach((entity) -> {
|
||||
if (!entity.isRemoved()) {
|
||||
if (false && this.shouldDiscardEntity(entity)) { // CraftBukkit - We prevent spawning in general, so this butchering is not needed
|
||||
@@ -727,6 +728,15 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -670,6 +671,15 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
entity.stopRiding();
|
||||
}
|
||||
|
||||
@@ -209,10 +209,10 @@ index 0aea28a20f775b5df2ae2f92e435c84152b4d4be..839ab14b901f7deae5c53626c16ff1e7
|
||||
this.guardEntityTick(this::tickNonPassenger, entity);
|
||||
gameprofilerfiller.pop();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 2946d081032f6d8481643b43420f23b9bd6184d6..33f3a18eb0ef90bc71f1f40c3fd057cc50d22b2b 100644
|
||||
index 7e1868bb483adefdab085f753acd71c65cb9c8c5..ff25112e1a270f32faf8b0a885166dc57848b5cf 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -565,6 +565,124 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -452,6 +452,121 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
return to.entityState() != null && to.entityState().isCurrentState(this);
|
||||
}
|
||||
// Sakura end - store entity data/state
|
||||
@@ -224,39 +224,36 @@ index 2946d081032f6d8481643b43420f23b9bd6184d6..33f3a18eb0ef90bc71f1f40c3fd057cc
|
||||
+ protected int stacked = 1; // default
|
||||
+
|
||||
+ public final me.samsuik.sakura.entity.merge.MergeLevel getMergeLevel() {
|
||||
+ return mergeLevel;
|
||||
+ return this.mergeLevel;
|
||||
+ }
|
||||
+
|
||||
+ public final void setMergeLevel(me.samsuik.sakura.entity.merge.MergeLevel level) {
|
||||
+ mergeLevel = level;
|
||||
+ this.mergeLevel = level;
|
||||
+ }
|
||||
+
|
||||
+ public final int getStacked() {
|
||||
+ return stacked;
|
||||
+ return this.stacked;
|
||||
+ }
|
||||
+
|
||||
+ public final void setStacked(int stack) {
|
||||
+ stacked = stack;
|
||||
+ this.stacked = stack;
|
||||
+ }
|
||||
+
|
||||
+ public final List<Entity> getMergeList() {
|
||||
+ return mergeList;
|
||||
+ return this.mergeList;
|
||||
+ }
|
||||
+
|
||||
+ public final long getPackedOrigin() {
|
||||
+ var v = getOriginVector();
|
||||
+ org.bukkit.util.Vector v = this.getOriginVector();
|
||||
+ if (v == null) return Long.MIN_VALUE;
|
||||
+ // Note: vector#getBlockN may not be 100% exact
|
||||
+ // If there's any future issues at let's say 0.999999...
|
||||
+ // giving an incorrect position change it to Mth instead.
|
||||
+ return BlockPos.asLong(v.getBlockX(), v.getBlockY(), v.getBlockZ());
|
||||
+ }
|
||||
+
|
||||
+ private boolean isSafeToSpawnMerge(Entity entity) {
|
||||
+ return tickCount == 1 && originData != null
|
||||
+ && originData.isAbleToOnSpawnMerge() // on spawn safety delay has passed
|
||||
+ && originData == entity.originData // make sure it's the same group
|
||||
+ && originData.isPositionRetained(entity.getPackedOrigin());
|
||||
+ return this.tickCount == 1 && this.originData != null
|
||||
+ && this.originData.isAbleToOnSpawnMerge() // on spawn safety delay has passed
|
||||
+ && this.originData == entity.originData // make sure it's the same group
|
||||
+ && this.originData.isPositionRetained(entity.getPackedOrigin());
|
||||
+ }
|
||||
+
|
||||
+ public boolean isMergeableType(@Nullable Entity previous) {
|
||||
@@ -264,15 +261,15 @@ index 2946d081032f6d8481643b43420f23b9bd6184d6..33f3a18eb0ef90bc71f1f40c3fd057cc
|
||||
+ }
|
||||
+
|
||||
+ public final boolean tryMergeInto(@Nullable Entity entity) {
|
||||
+ if (mergeLevel.atLeast(me.samsuik.sakura.entity.merge.MergeLevel.LENIENT) && tickCount == 0) {
|
||||
+ originData = level.mergeHistory.retrievePositions(this);
|
||||
+ if (this.mergeLevel.atLeast(me.samsuik.sakura.entity.merge.MergeLevel.LENIENT) && this.tickCount == 0) {
|
||||
+ this.originData = this.level.mergeHistory.retrievePositions(this);
|
||||
+ }
|
||||
+
|
||||
+ Entity mergeEntity = null;
|
||||
+
|
||||
+ if (entity == null || entity.getType() != getType()) {
|
||||
+ return false; // First entity
|
||||
+ } else if (mergeLevel.atLeast(me.samsuik.sakura.entity.merge.MergeLevel.SPAWN) && entity.isSafeToSpawnMerge(this)) {
|
||||
+ } else if (this.mergeLevel.atLeast(me.samsuik.sakura.entity.merge.MergeLevel.SPAWN) && entity.isSafeToSpawnMerge(this)) {
|
||||
+ // "SPAWN" merges entities one gametick after they have spawned. Merging is
|
||||
+ // only possible after it has been established that the entity is safe to
|
||||
+ // merge by collecting information on the entities that merge together over time.
|
||||
@@ -280,20 +277,20 @@ index 2946d081032f6d8481643b43420f23b9bd6184d6..33f3a18eb0ef90bc71f1f40c3fd057cc
|
||||
+ } else {
|
||||
+ // "STRICT" merges entities with the same properties, position, momentum and OOE.
|
||||
+ // This is considered safe to use, and will not break cannon mechanics.
|
||||
+ if (mergeLevel.atLeast(me.samsuik.sakura.entity.merge.MergeLevel.STRICT) && compareState(entity)) {
|
||||
+ if (this.mergeLevel.atLeast(me.samsuik.sakura.entity.merge.MergeLevel.STRICT) && this.compareState(entity)) {
|
||||
+ mergeEntity = entity;
|
||||
+ }
|
||||
+
|
||||
+ // "LENIENT" merges entities aggressively by tracking the entities that have
|
||||
+ // previously merged. This is a hybrid of "SPAWN" and "STRICT" merging, with the
|
||||
+ // visuals of "STRICT" merging and better merging potential of "SPAWN" merging.
|
||||
+ if (mergeLevel.atLeast(me.samsuik.sakura.entity.merge.MergeLevel.LENIENT) && mergeEntity == null && originData != null) {
|
||||
+ mergeEntity = originData.findFirstEntityInSamePosition(this);
|
||||
+ if (this.mergeLevel.atLeast(me.samsuik.sakura.entity.merge.MergeLevel.LENIENT) && mergeEntity == null && this.originData != null) {
|
||||
+ mergeEntity = this.originData.findFirstEntityInSamePosition(this);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (mergeEntity != null && isSafeToMergeInto(mergeEntity)) {
|
||||
+ mergeInto(mergeEntity);
|
||||
+ if (mergeEntity != null && this.isSafeToMergeInto(mergeEntity)) {
|
||||
+ this.mergeInto(mergeEntity);
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
@@ -310,8 +307,8 @@ index 2946d081032f6d8481643b43420f23b9bd6184d6..33f3a18eb0ef90bc71f1f40c3fd057cc
|
||||
+
|
||||
+ private void mergeInto(Entity entity) {
|
||||
+ entity.mergeList.add(this);
|
||||
+ entity.mergeList.addAll(mergeList);
|
||||
+ entity.stacked += stacked;
|
||||
+ entity.mergeList.addAll(this.mergeList);
|
||||
+ entity.stacked += this.stacked;
|
||||
+
|
||||
+ for (Entity mergedEntity : this.mergeList) {
|
||||
+ mergedEntity.updateEntityHandle(entity);
|
||||
@@ -335,17 +332,17 @@ index 2946d081032f6d8481643b43420f23b9bd6184d6..33f3a18eb0ef90bc71f1f40c3fd057cc
|
||||
+ }
|
||||
+ // Sakura end - cannon entity merging
|
||||
|
||||
public Entity(EntityType<?> type, Level world) {
|
||||
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
|
||||
@@ -611,6 +729,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
// Paper start
|
||||
/**
|
||||
@@ -548,6 +663,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
this.getEntityData().registrationLocked = true; // Spigot
|
||||
this.setPos(0.0D, 0.0D, 0.0D);
|
||||
this.eyeHeight = this.getEyeHeight(net.minecraft.world.entity.Pose.STANDING, this.dimensions);
|
||||
+ this.mergeLevel = level.sakuraConfig().cannons.mergeLevel; // Sakura
|
||||
+ this.mergeLevel = this.level.sakuraConfig.mergeLevel; // Sakura
|
||||
}
|
||||
|
||||
public boolean isColliding(BlockPos pos, BlockState state) {
|
||||
@@ -2317,6 +2436,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -2194,6 +2310,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
nbt.putBoolean("Paper.FreezeLock", true);
|
||||
}
|
||||
// Paper end
|
||||
@@ -357,7 +354,7 @@ index 2946d081032f6d8481643b43420f23b9bd6184d6..33f3a18eb0ef90bc71f1f40c3fd057cc
|
||||
return nbt;
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
|
||||
@@ -2484,6 +2608,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -2359,6 +2480,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
freezeLocked = nbt.getBoolean("Paper.FreezeLock");
|
||||
}
|
||||
// Paper end
|
||||
@@ -369,10 +366,10 @@ index 2946d081032f6d8481643b43420f23b9bd6184d6..33f3a18eb0ef90bc71f1f40c3fd057cc
|
||||
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
|
||||
@@ -4529,6 +4658,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
return;
|
||||
}
|
||||
// Paper end - rewrite chunk system
|
||||
@@ -4306,6 +4432,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
|
||||
@Override
|
||||
public final void setRemoved(Entity.RemovalReason reason) {
|
||||
+ // Sakura start
|
||||
+ if (reason == RemovalReason.DISCARDED && !mergeList.isEmpty()) {
|
||||
+ level.mergeHistory.markPositions(this);
|
||||
@@ -382,10 +379,10 @@ index 2946d081032f6d8481643b43420f23b9bd6184d6..33f3a18eb0ef90bc71f1f40c3fd057cc
|
||||
this.removalReason = reason;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
index 6b85eecde57a809391d531bb11d189d0a25ccfdc..2965d963ca7eaf7bfd010094c08aa8b80af79a13 100644
|
||||
index 39b27750df3c93c3b6481d1663b854750ee646db..229477058eb28798edf684dffe3640aab87bc189 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
@@ -129,6 +129,60 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -127,6 +127,60 @@ public class FallingBlockEntity extends Entity {
|
||||
return !this.isRemoved();
|
||||
}
|
||||
|
||||
@@ -446,7 +443,7 @@ index 6b85eecde57a809391d531bb11d189d0a25ccfdc..2965d963ca7eaf7bfd010094c08aa8b8
|
||||
@Override
|
||||
public void tick() {
|
||||
// Paper start - fix sand duping
|
||||
@@ -208,6 +262,7 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -206,6 +260,7 @@ public class FallingBlockEntity extends Entity {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
@@ -455,10 +452,10 @@ index 6b85eecde57a809391d531bb11d189d0a25ccfdc..2965d963ca7eaf7bfd010094c08aa8b8
|
||||
((ServerLevel) this.level).getChunkSource().chunkMap.broadcast(this, new ClientboundBlockUpdatePacket(blockposition, this.level.getBlockState(blockposition)));
|
||||
this.discard();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
index c2f04fca63ebef48a3092b60c703277abcb9b586..b9ee3115ea6f2929d8cd66ab189acc1614126574 100644
|
||||
index 6a97e77b81359a6722293837088c01b6618a0976..0c75fe840119040898a10a931dcb9b3e51c8cdcf 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
@@ -59,6 +59,44 @@ public class PrimedTnt extends Entity {
|
||||
@@ -62,6 +62,44 @@ public class PrimedTnt extends Entity {
|
||||
return !this.isRemoved();
|
||||
}
|
||||
|
||||
@@ -503,7 +500,7 @@ index c2f04fca63ebef48a3092b60c703277abcb9b586..b9ee3115ea6f2929d8cd66ab189acc16
|
||||
@Override
|
||||
public void tick() {
|
||||
if (level.spigotConfig.maxTntTicksPerTick > 0 && ++level.spigotConfig.currentPrimedTnt > level.spigotConfig.maxTntTicksPerTick) {
|
||||
@@ -86,6 +124,7 @@ public class PrimedTnt extends Entity {
|
||||
@@ -89,6 +127,7 @@ public class PrimedTnt extends Entity {
|
||||
if (i <= 0) {
|
||||
// CraftBukkit start - Need to reverse the order of the explosion and the entity death so we have a location for the event
|
||||
// this.discard();
|
||||
@@ -512,19 +509,19 @@ index c2f04fca63ebef48a3092b60c703277abcb9b586..b9ee3115ea6f2929d8cd66ab189acc16
|
||||
this.explode();
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index d80cdbbd9cd569e6db31950f05695c1cf476be3c..05ee07f06721b16801ae7420da7705b64db52eed 100644
|
||||
index ff6c4664c22aca6a7be44e3ccb7bff543c6a2a1b..894d920305302127b5cf9ee2bfba239475e76144 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -283,6 +283,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
public abstract ResourceKey<LevelStem> getTypeKey();
|
||||
|
||||
@@ -266,6 +266,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
}
|
||||
// Sakura end
|
||||
public final it.unimi.dsi.fastutil.longs.Long2IntMap minimalTNT = new it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap(); // Sakura - visibility api
|
||||
+ public final me.samsuik.sakura.entity.merge.MergeHistory mergeHistory = new me.samsuik.sakura.entity.merge.MergeHistory(); // Sakura - cannon entity merging
|
||||
|
||||
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, Supplier<me.samsuik.sakura.configuration.WorldConfiguration> sakuraWorldConfigCreator, java.util.concurrent.Executor executor) { // Sakura // Paper - Async-Anti-Xray - Pass executor
|
||||
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
|
||||
public abstract ResourceKey<LevelStem> getTypeKey();
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java b/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java
|
||||
index caa0fbe5cad9cdc11d6e4af92bc627990cd8204c..6923a34e82e49004b29a77e57fea8c2a00180299 100644
|
||||
index 9d1d59fe26eff0640906037aba93e73dda433d0d..f44d79ed9f3b93712ce8b40c020955d19ec8fb9d 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java
|
||||
@@ -79,7 +79,7 @@ public abstract class BasePressurePlateBlock extends Block {
|
||||
@@ -536,7 +533,7 @@ index caa0fbe5cad9cdc11d6e4af92bc627990cd8204c..6923a34e82e49004b29a77e57fea8c2a
|
||||
boolean flag = output > 0;
|
||||
boolean flag1 = j > 0;
|
||||
|
||||
@@ -158,6 +158,12 @@ public abstract class BasePressurePlateBlock extends Block {
|
||||
@@ -170,6 +170,12 @@ public abstract class BasePressurePlateBlock extends Block {
|
||||
return PushReaction.DESTROY;
|
||||
}
|
||||
|
||||
@@ -550,10 +547,10 @@ index caa0fbe5cad9cdc11d6e4af92bc627990cd8204c..6923a34e82e49004b29a77e57fea8c2a
|
||||
|
||||
protected abstract int getSignalForState(BlockState state);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/WeightedPressurePlateBlock.java b/src/main/java/net/minecraft/world/level/block/WeightedPressurePlateBlock.java
|
||||
index e3bcb7fc520abcb1854d89b65ebc947cc885caa6..f9786ba3bead763e4f880b99e0e0cae64fb62613 100644
|
||||
index fe343966b9e30ff3487579b46d4b005be3d76b63..6bac29219028a91fa49a79b9bb5513b50d896770 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/WeightedPressurePlateBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/WeightedPressurePlateBlock.java
|
||||
@@ -32,6 +32,11 @@ public class WeightedPressurePlateBlock extends BasePressurePlateBlock {
|
||||
@@ -28,6 +28,11 @@ public class WeightedPressurePlateBlock extends BasePressurePlateBlock {
|
||||
|
||||
@Override
|
||||
protected int getSignalStrength(Level world, BlockPos pos) {
|
||||
@@ -565,7 +562,7 @@ index e3bcb7fc520abcb1854d89b65ebc947cc885caa6..f9786ba3bead763e4f880b99e0e0cae6
|
||||
// CraftBukkit start
|
||||
// int i = Math.min(world.getEntitiesOfClass(Entity.class, BlockPressurePlateWeighted.TOUCH_AABB.move(blockposition)).size(), this.maxWeight);
|
||||
int i = 0;
|
||||
@@ -51,7 +56,7 @@ public class WeightedPressurePlateBlock extends BasePressurePlateBlock {
|
||||
@@ -47,7 +52,7 @@ public class WeightedPressurePlateBlock extends BasePressurePlateBlock {
|
||||
|
||||
// We only want to block turning the plate on if all events are cancelled
|
||||
if (!cancellable.isCancelled()) {
|
||||
@@ -129,10 +129,10 @@ index 0000000000000000000000000000000000000000..d7e24638f07f243502004970ab4ce646
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 1358f800a29ef15163442331100816bb418ae3f6..f14abf532e9cd80e0a270826143c7489a4f4a5e4 100644
|
||||
index 536dd6fd0317779e04f133d2ae32a251da9e4394..532abec1030f28df6ee0629ca3aef2766311bd99 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1568,6 +1568,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1621,6 +1621,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
worldserver.localConfig().expire(currentTickLong); // Sakura
|
||||
worldserver.minimalTNT.clear(); // Sakura - visibility api
|
||||
worldserver.mergeHistory.expire(currentTickLong); // Sakura - merge cannoning entities
|
||||
@@ -141,10 +141,10 @@ index 1358f800a29ef15163442331100816bb418ae3f6..f14abf532e9cd80e0a270826143c7489
|
||||
this.isIteratingOverLevels = false; // Paper
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index 7924adff65f0fa4ce4e1c1b4d8632a4c3c55d52f..212d0a2d61e8d8515820d85c511937bd17679c71 100644
|
||||
index 2301773137d004b1fbfa030caea6a4f436d1beae..8ef317a79db184db69b2a699c280b5c7c2663259 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -309,7 +309,16 @@ public class Explosion {
|
||||
@@ -317,7 +317,16 @@ public class Explosion {
|
||||
double d10 = Mth.lerp(d7, axisalignedbb.minZ, axisalignedbb.maxZ);
|
||||
Vec3 vec3d1 = new Vec3(d8 + d3, d9, d10 + d4);
|
||||
|
||||
@@ -162,23 +162,23 @@ index 7924adff65f0fa4ce4e1c1b4d8632a4c3c55d52f..212d0a2d61e8d8515820d85c511937bd
|
||||
++i;
|
||||
}
|
||||
|
||||
@@ -501,6 +510,11 @@ public class Explosion {
|
||||
@@ -504,6 +513,11 @@ public class Explosion {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
+ // Sakura start - explosion density cache
|
||||
+ if (!this.toBlow.isEmpty() && !this.level.paperConfig().environment.optimizeExplosions) {
|
||||
+ if (!this.toBlow.isEmpty() && !this.level.paperConfig.optimizeExplosions) {
|
||||
+ this.level.densityCache.clear(-1);
|
||||
+ }
|
||||
+ // Sakura end - explosion density cache
|
||||
objectlistiterator = this.toBlow.iterator();
|
||||
iterator = this.toBlow.iterator();
|
||||
|
||||
while (objectlistiterator.hasNext()) {
|
||||
@@ -654,14 +668,12 @@ public class Explosion {
|
||||
while (iterator.hasNext()) {
|
||||
@@ -627,14 +641,12 @@ public class Explosion {
|
||||
}
|
||||
// Paper start - Optimize explosions
|
||||
private float getBlockDensity(Vec3 vec3d, Entity entity) {
|
||||
- if (!this.level.paperConfig().environment.optimizeExplosions) {
|
||||
- if (!this.level.paperConfig.optimizeExplosions) {
|
||||
- return getSeenPercent(vec3d, entity);
|
||||
- }
|
||||
- CacheKey key = new CacheKey(this, entity.getBoundingBox());
|
||||
@@ -195,19 +195,19 @@ index 7924adff65f0fa4ce4e1c1b4d8632a4c3c55d52f..212d0a2d61e8d8515820d85c511937bd
|
||||
|
||||
return blockDensity;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 05ee07f06721b16801ae7420da7705b64db52eed..66eeaa8941b4e10614e79d01bd9601d48aa44eb0 100644
|
||||
index 894d920305302127b5cf9ee2bfba239475e76144..b7407df002b7addf854a321f62c26003f7fdc86b 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -284,6 +284,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
|
||||
@@ -267,6 +267,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
// Sakura end
|
||||
public final it.unimi.dsi.fastutil.longs.Long2IntMap minimalTNT = new it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap(); // Sakura - visibility api
|
||||
public final me.samsuik.sakura.entity.merge.MergeHistory mergeHistory = new me.samsuik.sakura.entity.merge.MergeHistory(); // Sakura - cannon entity merging
|
||||
+ public final me.samsuik.sakura.explosion.density.BlockDensityCache densityCache = new me.samsuik.sakura.explosion.density.BlockDensityCache(); // Sakura - explosion density cache
|
||||
|
||||
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, Supplier<me.samsuik.sakura.configuration.WorldConfiguration> sakuraWorldConfigCreator, java.util.concurrent.Executor executor) { // Sakura // Paper - Async-Anti-Xray - Pass executor
|
||||
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
|
||||
public abstract ResourceKey<LevelStem> getTypeKey();
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java b/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java
|
||||
index 6923a34e82e49004b29a77e57fea8c2a00180299..56dce65e4d5070f7b08b07c4412ef95a54f3e1c7 100644
|
||||
index f44d79ed9f3b93712ce8b40c020955d19ec8fb9d..4c5dbc6a6a03c9504ca7de35462d369305b08edd 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java
|
||||
@@ -99,6 +99,11 @@ public abstract class BasePressurePlateBlock extends Block {
|
||||
@@ -223,10 +223,10 @@ index 6923a34e82e49004b29a77e57fea8c2a00180299..56dce65e4d5070f7b08b07c4412ef95a
|
||||
this.updateNeighbours(world, pos);
|
||||
world.setBlocksDirty(pos, state, iblockdata1);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
|
||||
index 004dce26ff073f1de52a84cd425c4f60fdab5e50..89928300608865a2cea6834fa0ac98a0796140e0 100644
|
||||
index 5e973eb53b240615e70b7d46ef4dc17b907ecaf9..5655aa0f5c91bb9c65a00d2f8a6fb6426d2a1c5d 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
|
||||
@@ -164,6 +164,11 @@ public class TripWireHookBlock extends Block {
|
||||
@@ -163,6 +163,11 @@ public class TripWireHookBlock extends Block {
|
||||
blockposition1 = pos.relative(enumdirection, j);
|
||||
Direction enumdirection1 = enumdirection.getOpposite();
|
||||
|
||||
@@ -237,7 +237,7 @@ index 004dce26ff073f1de52a84cd425c4f60fdab5e50..89928300608865a2cea6834fa0ac98a0
|
||||
+ // Sakura end - explosion density cache
|
||||
world.setBlock(blockposition1, (BlockState) iblockdata3.setValue(TripWireHookBlock.FACING, enumdirection1), 3);
|
||||
this.notifyNeighbors(world, blockposition1, enumdirection1);
|
||||
this.emitState(world, blockposition1, flag4, flag5, flag2, flag3);
|
||||
this.playSound(world, blockposition1, flag4, flag5, flag2, flag3);
|
||||
diff --git a/src/main/java/net/minecraft/world/phys/AABB.java b/src/main/java/net/minecraft/world/phys/AABB.java
|
||||
index 68cc6f2a78a06293a29317fda72ab3ee79b3533a..a142bf12ef0b8c8d41cab846da2e161700f2db2b 100644
|
||||
--- a/src/main/java/net/minecraft/world/phys/AABB.java
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Optimise explosions in protected regions
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index becf60978e6c13ac5100886be1a6adae4d361207..a12ad5380bfbdba20c1c5e568da7b0cfac5a55db 100644
|
||||
index 8ef317a79db184db69b2a699c280b5c7c2663259..cf9dd1ffdacdfe1c26ca15ca17a20fe46a81b20d 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -281,6 +281,22 @@ public class Explosion {
|
||||
@@ -289,6 +289,22 @@ public class Explosion {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ index becf60978e6c13ac5100886be1a6adae4d361207..a12ad5380bfbdba20c1c5e568da7b0cf
|
||||
+ protected final boolean isRegionUnprotected() {
|
||||
+ // As an optimisation, check if a plugin has cancelled or cleared the blockList.
|
||||
+ // This is relatively sane on factions and cannon servers, but mileage may vary.
|
||||
+ if (this.source != null && this.level.sakuraConfig().cannons.explosion.optimiseProtectedRegions) {
|
||||
+ if (this.source != null && this.level.sakuraConfig.optimiseProtectedRegions) {
|
||||
+ Location location = new Location(this.level.getWorld(), this.x, this.y, this.z);
|
||||
+ List<org.bukkit.block.Block> blocks = new ObjectArrayList<>(1);
|
||||
+ blocks.add(location.getBlock());
|
||||
@@ -31,12 +31,12 @@ index becf60978e6c13ac5100886be1a6adae4d361207..a12ad5380bfbdba20c1c5e568da7b0cf
|
||||
private ExplosionDamageCalculator makeDamageCalculator(@Nullable Entity entity) {
|
||||
if (entity instanceof net.minecraft.world.entity.item.PrimedTnt) {
|
||||
return EXPLOSION_DAMAGE_CALCULATOR;
|
||||
@@ -350,7 +366,7 @@ public class Explosion {
|
||||
@@ -358,7 +374,7 @@ public class Explosion {
|
||||
BlockPos explosionBlockPos = new BlockPos(this.x, this.y, this.z);
|
||||
BlockState blockstate = this.level.getBlockState(explosionBlockPos);
|
||||
float resistance = blockstate.getBlock().getExplosionResistance();
|
||||
- if ((resistance + 0.3f) * 0.3f < (this.radius * 1.3f) && this.interactsWithBlocks()) {
|
||||
+ if ((resistance + 0.3f) * 0.3f < (this.radius * 1.3f) && this.interactsWithBlocks() && this.isRegionUnprotected()) { // Sakura - optimise protected explosions
|
||||
- if ((resistance + 0.3f) * 0.3f < (this.radius * 1.3f) && this.blockInteraction != Explosion.BlockInteraction.NONE) {
|
||||
+ if ((resistance + 0.3f) * 0.3f < (this.radius * 1.3f) && this.blockInteraction != Explosion.BlockInteraction.NONE && this.isRegionUnprotected()) { // Sakura - optimise protected explosions
|
||||
this.searchForBlocks();
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ index 0000000000000000000000000000000000000000..e654f48386e21e049facb6d90b356117
|
||||
+}
|
||||
diff --git a/src/main/java/me/samsuik/sakura/explosion/special/TntExplosion.java b/src/main/java/me/samsuik/sakura/explosion/special/TntExplosion.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..52c1990bd3bcfe0a3f6e70748fca42f3e3994da4
|
||||
index 0000000000000000000000000000000000000000..2e46df5cda2dc2812a10cd54ff7b128f9c50b361
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/samsuik/sakura/explosion/special/TntExplosion.java
|
||||
@@ -0,0 +1,192 @@
|
||||
@@ -297,7 +297,7 @@ index 0000000000000000000000000000000000000000..52c1990bd3bcfe0a3f6e70748fca42f3
|
||||
+ protected void postExplosion(List<BlockPos> foundBlocks, boolean destroyedBlocks) {
|
||||
+ // Update wrapped, this is for tracking swinging and if blocks are found
|
||||
+ if (this.wrapped >= 7) {
|
||||
+ if (!destroyedBlocks && this.level.sakuraConfig().cannons.explosion.avoidRedundantBlockSearches) {
|
||||
+ if (!destroyedBlocks && this.level.sakuraConfig.avoidRedundantBlockSearches) {
|
||||
+ this.wrapped++;
|
||||
+ } else {
|
||||
+ this.wrapped = 7;
|
||||
@@ -402,10 +402,10 @@ index 0000000000000000000000000000000000000000..52c1990bd3bcfe0a3f6e70748fca42f3
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 839ab14b901f7deae5c53626c16ff1e74b57a531..ab5472c27f94e196a2747466f8721173cef937fc 100644
|
||||
index 451f7facb950c98b67713d6e7d012bf25bb89e31..71f96f0716e6001ea74690d43160c08ca6a3024e 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -1752,6 +1752,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -1657,6 +1657,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
explosion.clearToBlow();
|
||||
}
|
||||
|
||||
@@ -418,7 +418,7 @@ index 839ab14b901f7deae5c53626c16ff1e74b57a531..ab5472c27f94e196a2747466f8721173
|
||||
Iterator iterator = this.players.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -1771,7 +1777,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -1676,7 +1682,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -428,10 +428,10 @@ index 839ab14b901f7deae5c53626c16ff1e74b57a531..ab5472c27f94e196a2747466f8721173
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
index b9ee3115ea6f2929d8cd66ab189acc1614126574..f3330d5219edfac9fd23b10e3f97e999fc3b5b0e 100644
|
||||
index 0c75fe840119040898a10a931dcb9b3e51c8cdcf..88f83ef060b818e31bbb636a45048b2cdb1d4fec 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
@@ -73,28 +73,7 @@ public class PrimedTnt extends Entity {
|
||||
@@ -76,28 +76,7 @@ public class PrimedTnt extends Entity {
|
||||
&& (tnt.entityState().fallDistance() == fallDistance
|
||||
|| tnt.entityState().fallDistance() > 2.5f && fallDistance > 2.5f);
|
||||
}
|
||||
@@ -462,12 +462,12 @@ index b9ee3115ea6f2929d8cd66ab189acc1614126574..f3330d5219edfac9fd23b10e3f97e999
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index 738015f5aa1e405623ad41ea4f039bde9a2ec572..74cd5133a7944ecb7ab76a4d1be3b77214b64161 100644
|
||||
index cf9dd1ffdacdfe1c26ca15ca17a20fe46a81b20d..a10d18a7573f9174708be0bf9dd912b8ce7eb0f5 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -55,12 +55,14 @@ public class Explosion {
|
||||
@@ -59,12 +59,14 @@ public class Explosion {
|
||||
private final Explosion.BlockInteraction blockInteraction;
|
||||
private final RandomSource random;
|
||||
private final Random random;
|
||||
private final Level level;
|
||||
- private final double x;
|
||||
- private final double y;
|
||||
@@ -483,11 +483,11 @@ index 738015f5aa1e405623ad41ea4f039bde9a2ec572..74cd5133a7944ecb7ab76a4d1be3b772
|
||||
+ protected final float radius; // Sakura - private -> protected
|
||||
private final DamageSource damageSource;
|
||||
private final ExplosionDamageCalculator damageCalculator;
|
||||
private final ObjectArrayList<BlockPos> toBlow;
|
||||
@@ -451,7 +453,10 @@ public class Explosion {
|
||||
private final List<BlockPos> toBlow;
|
||||
@@ -455,7 +457,10 @@ public class Explosion {
|
||||
Player entityhuman = (Player) entity;
|
||||
|
||||
if (!entityhuman.isSpectator() && (!entityhuman.isCreative() || !entityhuman.getAbilities().flying) && !level.paperConfig().environment.disableExplosionKnockback) { // Paper - Disable explosion knockback
|
||||
if (!entityhuman.isSpectator() && (!entityhuman.isCreative() || !entityhuman.getAbilities().flying) && !level.paperConfig.disableExplosionKnockback) { // Paper - Disable explosion knockback
|
||||
- this.hitPlayers.put(entityhuman, new Vec3(d8 * d13, d9 * d13, d10 * d13));
|
||||
+ // Sakura start - specialised explosions; tally player velocity
|
||||
+ final Vec3 explosionImpact = new Vec3(d8 * d13, d9 * d13, d10 * d13);
|
||||
@@ -496,7 +496,7 @@ index 738015f5aa1e405623ad41ea4f039bde9a2ec572..74cd5133a7944ecb7ab76a4d1be3b772
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -683,7 +688,7 @@ public class Explosion {
|
||||
@@ -656,7 +661,7 @@ public class Explosion {
|
||||
private BlockInteraction() {}
|
||||
}
|
||||
// Paper start - Optimize explosions
|
||||
@@ -506,22 +506,22 @@ index 738015f5aa1e405623ad41ea4f039bde9a2ec572..74cd5133a7944ecb7ab76a4d1be3b772
|
||||
float blockDensity = this.level.densityCache.getDensity(vec3d, entity);
|
||||
if (blockDensity == me.samsuik.sakura.explosion.density.BlockDensityCache.UNKNOWN_DENSITY) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 66eeaa8941b4e10614e79d01bd9601d48aa44eb0..5c3aa8335b47a8ac0956c6caed3569f9244f4bd6 100644
|
||||
index b7407df002b7addf854a321f62c26003f7fdc86b..cd770809cc3720b63681d447f3970ff59b6b4c61 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -1004,7 +1004,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -982,7 +982,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
}
|
||||
|
||||
Explosion.BlockInteraction explosion_effect1 = explosion_effect;
|
||||
- Explosion explosion = new Explosion(this, entity, damageSource, behavior, x, y, z, power, createFire, explosion_effect1);
|
||||
public Explosion explode(@Nullable Entity entity, @Nullable DamageSource damageSource, @Nullable ExplosionDamageCalculator behavior, double x, double y, double z, float power, boolean createFire, Explosion.BlockInteraction destructionType) {
|
||||
- Explosion explosion = new Explosion(this, entity, damageSource, behavior, x, y, z, power, createFire, destructionType);
|
||||
+ // Sakura start - specialised explosions
|
||||
+ final Explosion explosion;
|
||||
+ if (entity instanceof net.minecraft.world.entity.item.PrimedTnt tnt) {
|
||||
+ explosion = new me.samsuik.sakura.explosion.special.TntExplosion(this, tnt, damageSource, behavior, x, y, z, power, createFire, explosion_effect1);
|
||||
+ explosion = new me.samsuik.sakura.explosion.special.TntExplosion(this, tnt, damageSource, behavior, x, y, z, power, createFire, destructionType);
|
||||
+ } else {
|
||||
+ explosion = new Explosion(this, entity, damageSource, behavior, x, y, z, power, createFire, explosion_effect1);
|
||||
+ explosion = new Explosion(this, entity, damageSource, behavior, x, y, z, power, createFire, destructionType);
|
||||
+ }
|
||||
+ // Sakura end - specialised explosions
|
||||
|
||||
explosion.explode();
|
||||
explosion.finalizeExplosion(particles);
|
||||
explosion.finalizeExplosion(true);
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Optimise Fast Movement
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 33f3a18eb0ef90bc71f1f40c3fd057cc50d22b2b..9c12e45314fccc48dc0b64e813afe75aab88c84a 100644
|
||||
index ff25112e1a270f32faf8b0a885166dc57848b5cf..09c2513a49fde78e3376f3c62e743fb2b29c82e8 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -1142,6 +1142,92 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -1075,6 +1075,92 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
}
|
||||
// Paper end - detailed watchdog information
|
||||
|
||||
@@ -63,7 +63,7 @@ index 33f3a18eb0ef90bc71f1f40c3fd057cc50d22b2b..9c12e45314fccc48dc0b64e813afe75a
|
||||
+ }
|
||||
+
|
||||
+ this.onGround = this.verticalCollision && movement.y < 0.0D;
|
||||
+ BlockPos blockposition = this.getOnPosLegacy();
|
||||
+ BlockPos blockposition = this.getOnPos();
|
||||
+ BlockState iblockdata = this.level.getBlockState(blockposition);
|
||||
+
|
||||
+ this.checkFallDamage(vec3d1.y, this.onGround, iblockdata, blockposition);
|
||||
@@ -101,7 +101,7 @@ index 33f3a18eb0ef90bc71f1f40c3fd057cc50d22b2b..9c12e45314fccc48dc0b64e813afe75a
|
||||
public void move(MoverType movementType, Vec3 movement) {
|
||||
// Paper start - detailed watchdog information
|
||||
io.papermc.paper.util.TickThread.ensureTickThread("Cannot move an entity off-main");
|
||||
@@ -1494,6 +1580,88 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -1407,6 +1493,88 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
return offsetFactor;
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ index 33f3a18eb0ef90bc71f1f40c3fd057cc50d22b2b..9c12e45314fccc48dc0b64e813afe75a
|
||||
+ // Copied from the collide method below
|
||||
+ io.papermc.paper.util.CollisionUtil.getCollisions(
|
||||
+ this.level, this, collisionBox, bbList,
|
||||
+ this.loadChunks, this.level.paperConfig().chunks.preventMovingIntoUnloadedChunks, // Sakura - load chunks on movement
|
||||
+ this.loadChunks, this.level.paperConfig.preventMovingIntoUnloadedChunks, // Sakura - load chunks on movement
|
||||
+ false, this.loadChunks, false, null, null // Sakura - load chunks on movement
|
||||
+ );
|
||||
+ }
|
||||
@@ -191,10 +191,10 @@ index 33f3a18eb0ef90bc71f1f40c3fd057cc50d22b2b..9c12e45314fccc48dc0b64e813afe75a
|
||||
// Paper start - optimise collisions
|
||||
// This is a copy of vanilla's except that it uses strictly AABB math
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
index 2965d963ca7eaf7bfd010094c08aa8b80af79a13..33a247ac617c17e7c0cf1614ca485398c60ea579 100644
|
||||
index 229477058eb28798edf684dffe3640aab87bc189..8f02b04cb3193c3ed164193868d216f7320962f5 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
@@ -200,7 +200,7 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -198,7 +198,7 @@ public class FallingBlockEntity extends Entity {
|
||||
this.addDeltaMovement(0.0D, -0.04D, 0.0D); // Sakura - reduce movement allocations
|
||||
}
|
||||
|
||||
@@ -204,15 +204,15 @@ index 2965d963ca7eaf7bfd010094c08aa8b80af79a13..33a247ac617c17e7c0cf1614ca485398
|
||||
// Paper start - fix sand duping
|
||||
if (this.isRemoved()) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
index f3330d5219edfac9fd23b10e3f97e999fc3b5b0e..ab4bcf2383e060a348eb172d1b36310cbbe17f72 100644
|
||||
index 88f83ef060b818e31bbb636a45048b2cdb1d4fec..0a130c840a20d357c7375f94d36e83a8ea8a59ee 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
@@ -85,7 +85,7 @@ public class PrimedTnt extends Entity {
|
||||
@@ -88,7 +88,7 @@ public class PrimedTnt extends Entity {
|
||||
this.addDeltaMovement(0.0D, -0.04D, 0.0D); // Sakura - reduce movement allocations
|
||||
}
|
||||
|
||||
- this.move(MoverType.SELF, this.getDeltaMovement());
|
||||
+ this.moveBasic(MoverType.SELF, this.getDeltaMovement()); // Sakura - optimise simple entity movement
|
||||
// Paper start - Configurable TNT entity height nerf
|
||||
if (this.level.paperConfig().fixes.tntEntityHeightNerf.test(v -> this.getY() > v)) {
|
||||
if (this.level.paperConfig.entityTNTHeightNerf != 0 && this.getY() > this.level.paperConfig.entityTNTHeightNerf) {
|
||||
this.discard();
|
||||
@@ -5,18 +5,18 @@ Subject: [PATCH] isPushedByFluid API
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 9c12e45314fccc48dc0b64e813afe75aab88c84a..2f8a5f5434bdcf1d992df9cb2a3ee8028f395a53 100644
|
||||
index 09c2513a49fde78e3376f3c62e743fb2b29c82e8..587c5e456e47ab67b378800562e21545786957c4 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -683,6 +683,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -567,6 +567,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
}
|
||||
}
|
||||
// Sakura end - cannon entity merging
|
||||
+ public boolean pushedByFluid = true; // Sakura - entity pushed by fluid api
|
||||
|
||||
public Entity(EntityType<?> type, Level world) {
|
||||
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
|
||||
@@ -3955,7 +3956,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
// Paper start
|
||||
/**
|
||||
@@ -3791,7 +3792,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
}
|
||||
|
||||
public boolean isPushedByFluid() {
|
||||
@@ -26,10 +26,10 @@ index 9c12e45314fccc48dc0b64e813afe75aab88c84a..2f8a5f5434bdcf1d992df9cb2a3ee802
|
||||
|
||||
public static double getViewScale() {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index 750ac80eed6ba03e138dd4c03f57ddfe4a123276..b70fb77f360e970c689d7f996d479674f6de0d90 100644
|
||||
index a92755211e3d42934b5efaa3f201c6c19ab7d2b4..5704137d5f1d8cf43ecfe383ba1c54267eccdef6 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -523,6 +523,18 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
@@ -502,6 +502,18 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
return this.entity.isInWater();
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Cannon Mechanics
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
index 33a247ac617c17e7c0cf1614ca485398c60ea579..ad8a3f5c41bcd2860d6872655b6b2ef25b6d349c 100644
|
||||
index 8f02b04cb3193c3ed164193868d216f7320962f5..3498e0dfb457445994f1a1ae20a0a6aaba7c82b5 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
@@ -64,6 +64,7 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -62,6 +62,7 @@ public class FallingBlockEntity extends Entity {
|
||||
public CompoundTag blockData;
|
||||
protected static final EntityDataAccessor<BlockPos> DATA_START_POS = SynchedEntityData.defineId(FallingBlockEntity.class, EntityDataSerializers.BLOCK_POS);
|
||||
public boolean autoExpire = true; // Paper - Auto expire setting
|
||||
@@ -16,50 +16,50 @@ index 33a247ac617c17e7c0cf1614ca485398c60ea579..ad8a3f5c41bcd2860d6872655b6b2ef2
|
||||
|
||||
public FallingBlockEntity(EntityType<? extends FallingBlockEntity> type, Level world) {
|
||||
super(type, world);
|
||||
@@ -72,6 +73,7 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -70,6 +71,7 @@ public class FallingBlockEntity extends Entity {
|
||||
this.fallDamageMax = 40;
|
||||
this.isFallingBlock = true; // Sakura
|
||||
this.loadChunks = world.sakuraConfig().cannons.loadChunks; // Sakura - falling blocks load chunks
|
||||
+ this.heightParity = world.sakuraConfig().cannons.mechanics.fallingBlockParity; // Sakura - configure cannon mechanics
|
||||
this.loadChunks = world.sakuraConfig.loadChunks; // Sakura - falling blocks load chunks
|
||||
+ this.heightParity = world.sakuraConfig.fallingBlockParity; // Sakura - configure cannon mechanics
|
||||
}
|
||||
|
||||
public FallingBlockEntity(Level world, double x, double y, double z, BlockState block) {
|
||||
@@ -182,6 +184,12 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -180,6 +182,12 @@ public class FallingBlockEntity extends Entity {
|
||||
return itemEntity;
|
||||
}
|
||||
// Sakura end
|
||||
+ // Sakura start
|
||||
+ @Override
|
||||
+ public final double getEyeY() {
|
||||
+ return heightParity ? getY() : super.getEyeY();
|
||||
+ return this.heightParity ? this.getY() : super.getEyeY();
|
||||
+ }
|
||||
+ // Sakura end
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
index ab4bcf2383e060a348eb172d1b36310cbbe17f72..683d44becb21689b95ba4babd235ee9199f4f6d8 100644
|
||||
index 0a130c840a20d357c7375f94d36e83a8ea8a59ee..c221dc8c1a271ec5b8ef8489274e9b1484aae03a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
@@ -42,6 +42,12 @@ public class PrimedTnt extends Entity {
|
||||
@@ -45,6 +45,12 @@ public class PrimedTnt extends Entity {
|
||||
this.yo = y;
|
||||
this.zo = z;
|
||||
this.owner = igniter;
|
||||
+ // Sakura start
|
||||
+ switch (world.sakuraConfig().cannons.mechanics.tntSpread) {
|
||||
+ case NONE -> multiplyDeltaMovement(0, 0, 0);
|
||||
+ case Y -> multiplyDeltaMovement(0, 1, 0);
|
||||
+ switch (world.sakuraConfig.tntSpread) {
|
||||
+ case NONE -> this.multiplyDeltaMovement(0, 0, 0);
|
||||
+ case Y -> this.multiplyDeltaMovement(0, 1, 0);
|
||||
+ }
|
||||
+ // Sakura end
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -199,7 +205,7 @@ public class PrimedTnt extends Entity {
|
||||
@@ -207,7 +213,7 @@ public class PrimedTnt extends Entity {
|
||||
// Paper start - Optional prevent TNT from moving in water
|
||||
@Override
|
||||
public boolean isPushedByFluid() {
|
||||
- return !level.paperConfig().fixes.preventTntFromMovingInWater && super.isPushedByFluid();
|
||||
+ return !level.paperConfig().fixes.preventTntFromMovingInWater && this.level.sakuraConfig().cannons.mechanics.tntFlowsInWater && super.isPushedByFluid(); // Sakura - cannon mechanics
|
||||
- return !level.paperConfig.preventTntFromMovingInWater && super.isPushedByFluid();
|
||||
+ return !level.paperConfig.preventTntFromMovingInWater && this.level.sakuraConfig.tntFlowsInWater && super.isPushedByFluid(); // Sakura - cannon mechanics
|
||||
}
|
||||
// Paper end
|
||||
}
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Cache MovingBlockEntity collision shape
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
|
||||
index 221c5d080d55326e458c1182823d6b49224ef498..26e11fbe0ddeed23d286e83adfa7d2a5e9cf88c8 100644
|
||||
index 94bd47212b05f66ebc81966eec3bc0abda76252c..e6361fd5ffd4ad908b6ade9ae7b1b52cc0a7c603 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
|
||||
@@ -43,6 +43,11 @@ public class PistonMovingBlockEntity extends BlockEntity {
|
||||
@@ -40,6 +40,11 @@ public class PistonMovingBlockEntity extends BlockEntity {
|
||||
private float progressO;
|
||||
private long lastTicked;
|
||||
private int deathTicks;
|
||||
@@ -20,7 +20,7 @@ index 221c5d080d55326e458c1182823d6b49224ef498..26e11fbe0ddeed23d286e83adfa7d2a5
|
||||
|
||||
public PistonMovingBlockEntity(BlockPos pos, BlockState state) {
|
||||
super(BlockEntityType.PISTON, pos, state);
|
||||
@@ -336,6 +341,18 @@ public class PistonMovingBlockEntity extends BlockEntity {
|
||||
@@ -332,6 +337,18 @@ public class PistonMovingBlockEntity extends BlockEntity {
|
||||
}
|
||||
|
||||
public VoxelShape getCollisionShape(BlockGetter world, BlockPos pos) {
|
||||
@@ -5,23 +5,23 @@ Subject: [PATCH] Optimise TNT fluid state and pushing
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 2f8a5f5434bdcf1d992df9cb2a3ee8028f395a53..16934f888e0a7609bd803bc988d5307e27eae793 100644
|
||||
index 587c5e456e47ab67b378800562e21545786957c4..c07a34f6b2a31f0235fd1b9ac9385b087d14ad57 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -2018,7 +2018,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -1918,7 +1918,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
return this.isInWater() || flag;
|
||||
}
|
||||
|
||||
- void updateInWaterStateAndDoWaterCurrentPushing() {
|
||||
+ protected void updateInWaterStateAndDoWaterCurrentPushing() { // Sakura
|
||||
Entity entity = this.getVehicle();
|
||||
|
||||
if (entity instanceof Boat) {
|
||||
if (this.getVehicle() instanceof Boat) {
|
||||
this.wasTouchingWater = false;
|
||||
} else if (this.updateFluidHeightAndDoFluidPushing(FluidTags.WATER, 0.014D)) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
index 683d44becb21689b95ba4babd235ee9199f4f6d8..bf6d7411716ff73c2f65965ec9bc33f70f719e19 100644
|
||||
index c221dc8c1a271ec5b8ef8489274e9b1484aae03a..92fe040d9b43cb2a2ff8118335eaa007c0828115 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
@@ -81,6 +81,19 @@ public class PrimedTnt extends Entity {
|
||||
@@ -84,6 +84,19 @@ public class PrimedTnt extends Entity {
|
||||
}
|
||||
// Sakura - specialised explosions
|
||||
// Sakura end
|
||||
@@ -5,15 +5,15 @@ Subject: [PATCH] Despawn falling blocks inside moving pistons
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
index ad8a3f5c41bcd2860d6872655b6b2ef25b6d349c..e9e65c72f3bdd193ea5acf614c68a11f828ece10 100644
|
||||
index 3498e0dfb457445994f1a1ae20a0a6aaba7c82b5..2e7675905e2e826950cd6b4c930dbaa062feec56 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
@@ -241,7 +241,7 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -239,7 +239,7 @@ public class FallingBlockEntity extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
- if (!this.onGround && !flag1) {
|
||||
+ if (!this.onGround && !flag1 || this.level.sakuraConfig().cannons.sand.despawnInsideMovingPistons && autoExpire && this.time > 600) { // Sakura - allow falling blocks to despawn inside moving pistons
|
||||
+ if (!this.onGround && !flag1 || this.level.sakuraConfig.despawnInsideMovingPistons && autoExpire && this.time > 600) { // Sakura - allow falling blocks to despawn inside moving pistons
|
||||
if (!this.level.isClientSide && ((this.time > 100 && autoExpire) && (blockposition.getY() <= this.level.getMinBuildHeight() || blockposition.getY() > this.level.getMaxBuildHeight()) || (this.time > 600 && autoExpire))) { // Paper - Auto expire setting
|
||||
if (this.dropItem && this.level.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
|
||||
this.spawnAtLocation((ItemLike) block);
|
||||
@@ -5,33 +5,33 @@ Subject: [PATCH] Configure Entity Knockback
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index c10c3f46fe29733c4b7fab7dd6d68a76905488eb..3b4ba5c9e2aeab85f79a2d3a583017cd84f3c1cd 100644
|
||||
index d6ef140bcc35b10f78f2ec2f10c8a153395fc9df..5c967f9c77e75a84c4f584f729a00c4177082a8d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -1475,7 +1475,7 @@ public abstract class LivingEntity extends Entity {
|
||||
@@ -1436,7 +1436,7 @@ public abstract class LivingEntity extends Entity {
|
||||
}
|
||||
|
||||
this.hurtDir = (float) (Mth.atan2(d1, d0) * 57.2957763671875D - (double) this.getYRot());
|
||||
- this.knockback(0.4000000059604645D, d0, d1, entity1); // Paper
|
||||
+ this.knockback((float) this.level.sakuraConfig().players.knockback.baseKnockback, d0, d1, entity1); // Sakura - configure entity knockback
|
||||
- this.knockback(0.4000000059604645D, d0, d1, entity1);
|
||||
+ this.knockback((float) this.level.sakuraConfig.baseKnockback, d0, d1, entity1); // Sakura - configure entity knockback
|
||||
} else {
|
||||
this.hurtDir = (float) ((int) (Math.random() * 2.0D) * 180);
|
||||
}
|
||||
@@ -1522,7 +1522,7 @@ public abstract class LivingEntity extends Entity {
|
||||
@@ -1483,7 +1483,7 @@ public abstract class LivingEntity extends Entity {
|
||||
}
|
||||
|
||||
protected void blockedByShield(LivingEntity target) {
|
||||
- target.knockback(0.5D, target.getX() - this.getX(), target.getZ() - this.getZ(), this); // Paper
|
||||
+ target.knockback((float) this.level.sakuraConfig().players.knockback.shieldHitKnockback, target.getX() - this.getX(), target.getZ() - this.getZ(), this); // Sakura - configure entity knockback // Paper
|
||||
- target.knockback(0.5D, target.getX() - this.getX(), target.getZ() - this.getZ(), this);
|
||||
+ target.knockback((float) this.level.sakuraConfig.shieldHitKnockback, target.getX() - this.getX(), target.getZ() - this.getZ(), this); // Sakura - configure entity knockback
|
||||
}
|
||||
|
||||
private boolean checkTotemDeathProtection(DamageSource source) {
|
||||
@@ -1834,13 +1834,26 @@ public abstract class LivingEntity extends Entity {
|
||||
@@ -1793,13 +1793,26 @@ public abstract class LivingEntity extends Entity {
|
||||
}
|
||||
public void knockback(double strength, double x, double z, Entity knockingBackEntity) {
|
||||
// Paper end - add knockbacking entity parameter
|
||||
- strength *= 1.0D - this.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE);
|
||||
+ strength *= 1.0D - this.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE) * this.level.sakuraConfig().players.knockback.knockbackResistanceModifier; // Sakura - configure entity knockback
|
||||
+ strength *= 1.0D - this.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE) * this.level.sakuraConfig.knockbackResistanceModifier; // Sakura - configure entity knockback
|
||||
if (strength > 0.0D) {
|
||||
this.hasImpulse = true;
|
||||
Vec3 vec3d = this.getDeltaMovement();
|
||||
@@ -40,12 +40,12 @@ index c10c3f46fe29733c4b7fab7dd6d68a76905488eb..3b4ba5c9e2aeab85f79a2d3a583017cd
|
||||
- this.setDeltaMovement(vec3d.x / 2.0D - vec3d1.x, this.onGround ? Math.min(0.4D, vec3d.y / 2.0D + strength) : vec3d.y, vec3d.z / 2.0D - vec3d1.z);
|
||||
+ // Sakura start - configure entity knockback
|
||||
+ double velocityX = vec3d.x / 2.0D - vec3d1.x;
|
||||
+ double velocityY = vec3d.y / 2.0D + this.level.sakuraConfig().players.knockback.knockbackVertical.or(strength);
|
||||
+ double velocityY = vec3d.y / 2.0D + this.level.sakuraConfig.knockbackVertical.orElse(strength);
|
||||
+ double velocityZ = vec3d.z / 2.0D - vec3d1.z;
|
||||
+
|
||||
+ // this.onGround() ? Math.min(0.4D, vec3d.y / 2.0D + d0) : vec3d.y
|
||||
+ if (!this.level.sakuraConfig().players.knockback.verticalKnockbackRequireGround || this.onGround) {
|
||||
+ velocityY = Math.min(this.level.sakuraConfig().players.knockback.knockbackVerticalLimit, velocityY);
|
||||
+ if (!this.level.sakuraConfig.verticalKnockbackRequireGround || this.onGround) {
|
||||
+ velocityY = Math.min(this.level.sakuraConfig.knockbackVerticalLimit, velocityY);
|
||||
+ } else {
|
||||
+ velocityY = vec3d.y;
|
||||
+ }
|
||||
@@ -56,27 +56,27 @@ index c10c3f46fe29733c4b7fab7dd6d68a76905488eb..3b4ba5c9e2aeab85f79a2d3a583017cd
|
||||
Vec3 currentMovement = this.getDeltaMovement();
|
||||
org.bukkit.util.Vector delta = new org.bukkit.util.Vector(currentMovement.x - vec3d.x, currentMovement.y - vec3d.y, currentMovement.z - vec3d.z);
|
||||
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 407401198c21dd5887aa3b7d86cdb112ef369007..0807d9d33131bf36b02f075e2150eaf33774ad27 100644
|
||||
index 5c16235115a9233bce1f5b30bb020d105bdca3d1..92a7962edb01d5ef36a9e35cc0b6bacc879ccff2 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -183,6 +183,7 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -181,6 +181,7 @@ public abstract class Player extends LivingEntity {
|
||||
// Paper start
|
||||
public boolean affectsSpawning = true;
|
||||
public net.kyori.adventure.util.TriState flyingFallDamage = net.kyori.adventure.util.TriState.NOT_SET;
|
||||
// Paper end
|
||||
+ private long lastSprintKnockback = -1; // Sakura - configure entity knockback
|
||||
|
||||
// CraftBukkit start
|
||||
public boolean fauxSleeping;
|
||||
@@ -1265,7 +1266,7 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -1229,7 +1230,7 @@ public abstract class Player extends LivingEntity {
|
||||
byte b0 = 0;
|
||||
int i = b0 + EnchantmentHelper.getKnockbackBonus(this);
|
||||
|
||||
- if (this.isSprinting() && flag) {
|
||||
+ if (this.isSprinting() && (!this.level.sakuraConfig().players.knockback.sprinting.requireFullAttack || flag)) { // Sakura
|
||||
+ if (this.isSprinting() && (!this.level.sakuraConfig.sprintingRequireFullAttack || flag)) { // Sakura
|
||||
sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_KNOCKBACK, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility
|
||||
++i;
|
||||
flag1 = true;
|
||||
@@ -1315,10 +1316,26 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -1279,10 +1280,26 @@ public abstract class Player extends LivingEntity {
|
||||
|
||||
if (flag5) {
|
||||
if (i > 0) {
|
||||
@@ -88,8 +88,8 @@ index 407401198c21dd5887aa3b7d86cdb112ef369007..0807d9d33131bf36b02f075e2150eaf3
|
||||
+ long sinceLastKnockback = millis - this.lastSprintKnockback;
|
||||
+ if (flag1) { // attackHasExtraKnockback
|
||||
+ double knockbackToApply = 0.0;
|
||||
+ if (sinceLastKnockback >= this.level.sakuraConfig().players.knockback.sprinting.knockbackDelay.value().orElse(0)) {
|
||||
+ knockbackToApply = this.level.sakuraConfig().players.knockback.sprinting.extraKnockback;
|
||||
+ if (sinceLastKnockback >= this.level.sakuraConfig.sprintingKnockbackDelay.orElse(0)) {
|
||||
+ knockbackToApply = this.level.sakuraConfig.sprintingExtraKnockback;
|
||||
+ this.lastSprintKnockback = millis;
|
||||
+ }
|
||||
+ // -0.5 is to negate the vanilla sprinting knockback
|
||||
@@ -100,31 +100,31 @@ index 407401198c21dd5887aa3b7d86cdb112ef369007..0807d9d33131bf36b02f075e2150eaf3
|
||||
+ } else if (target instanceof LivingEntity) {
|
||||
+ ((LivingEntity) target).knockback((double) (extraKnockback), (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this); // Paper
|
||||
} else {
|
||||
- target.push((double) (-Mth.sin(this.getYRot() * 0.017453292F) * (float) i * 0.5F), 0.1D, (double) (Mth.cos(this.getYRot() * 0.017453292F) * (float) i * 0.5F), this); // Paper
|
||||
+ target.push((double) (-Mth.sin(this.getYRot() * 0.017453292F) * extraKnockback), 0.1D, (double) (Mth.cos(this.getYRot() * 0.017453292F) * extraKnockback), this); // Paper
|
||||
- target.push((double) (-Mth.sin(this.getYRot() * 0.017453292F) * (float) i * 0.5F), 0.1D, (double) (Mth.cos(this.getYRot() * 0.017453292F) * (float) i * 0.5F));
|
||||
+ target.push((double) (-Mth.sin(this.getYRot() * 0.017453292F) * extraKnockback), 0.1D, (double) (Mth.cos(this.getYRot() * 0.017453292F) * extraKnockback));
|
||||
+ // Sakura end - configure extra sprinting knockback
|
||||
}
|
||||
|
||||
this.setDeltaMovement(this.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D));
|
||||
@@ -1340,7 +1357,7 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -1304,7 +1321,7 @@ public abstract class Player extends LivingEntity {
|
||||
if (entityliving != this && entityliving != target && !this.isAlliedTo((Entity) entityliving) && (!(entityliving instanceof ArmorStand) || !((ArmorStand) entityliving).isMarker()) && this.distanceToSqr((Entity) entityliving) < 9.0D) {
|
||||
// CraftBukkit start - Only apply knockback if the damage hits
|
||||
if (entityliving.hurt(DamageSource.playerAttack(this).sweep().critical(flag2), f4)) { // Paper - add critical damage API
|
||||
- entityliving.knockback(0.4000000059604645D, (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this); // Paper
|
||||
+ entityliving.knockback((float) this.level.sakuraConfig().players.knockback.sweepingEdgeKnockback, (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this); // Sakura - configure entity knockback // Paper
|
||||
+ entityliving.knockback((float) this.level.sakuraConfig.sweepingEdgeKnockback, (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this); // Sakura - configure entity knockback // Paper
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
||||
index 15fb5ee374b19366ebb23181896fb943e95819f0..70016e105066a16d19ebdf631cc3ef0a03466e3a 100644
|
||||
index 3789a0db398766f0fbc9e5ac5bf4228a0a0dac88..5ad727d59f67a49c2ed5cb09be11c86e0b74d9f0 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
||||
@@ -291,6 +291,12 @@ public class FishingHook extends Projectile {
|
||||
@@ -290,6 +290,12 @@ public class FishingHook extends Projectile {
|
||||
this.setHookedEntity(entityHitResult.getEntity());
|
||||
}
|
||||
|
||||
+ // Sakura start - configure entity knockback
|
||||
+ if (this.level.sakuraConfig().players.knockback.fishingHooksApplyKnockback) {
|
||||
+ if (this.level.sakuraConfig.fishingHooksApplyKnockback) {
|
||||
+ Entity entity = entityHitResult.getEntity();
|
||||
+ entity.hurt(net.minecraft.world.damagesource.DamageSource.thrown(this, this.getOwner()), 0.0f);
|
||||
+ }
|
||||
@@ -74,10 +74,10 @@ index 0000000000000000000000000000000000000000..c58e52f7cc012babf4235e405e5fb501
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index f14abf532e9cd80e0a270826143c7489a4f4a5e4..bd62b4de0da6f30fa87333889b15857fffc48666 100644
|
||||
index 532abec1030f28df6ee0629ca3aef2766311bd99..4a2934ae818292b517e87d2cb7d113fea8ce3491 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1569,6 +1569,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1622,6 +1622,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
worldserver.minimalTNT.clear(); // Sakura - visibility api
|
||||
worldserver.mergeHistory.expire(currentTickLong); // Sakura - merge cannoning entities
|
||||
worldserver.densityCache.clear(currentTickLong); // Sakura - explosion density cache
|
||||
@@ -86,7 +86,7 @@ index f14abf532e9cd80e0a270826143c7489a4f4a5e4..bd62b4de0da6f30fa87333889b15857f
|
||||
this.isIteratingOverLevels = false; // Paper
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemNameBlockItem.java b/src/main/java/net/minecraft/world/item/ItemNameBlockItem.java
|
||||
index a8008c7550488be34b51f4280f5569170b1ebd1d..612487263020dea780ef5ff61444a3ac7a8f1270 100644
|
||||
index a8008c7550488be34b51f4280f5569170b1ebd1d..aad48952ee83dfbbc2d59f69ef325f09a69e44ea 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemNameBlockItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemNameBlockItem.java
|
||||
@@ -7,6 +7,33 @@ public class ItemNameBlockItem extends BlockItem {
|
||||
@@ -113,7 +113,7 @@ index a8008c7550488be34b51f4280f5569170b1ebd1d..612487263020dea780ef5ff61444a3ac
|
||||
+
|
||||
+ private void sendPotatoMessage(net.minecraft.world.entity.player.Player player, int remaining, int durability) {
|
||||
+ player.getBukkitEntity().sendMessage(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(
|
||||
+ me.samsuik.sakura.configuration.GlobalConfiguration.get().players.potatoMessage,
|
||||
+ me.samsuik.sakura.configuration.SakuraGlobalConfig.get().potatoMessage,
|
||||
+ net.kyori.adventure.text.minimessage.tag.resolver.Placeholder.unparsed("remaining", String.valueOf(remaining)),
|
||||
+ net.kyori.adventure.text.minimessage.tag.resolver.Placeholder.unparsed("durability", String.valueOf(durability))
|
||||
+ ));
|
||||
@@ -124,10 +124,10 @@ index a8008c7550488be34b51f4280f5569170b1ebd1d..612487263020dea780ef5ff61444a3ac
|
||||
public String getDescriptionId() {
|
||||
return this.getOrCreateDescriptionId();
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index 74cd5133a7944ecb7ab76a4d1be3b77214b64161..411a2eeb6e8fabf0b755e7938396e1e239ea1ff4 100644
|
||||
index a10d18a7573f9174708be0bf9dd912b8ce7eb0f5..09f6cff6b88e4297bd85e308c596b25bfe58d76a 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -217,8 +217,8 @@ public class Explosion {
|
||||
@@ -225,8 +225,8 @@ public class Explosion {
|
||||
}
|
||||
|
||||
mutableBlockPos.set(blockX, blockY, blockZ);
|
||||
@@ -138,7 +138,7 @@ index 74cd5133a7944ecb7ab76a4d1be3b77214b64161..411a2eeb6e8fabf0b755e7938396e1e2
|
||||
);
|
||||
|
||||
if (optional.isPresent()) {
|
||||
@@ -298,6 +298,20 @@ public class Explosion {
|
||||
@@ -306,6 +306,20 @@ public class Explosion {
|
||||
return true;
|
||||
}
|
||||
// Sakura end - optimise protected explosions
|
||||
@@ -148,7 +148,7 @@ index 74cd5133a7944ecb7ab76a4d1be3b77214b64161..411a2eeb6e8fabf0b755e7938396e1e2
|
||||
+ Block block = blockState.getBlock();
|
||||
+ me.samsuik.sakura.explosion.durable.DurableMaterial material = this.level.localConfig().config(pos).durableMaterials.get(block);
|
||||
+
|
||||
+ if (material != null && material.resistance() >= 0.0f && (this.level.sakuraConfig().cannons.explosion.allowNonTntBreakingDurableBlocks || this.source instanceof net.minecraft.world.entity.item.PrimedTnt)) {
|
||||
+ if (material != null && material.resistance() >= 0.0f && (this.level.sakuraConfig.allowNonTntBreakingDurableBlocks || this.source instanceof net.minecraft.world.entity.item.PrimedTnt)) {
|
||||
+ return Optional.of(material.resistance());
|
||||
+ }
|
||||
+ }
|
||||
@@ -159,16 +159,16 @@ index 74cd5133a7944ecb7ab76a4d1be3b77214b64161..411a2eeb6e8fabf0b755e7938396e1e2
|
||||
|
||||
private ExplosionDamageCalculator makeDamageCalculator(@Nullable Entity entity) {
|
||||
if (entity instanceof net.minecraft.world.entity.item.PrimedTnt) {
|
||||
@@ -542,6 +556,16 @@ public class Explosion {
|
||||
BlockPos blockposition = (BlockPos) objectlistiterator.next();
|
||||
@@ -545,6 +559,16 @@ public class Explosion {
|
||||
BlockPos blockposition = (BlockPos) iterator.next();
|
||||
BlockState iblockdata = this.level.getBlockState(blockposition);
|
||||
Block block = iblockdata.getBlock();
|
||||
+ // Sakura start - explosion durable blocks
|
||||
+ if (this.level.sakuraConfig().cannons.explosion.allowNonTntBreakingDurableBlocks || this.source instanceof net.minecraft.world.entity.item.PrimedTnt) {
|
||||
+ if (this.level.sakuraConfig.allowNonTntBreakingDurableBlocks || this.source instanceof net.minecraft.world.entity.item.PrimedTnt) {
|
||||
+ me.samsuik.sakura.explosion.durable.DurableMaterial material = this.level.localConfig().config(blockposition).durableMaterials.get(block);
|
||||
+
|
||||
+ if (material != null && material.durability() >= 0 && !this.level.durabilityManager.damage(blockposition, material)) {
|
||||
+ objectlistiterator.remove();
|
||||
+ iterator.remove();
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
@@ -177,14 +177,14 @@ index 74cd5133a7944ecb7ab76a4d1be3b77214b64161..411a2eeb6e8fabf0b755e7938396e1e2
|
||||
if (!iblockdata.isAir() && iblockdata.isDestroyable()) { // Paper
|
||||
BlockPos blockposition1 = blockposition.immutable();
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 562ce3115ff6814f52872eb0e36a95d255ea4187..f22a538e37835c0424b8f87c9bef1e6fd0764718 100644
|
||||
index cd770809cc3720b63681d447f3970ff59b6b4c61..4c4c709cf9e4a9d4d8b210e6160652ddbdac3dae 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -285,6 +285,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -268,6 +268,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
public final it.unimi.dsi.fastutil.longs.Long2IntMap minimalTNT = new it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap(); // Sakura - visibility api
|
||||
public final me.samsuik.sakura.entity.merge.MergeHistory mergeHistory = new me.samsuik.sakura.entity.merge.MergeHistory(); // Sakura - cannon entity merging
|
||||
public final me.samsuik.sakura.explosion.density.BlockDensityCache densityCache = new me.samsuik.sakura.explosion.density.BlockDensityCache(); // Sakura - explosion density cache
|
||||
+ public final me.samsuik.sakura.explosion.durable.DurableBlockManager durabilityManager = new me.samsuik.sakura.explosion.durable.DurableBlockManager(); // Sakura - explosion durable blocks
|
||||
|
||||
// Sakura start - add entity retrieval methods with search limits
|
||||
public void getLimitedEntities(Entity except, AABB box, Predicate<? super Entity> predicate, List<Entity> into, int limit, int search) {
|
||||
public abstract ResourceKey<LevelStem> getTypeKey();
|
||||
|
||||
@@ -5,15 +5,15 @@ Subject: [PATCH] Destroy Waterlogged Blocks
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index 411a2eeb6e8fabf0b755e7938396e1e239ea1ff4..06d6ed111de0349f4e4f382021f91056ae71fb86 100644
|
||||
index 09f6cff6b88e4297bd85e308c596b25bfe58d76a..d1a813d35fa624558b9ef8cc9fa0e1c5fb7c2423 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -307,6 +307,11 @@ public class Explosion {
|
||||
if (material != null && material.resistance() >= 0.0f && (this.level.sakuraConfig().cannons.explosion.allowNonTntBreakingDurableBlocks || this.source instanceof net.minecraft.world.entity.item.PrimedTnt)) {
|
||||
@@ -315,6 +315,11 @@ public class Explosion {
|
||||
if (material != null && material.resistance() >= 0.0f && (this.level.sakuraConfig.allowNonTntBreakingDurableBlocks || this.source instanceof net.minecraft.world.entity.item.PrimedTnt)) {
|
||||
return Optional.of(material.resistance());
|
||||
}
|
||||
+ // Sakura start - destroy water logged blocks
|
||||
+ if (!fluidState.isEmpty() && !(block instanceof net.minecraft.world.level.block.LiquidBlock) && this.level.sakuraConfig().cannons.explosion.destroyWaterloggedBlocks) {
|
||||
+ if (!fluidState.isEmpty() && !(block instanceof net.minecraft.world.level.block.LiquidBlock) && this.level.sakuraConfig.destroyWaterloggedBlocks) {
|
||||
+ return Optional.of(-0.3f);
|
||||
+ }
|
||||
+ // Sakura end - destroy water logged blocks
|
||||
@@ -5,15 +5,15 @@ Subject: [PATCH] Falling Block Stacking Restrictions
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
index e9e65c72f3bdd193ea5acf614c68a11f828ece10..abf1ddbb6f8fc6dd7dadf9c7a244863b1b89a473 100644
|
||||
index 2e7675905e2e826950cd6b4c930dbaa062feec56..8a55094ae2791707946cf1646eba42887ecce663 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
@@ -259,7 +259,7 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -257,7 +257,7 @@ public class FallingBlockEntity extends Entity {
|
||||
boolean flag3 = FallingBlock.isFree(this.level.getBlockState(blockposition.below())) && (!flag || !flag1);
|
||||
boolean flag4 = this.blockState.canSurvive(this.level, blockposition) && !flag3;
|
||||
|
||||
- if (flag2 && flag4) {
|
||||
+ if (flag2 && flag4 && this.level.sakuraConfig().cannons.sand.isFallingBlockInBounds(this)) { // Sakura
|
||||
+ if (flag2 && flag4 && this.level.sakuraConfig.isFallingBlockInBounds(this)) { // Sakura
|
||||
if (this.blockState.hasProperty(BlockStateProperties.WATERLOGGED) && this.level.getFluidState(blockposition).getType() == Fluids.WATER) {
|
||||
this.blockState = (BlockState) this.blockState.setValue(BlockStateProperties.WATERLOGGED, true);
|
||||
}
|
||||
@@ -5,17 +5,17 @@ Subject: [PATCH] Added list of ItemEntity's that ignore explosions
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
index f0ccdfbd7d7be8c6e302609accf8fe9cac8885c4..b0b0ccd50276919e799eaa93f75904216e8e98b4 100644
|
||||
index 336d753bbd836e2a08207c5e3d41acbe2b72543f..23a9496188fb0b482d170ef906631df0e6e62fd3 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
@@ -87,6 +87,17 @@ public class ItemEntity extends Entity {
|
||||
@@ -83,6 +83,17 @@ public class ItemEntity extends Entity {
|
||||
this.bobOffs = entity.bobOffs;
|
||||
}
|
||||
|
||||
+ // Sakura start
|
||||
+ @Override
|
||||
+ public boolean ignoreExplosion() {
|
||||
+ if (this.level.sakuraConfig().entity.items.explosionResistantItems.contains(this.getItem().getItem())) {
|
||||
+ if (this.level.sakuraConfig.explosionResistantItems.contains(this.getItem().getItem())) {
|
||||
+ return true;
|
||||
+ } else {
|
||||
+ return super.ignoreExplosion();
|
||||
@@ -24,5 +24,5 @@ index f0ccdfbd7d7be8c6e302609accf8fe9cac8885c4..b0b0ccd50276919e799eaa93f7590421
|
||||
+ // Sakura end
|
||||
+
|
||||
@Override
|
||||
public boolean dampensVibrations() {
|
||||
return this.getItem().is(ItemTags.DAMPENS_VIBRATIONS);
|
||||
public boolean occludesVibrations() {
|
||||
return this.getItem().is(ItemTags.OCCLUDES_VIBRATION_SIGNALS);
|
||||
@@ -5,15 +5,15 @@ Subject: [PATCH] Add option to disable entity ai
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
index 49b983064ea810382b6112f5dc7f93ba4e5710bd..36eeb27679b2d1868cc9dc77f0df0f80e3c7333f 100644
|
||||
index e3227a806d9e19923783122ea94ae19e7dbe71da..64837b382bb3a1570b9136a94008e2f8fadaa4b3 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -860,7 +860,7 @@ public abstract class Mob extends LivingEntity {
|
||||
@@ -825,7 +825,7 @@ public abstract class Mob extends LivingEntity {
|
||||
@Override
|
||||
protected final void serverAiStep() {
|
||||
++this.noActionTime;
|
||||
- if (!this.aware) { // Paper start - Allow nerfed mobs to jump, float and take water damage
|
||||
+ if (!this.aware || this.level.sakuraConfig().entity.disableMobAi) { // Sakura // Paper start - Allow nerfed mobs to jump, float and take water damage
|
||||
+ if (!this.aware || this.level.sakuraConfig.disableMobAi) { // Sakura // Paper start - Allow nerfed mobs to jump, float and take water damage
|
||||
if (goalFloat != null) {
|
||||
if (goalFloat.canUse()) goalFloat.tick();
|
||||
this.getJumpControl().tick();
|
||||
@@ -5,18 +5,18 @@ Subject: [PATCH] Consistent Explosion Radius
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index 06d6ed111de0349f4e4f382021f91056ae71fb86..0157727b9849e40d555460faf33e8a88da60ada9 100644
|
||||
index d1a813d35fa624558b9ef8cc9fa0e1c5fb7c2423..076d353e59757232bc2bb3a19dcb3d7ed70d5edd 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -68,6 +68,7 @@ public class Explosion {
|
||||
private final ObjectArrayList<BlockPos> toBlow;
|
||||
@@ -72,6 +72,7 @@ public class Explosion {
|
||||
private final List<BlockPos> toBlow;
|
||||
private final Map<Player, Vec3> hitPlayers;
|
||||
public boolean wasCanceled = false; // CraftBukkit - add field
|
||||
+ private final boolean consistentRadius; // Sakura - consistent explosion radius
|
||||
|
||||
public Explosion(Level world, @Nullable Entity entity, double x, double y, double z, float power, List<BlockPos> affectedBlocks) {
|
||||
this(world, entity, x, y, z, power, false, Explosion.BlockInteraction.DESTROY_WITH_DECAY, affectedBlocks);
|
||||
@@ -96,6 +97,7 @@ public class Explosion {
|
||||
public Explosion(Level world, @Nullable Entity entity, double x, double y, double z, float power) {
|
||||
this(world, entity, x, y, z, power, false, Explosion.BlockInteraction.DESTROY);
|
||||
@@ -104,6 +105,7 @@ public class Explosion {
|
||||
this.blockInteraction = destructionType;
|
||||
this.damageSource = damageSource == null ? DamageSource.explosion(this) : damageSource;
|
||||
this.damageCalculator = behavior == null ? this.makeDamageCalculator(entity) : behavior;
|
||||
@@ -24,7 +24,7 @@ index 06d6ed111de0349f4e4f382021f91056ae71fb86..0157727b9849e40d555460faf33e8a88
|
||||
}
|
||||
|
||||
// Sakura start - optimise vanilla explosions
|
||||
@@ -172,7 +174,7 @@ public class Explosion {
|
||||
@@ -180,7 +182,7 @@ public class Explosion {
|
||||
double rayY = explosionRays[ray++];
|
||||
double rayZ = explosionRays[ray++];
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Remove spigot max tnt per tick
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
index bf6d7411716ff73c2f65965ec9bc33f70f719e19..0aed01b24e17aed7f5f7845ced78f64f57cabac3 100644
|
||||
index 92fe040d9b43cb2a2ff8118335eaa007c0828115..e97729f2d8febac1740678840566f8beb4f07cdc 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
@@ -97,9 +97,7 @@ public class PrimedTnt extends Entity {
|
||||
@@ -100,9 +100,7 @@ public class PrimedTnt extends Entity {
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Option to configure entity water sensitivity
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 3b4ba5c9e2aeab85f79a2d3a583017cd84f3c1cd..691f2c1d00d3cb17af017c997b11525709d6cd15 100644
|
||||
index 5c967f9c77e75a84c4f584f729a00c4177082a8d..94a98385742888544815e24ff39338f604d4ca86 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3458,7 +3458,7 @@ public abstract class LivingEntity extends Entity {
|
||||
@@ -3371,7 +3371,7 @@ public abstract class LivingEntity extends Entity {
|
||||
}
|
||||
}
|
||||
// Paper end
|
||||
@@ -57,7 +57,7 @@ index e654f48386e21e049facb6d90b356117af2bace6..a6b4cae3f04cda71629b5da3a08a8c4c
|
||||
if (distance != 0.0D) {
|
||||
x /= distance;
|
||||
diff --git a/src/main/java/me/samsuik/sakura/explosion/special/TntExplosion.java b/src/main/java/me/samsuik/sakura/explosion/special/TntExplosion.java
|
||||
index 52c1990bd3bcfe0a3f6e70748fca42f3e3994da4..49a698d9e5559aac4943b4b0ae3ced1305717f3c 100644
|
||||
index 2e46df5cda2dc2812a10cd54ff7b128f9c50b361..901f49d09886edf6afcb814cd5ab8de2e089b896 100644
|
||||
--- a/src/main/java/me/samsuik/sakura/explosion/special/TntExplosion.java
|
||||
+++ b/src/main/java/me/samsuik/sakura/explosion/special/TntExplosion.java
|
||||
@@ -34,6 +34,13 @@ public final class TntExplosion extends SpecialisedExplosion<PrimedTnt> {
|
||||
@@ -75,10 +75,10 @@ index 52c1990bd3bcfe0a3f6e70748fca42f3e3994da4..49a698d9e5559aac4943b4b0ae3ced13
|
||||
protected void startExplosion() {
|
||||
for (int i = this.calculateExplosionPotential() - 1; i >= 0; --i) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 16934f888e0a7609bd803bc988d5307e27eae793..4b35f249ee880e07acd0e0b642e86f6486a6ded8 100644
|
||||
index c07a34f6b2a31f0235fd1b9ac9385b087d14ad57..2f9a4f0d458edfbff5979f9cde39eae1f8f922fb 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -362,7 +362,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -301,7 +301,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
private final double[] pistonDeltas;
|
||||
private long pistonDeltasGameTime;
|
||||
private EntityDimensions dimensions;
|
||||
@@ -87,7 +87,7 @@ index 16934f888e0a7609bd803bc988d5307e27eae793..4b35f249ee880e07acd0e0b642e86f64
|
||||
public boolean isInPowderSnow;
|
||||
public boolean wasInPowderSnow;
|
||||
public boolean wasOnFire;
|
||||
@@ -684,6 +684,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -568,6 +568,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
}
|
||||
// Sakura end - cannon entity merging
|
||||
public boolean pushedByFluid = true; // Sakura - entity pushed by fluid api
|
||||
@@ -99,9 +99,9 @@ index 16934f888e0a7609bd803bc988d5307e27eae793..4b35f249ee880e07acd0e0b642e86f64
|
||||
+ }
|
||||
+ // Sakura end - physics version api
|
||||
|
||||
public Entity(EntityType<?> type, Level world) {
|
||||
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
|
||||
@@ -1149,7 +1156,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
// Paper start
|
||||
/**
|
||||
@@ -1082,7 +1089,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
if (this.noPhysics) {
|
||||
this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z);
|
||||
} else {
|
||||
@@ -110,7 +110,7 @@ index 16934f888e0a7609bd803bc988d5307e27eae793..4b35f249ee880e07acd0e0b642e86f64
|
||||
movement = this.limitPistonMovement(movement);
|
||||
if (movement.equals(Vec3.ZERO)) {
|
||||
return;
|
||||
@@ -1167,8 +1174,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -1100,8 +1107,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
Vec3 vec3d1 = this.collideScan(movement);
|
||||
double d0 = vec3d1.lengthSqr();
|
||||
|
||||
@@ -121,7 +121,7 @@ index 16934f888e0a7609bd803bc988d5307e27eae793..4b35f249ee880e07acd0e0b642e86f64
|
||||
BlockHitResult movingobjectpositionblock = this.level.clip(new ClipContext(this.position(), this.position().add(vec3d1), ClipContext.Block.FALLDAMAGE_RESETTING, ClipContext.Fluid.WATER, this));
|
||||
|
||||
if (movingobjectpositionblock.getType() != HitResult.Type.MISS) {
|
||||
@@ -1204,6 +1211,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -1137,6 +1144,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
if (this.horizontalCollision) {
|
||||
Vec3 vec3d2 = this.getDeltaMovement();
|
||||
|
||||
@@ -134,7 +134,7 @@ index 16934f888e0a7609bd803bc988d5307e27eae793..4b35f249ee880e07acd0e0b642e86f64
|
||||
this.setDeltaMovement(flag ? 0.0D : vec3d2.x, vec3d2.y, flag1 ? 0.0D : vec3d2.z);
|
||||
}
|
||||
|
||||
@@ -1244,7 +1257,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -1177,7 +1190,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z);
|
||||
} else {
|
||||
this.wasOnFire = this.isOnFire();
|
||||
@@ -143,7 +143,7 @@ index 16934f888e0a7609bd803bc988d5307e27eae793..4b35f249ee880e07acd0e0b642e86f64
|
||||
this.activatedTick = Math.max(this.activatedTick, MinecraftServer.currentTick + 20); // Paper
|
||||
this.activatedImmunityTick = Math.max(this.activatedImmunityTick, MinecraftServer.currentTick + 20); // Paper
|
||||
movement = this.limitPistonMovement(movement);
|
||||
@@ -1271,8 +1284,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -1204,8 +1217,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
Vec3 vec3d1 = this.collide(movement);
|
||||
double d0 = vec3d1.lengthSqr();
|
||||
|
||||
@@ -154,7 +154,7 @@ index 16934f888e0a7609bd803bc988d5307e27eae793..4b35f249ee880e07acd0e0b642e86f64
|
||||
BlockHitResult movingobjectpositionblock = this.level.clip(new ClipContext(this.position(), this.position().add(vec3d1), ClipContext.Block.FALLDAMAGE_RESETTING, ClipContext.Fluid.WATER, this));
|
||||
|
||||
if (movingobjectpositionblock.getType() != HitResult.Type.MISS) {
|
||||
@@ -1308,6 +1321,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -1241,6 +1254,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
if (this.horizontalCollision) {
|
||||
Vec3 vec3d2 = this.getDeltaMovement();
|
||||
|
||||
@@ -167,7 +167,7 @@ index 16934f888e0a7609bd803bc988d5307e27eae793..4b35f249ee880e07acd0e0b642e86f64
|
||||
this.setDeltaMovement(flag ? 0.0D : vec3d2.x, vec3d2.y, flag1 ? 0.0D : vec3d2.z);
|
||||
}
|
||||
|
||||
@@ -1596,7 +1615,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -1509,7 +1528,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
} else {
|
||||
final AABB bb = currBoundingBox.expandTowards(movement.x, movement.y, movement.z);
|
||||
this.collectCollisions(bb, potentialCollisionsBB);
|
||||
@@ -176,7 +176,7 @@ index 16934f888e0a7609bd803bc988d5307e27eae793..4b35f249ee880e07acd0e0b642e86f64
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1605,7 +1624,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -1518,7 +1537,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
double y = movement.y;
|
||||
double z = movement.z;
|
||||
|
||||
@@ -188,7 +188,7 @@ index 16934f888e0a7609bd803bc988d5307e27eae793..4b35f249ee880e07acd0e0b642e86f64
|
||||
|
||||
if (y != 0.0) {
|
||||
y = this.scanY(currBoundingBox, y, bbList);
|
||||
@@ -1708,7 +1730,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -1621,7 +1643,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
io.papermc.paper.util.CollisionUtil.addBoxesToIfIntersects(world.getWorldBorder().getCollisionShape(), collisionBox, potentialCollisions);
|
||||
}
|
||||
|
||||
@@ -197,25 +197,11 @@ index 16934f888e0a7609bd803bc988d5307e27eae793..4b35f249ee880e07acd0e0b642e86f64
|
||||
|
||||
if (stepHeight > 0.0
|
||||
&& (this.onGround || (limitedMoveVector.y != movement.y && movement.y < 0.0))
|
||||
@@ -1827,8 +1849,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
|
||||
protected void checkInsideBlocks() {
|
||||
AABB axisalignedbb = this.getBoundingBox();
|
||||
- BlockPos blockposition = new BlockPos(axisalignedbb.minX + 1.0E-7D, axisalignedbb.minY + 1.0E-7D, axisalignedbb.minZ + 1.0E-7D);
|
||||
- BlockPos blockposition1 = new BlockPos(axisalignedbb.maxX - 1.0E-7D, axisalignedbb.maxY - 1.0E-7D, axisalignedbb.maxZ - 1.0E-7D);
|
||||
+ // Sakura start - physics version
|
||||
+ double offset = this.physics.afterOrEqual(1_19_3) ? 1.0E-7D : 0.001D;
|
||||
+ BlockPos blockposition = new BlockPos(axisalignedbb.minX + offset, axisalignedbb.minY + offset, axisalignedbb.minZ + offset);
|
||||
+ BlockPos blockposition1 = new BlockPos(axisalignedbb.maxX - offset, axisalignedbb.maxY - offset, axisalignedbb.maxZ - offset);
|
||||
+ // Sakura end
|
||||
|
||||
if (this.level.hasChunksAt(blockposition, blockposition1)) {
|
||||
BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
index abf1ddbb6f8fc6dd7dadf9c7a244863b1b89a473..05457d0a8fedeb66340486f8c82b2a694fe09378 100644
|
||||
index 8a55094ae2791707946cf1646eba42887ecce663..c366486bc65bb331566f5831c0980364b7e00526 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
@@ -86,6 +86,8 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -84,6 +84,8 @@ public class FallingBlockEntity extends Entity {
|
||||
this.yo = y;
|
||||
this.zo = z;
|
||||
this.setStartPos(this.blockPosition());
|
||||
@@ -224,7 +210,7 @@ index abf1ddbb6f8fc6dd7dadf9c7a244863b1b89a473..05457d0a8fedeb66340486f8c82b2a69
|
||||
}
|
||||
|
||||
public static FallingBlockEntity fall(Level world, BlockPos pos, BlockState state) {
|
||||
@@ -98,7 +100,11 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -96,7 +98,11 @@ public class FallingBlockEntity extends Entity {
|
||||
FallingBlockEntity entityfallingblock = new FallingBlockEntity(world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, iblockdata.hasProperty(BlockStateProperties.WATERLOGGED) ? (BlockState) iblockdata.setValue(BlockStateProperties.WATERLOGGED, false) : iblockdata);
|
||||
if (CraftEventFactory.callEntityChangeBlockEvent(entityfallingblock, blockposition, iblockdata.getFluidState().createLegacyBlock()).isCancelled()) return entityfallingblock; // CraftBukkit
|
||||
|
||||
@@ -237,12 +223,8 @@ index abf1ddbb6f8fc6dd7dadf9c7a244863b1b89a473..05457d0a8fedeb66340486f8c82b2a69
|
||||
world.addFreshEntity(entityfallingblock, spawnReason); // CraftBukkit
|
||||
return entityfallingblock;
|
||||
}
|
||||
@@ -187,9 +193,46 @@ public class FallingBlockEntity extends Entity {
|
||||
// Sakura start
|
||||
@Override
|
||||
public final double getEyeY() {
|
||||
- return heightParity ? getY() : super.getEyeY();
|
||||
+ return heightParity ? this.getY() : super.getEyeY();
|
||||
@@ -188,6 +194,43 @@ public class FallingBlockEntity extends Entity {
|
||||
return this.heightParity ? this.getY() : super.getEyeY();
|
||||
}
|
||||
// Sakura end
|
||||
+ // Sakura start - physics version api
|
||||
@@ -285,7 +267,7 @@ index abf1ddbb6f8fc6dd7dadf9c7a244863b1b89a473..05457d0a8fedeb66340486f8c82b2a69
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
@@ -203,9 +246,15 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -201,9 +244,15 @@ public class FallingBlockEntity extends Entity {
|
||||
} else {
|
||||
Block block = this.blockState.getBlock();
|
||||
|
||||
@@ -302,7 +284,7 @@ index abf1ddbb6f8fc6dd7dadf9c7a244863b1b89a473..05457d0a8fedeb66340486f8c82b2a69
|
||||
}
|
||||
|
||||
this.moveBasic(MoverType.SELF, this.getDeltaMovement()); // Sakura - optimise simple entity movement
|
||||
@@ -226,8 +275,15 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -224,8 +273,15 @@ public class FallingBlockEntity extends Entity {
|
||||
return;
|
||||
}
|
||||
// Paper end
|
||||
@@ -319,7 +301,7 @@ index abf1ddbb6f8fc6dd7dadf9c7a244863b1b89a473..05457d0a8fedeb66340486f8c82b2a69
|
||||
boolean flag = this.blockState.getBlock() instanceof ConcretePowderBlock;
|
||||
boolean flag1 = flag && this.level.getFluidState(blockposition).is(FluidTags.WATER);
|
||||
double d0 = this.getDeltaMovement().lengthSqr();
|
||||
@@ -252,8 +308,11 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -250,8 +306,11 @@ public class FallingBlockEntity extends Entity {
|
||||
} else {
|
||||
BlockState iblockdata = this.level.getBlockState(blockposition);
|
||||
|
||||
@@ -333,7 +315,7 @@ index abf1ddbb6f8fc6dd7dadf9c7a244863b1b89a473..05457d0a8fedeb66340486f8c82b2a69
|
||||
if (!this.cancelDrop) {
|
||||
boolean flag2 = iblockdata.canBeReplaced((BlockPlaceContext) (new DirectionalPlaceContext(this.level, blockposition, Direction.DOWN, ItemStack.EMPTY, Direction.UP)));
|
||||
boolean flag3 = FallingBlock.isFree(this.level.getBlockState(blockposition.below())) && (!flag || !flag1);
|
||||
@@ -320,7 +379,12 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -318,7 +377,12 @@ public class FallingBlockEntity extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -348,11 +330,11 @@ index abf1ddbb6f8fc6dd7dadf9c7a244863b1b89a473..05457d0a8fedeb66340486f8c82b2a69
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
index 0aed01b24e17aed7f5f7845ced78f64f57cabac3..5f61c5c591ac68e843da22cc1efac7e7308e8d99 100644
|
||||
index e97729f2d8febac1740678840566f8beb4f07cdc..ef637b4491a2fc741925fbc896ff3a811ae6308b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
@@ -48,6 +48,13 @@ public class PrimedTnt extends Entity {
|
||||
case Y -> multiplyDeltaMovement(0, 1, 0);
|
||||
@@ -51,6 +51,13 @@ public class PrimedTnt extends Entity {
|
||||
case Y -> this.multiplyDeltaMovement(0, 1, 0);
|
||||
}
|
||||
// Sakura end
|
||||
+ // Sakura start - physics version api
|
||||
@@ -365,7 +347,7 @@ index 0aed01b24e17aed7f5f7845ced78f64f57cabac3..5f61c5c591ac68e843da22cc1efac7e7
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -94,12 +101,30 @@ public class PrimedTnt extends Entity {
|
||||
@@ -97,12 +104,30 @@ public class PrimedTnt extends Entity {
|
||||
}
|
||||
}
|
||||
// Sakura end
|
||||
@@ -397,7 +379,7 @@ index 0aed01b24e17aed7f5f7845ced78f64f57cabac3..5f61c5c591ac68e843da22cc1efac7e7
|
||||
}
|
||||
|
||||
this.moveBasic(MoverType.SELF, this.getDeltaMovement()); // Sakura - optimise simple entity movement
|
||||
@@ -109,15 +134,19 @@ public class PrimedTnt extends Entity {
|
||||
@@ -112,15 +137,19 @@ public class PrimedTnt extends Entity {
|
||||
return;
|
||||
}
|
||||
// Paper end
|
||||
@@ -420,40 +402,40 @@ index 0aed01b24e17aed7f5f7845ced78f64f57cabac3..5f61c5c591ac68e843da22cc1efac7e7
|
||||
// CraftBukkit start - Need to reverse the order of the explosion and the entity death so we have a location for the event
|
||||
// this.discard();
|
||||
this.respawnMerged(); // Sakura
|
||||
@@ -172,7 +201,10 @@ public class PrimedTnt extends Entity {
|
||||
@@ -175,7 +204,10 @@ public class PrimedTnt extends Entity {
|
||||
this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
- this.level.explode(this, this.getX(), this.getY(0.0625D), this.getZ(), event.getRadius(), event.getFire(), Level.ExplosionInteraction.TNT);
|
||||
- this.level.explode(this, this.getX(), this.getY(0.0625D), this.getZ(), event.getRadius(), event.getFire(), Explosion.BlockInteraction.BREAK);
|
||||
+ // Sakura start - physics version api
|
||||
+ double pos = this.physics.before(1_10_0) ? this.getY() + (double) 0.49f : this.getY(0.0625D);
|
||||
+ this.level.explode(this, this.getX(), pos, this.getZ(), event.getRadius(), event.getFire(), Level.ExplosionInteraction.TNT);
|
||||
+ // Sakura end
|
||||
+ this.level.explode(this, this.getX(), pos, this.getZ(), event.getRadius(), event.getFire(), Explosion.BlockInteraction.BREAK);
|
||||
+ // Sakura end - physics version api
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
@@ -216,7 +248,7 @@ public class PrimedTnt extends Entity {
|
||||
@@ -224,7 +256,7 @@ public class PrimedTnt extends Entity {
|
||||
// Paper start - Optional prevent TNT from moving in water
|
||||
@Override
|
||||
public boolean isPushedByFluid() {
|
||||
- return !level.paperConfig().fixes.preventTntFromMovingInWater && this.level.sakuraConfig().cannons.mechanics.tntFlowsInWater && super.isPushedByFluid(); // Sakura - cannon mechanics
|
||||
+ return !level.paperConfig().fixes.preventTntFromMovingInWater && !this.physics.isLegacy() && this.level.sakuraConfig().cannons.mechanics.tntFlowsInWater && super.isPushedByFluid(); // Sakura - physics version // Sakura - cannon mechanics
|
||||
- return !level.paperConfig.preventTntFromMovingInWater && this.level.sakuraConfig.tntFlowsInWater && super.isPushedByFluid(); // Sakura - cannon mechanics
|
||||
+ return !level.paperConfig.preventTntFromMovingInWater && !this.physics.isLegacy() && this.level.sakuraConfig.tntFlowsInWater && super.isPushedByFluid(); // Sakura - physics version // Sakura - cannon mechanics
|
||||
}
|
||||
// Paper end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index cd812f9504092b80fbe371e7f8d7a47c8e1565f3..83ce73bbbce9a0b2ee0d2435e7ef3f2c8e628142 100644
|
||||
index 076d353e59757232bc2bb3a19dcb3d7ed70d5edd..d59f969f599ad7a76c3277f5ad2ead67572b0f3c 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -69,6 +69,7 @@ public class Explosion {
|
||||
@@ -73,6 +73,7 @@ public class Explosion {
|
||||
private final Map<Player, Vec3> hitPlayers;
|
||||
public boolean wasCanceled = false; // CraftBukkit - add field
|
||||
private final boolean consistentRadius; // Sakura - consistent explosion radius
|
||||
+ protected final me.samsuik.sakura.physics.PhysicsVersion physics; // Sakura - physics version api
|
||||
|
||||
public Explosion(Level world, @Nullable Entity entity, double x, double y, double z, float power, List<BlockPos> affectedBlocks) {
|
||||
this(world, entity, x, y, z, power, false, Explosion.BlockInteraction.DESTROY_WITH_DECAY, affectedBlocks);
|
||||
@@ -98,6 +99,7 @@ public class Explosion {
|
||||
public Explosion(Level world, @Nullable Entity entity, double x, double y, double z, float power) {
|
||||
this(world, entity, x, y, z, power, false, Explosion.BlockInteraction.DESTROY);
|
||||
@@ -106,6 +107,7 @@ public class Explosion {
|
||||
this.damageSource = damageSource == null ? DamageSource.explosion(this) : damageSource;
|
||||
this.damageCalculator = behavior == null ? this.makeDamageCalculator(entity) : behavior;
|
||||
this.consistentRadius = world.localConfig().config(new BlockPos(x, y, z)).consistentRadius; // Sakura - consistent explosion radius
|
||||
@@ -461,7 +443,7 @@ index cd812f9504092b80fbe371e7f8d7a47c8e1565f3..83ce73bbbce9a0b2ee0d2435e7ef3f2c
|
||||
}
|
||||
|
||||
// Sakura start - optimise vanilla explosions
|
||||
@@ -209,7 +211,12 @@ public class Explosion {
|
||||
@@ -217,7 +219,12 @@ public class Explosion {
|
||||
}
|
||||
|
||||
BlockState blockstate = currChunk.getBlockState(blockX, blockY, blockZ);
|
||||
@@ -475,7 +457,7 @@ index cd812f9504092b80fbe371e7f8d7a47c8e1565f3..83ce73bbbce9a0b2ee0d2435e7ef3f2c
|
||||
break;
|
||||
} else {
|
||||
FluidState fluid = blockstate.getFluidState();
|
||||
@@ -353,8 +360,13 @@ public class Explosion {
|
||||
@@ -361,8 +368,13 @@ public class Explosion {
|
||||
final float density = entity.level.densityCache.getKnownDensity(vec3d1);
|
||||
if (density != me.samsuik.sakura.explosion.density.BlockDensityCache.UNKNOWN_DENSITY) {
|
||||
hitResult = density != 0.0f ? net.minecraft.world.phys.HitResult.Type.MISS : net.minecraft.world.phys.HitResult.Type.BLOCK;
|
||||
@@ -490,7 +472,7 @@ index cd812f9504092b80fbe371e7f8d7a47c8e1565f3..83ce73bbbce9a0b2ee0d2435e7ef3f2c
|
||||
}
|
||||
if (hitResult == HitResult.Type.MISS) {
|
||||
// Sakura end - replace density cache
|
||||
@@ -418,9 +430,15 @@ public class Explosion {
|
||||
@@ -426,9 +438,15 @@ public class Explosion {
|
||||
|
||||
if (d7 <= 1.0D) {
|
||||
double d8 = entity.getX() - this.x;
|
||||
@@ -508,13 +490,13 @@ index cd812f9504092b80fbe371e7f8d7a47c8e1565f3..83ce73bbbce9a0b2ee0d2435e7ef3f2c
|
||||
if (d11 != 0.0D) {
|
||||
d8 /= d11;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index f22a538e37835c0424b8f87c9bef1e6fd0764718..3c37eaf12fc256a8edf5a5d060e4ca262ec83108 100644
|
||||
index 4c4c709cf9e4a9d4d8b210e6160652ddbdac3dae..bccb6bec25e693dfc60dc24807078768dbf1e6ed 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -319,6 +319,205 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
return this.getLimitedEntities(except, box, net.minecraft.world.entity.EntitySelector.NO_SPECTATORS, limit, search);
|
||||
@@ -185,6 +185,205 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
public CraftWorld getWorld() {
|
||||
return this.world;
|
||||
}
|
||||
// Sakura end - add entity retrieval methods with search limits
|
||||
+ // Sakura start - physics version api
|
||||
+ public net.minecraft.world.phys.BlockHitResult.Type rayTrace(net.minecraft.world.phys.Vec3 vec3d, net.minecraft.world.phys.Vec3 vec3d1) {
|
||||
+ // May deviate from vanilla here; I remember noticing a bug and there's no fix commit.
|
||||
@@ -715,10 +697,10 @@ index f22a538e37835c0424b8f87c9bef1e6fd0764718..3c37eaf12fc256a8edf5a5d060e4ca26
|
||||
+ }
|
||||
+ // Sakura end - physics version api
|
||||
|
||||
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, Supplier<me.samsuik.sakura.configuration.WorldConfiguration> sakuraWorldConfigCreator, java.util.concurrent.Executor executor) { // Sakura // Paper - Async-Anti-Xray - Pass executor
|
||||
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
|
||||
public CraftServer getCraftServer() {
|
||||
return (CraftServer) Bukkit.getServer();
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/FallingBlock.java b/src/main/java/net/minecraft/world/level/block/FallingBlock.java
|
||||
index 6d453d78faa2af7fdb5d49f56909af3284bf0769..830137ef8eb6bab00c47d1dcfa53bdfd83aa9eee 100644
|
||||
index 4f0cadec5c9ffb0ae31b2fb9302bc3822f748e59..0a5f56e06b30945213b6a3904f58efe2f613b292 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/FallingBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/FallingBlock.java
|
||||
@@ -31,6 +31,15 @@ public class FallingBlock extends Block implements Fallable {
|
||||
@@ -735,13 +717,13 @@ index 6d453d78faa2af7fdb5d49f56909af3284bf0769..830137ef8eb6bab00c47d1dcfa53bdfd
|
||||
+ // Sakura end
|
||||
+
|
||||
@Override
|
||||
public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
||||
public void tick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
|
||||
if (isFree(world.getBlockState(pos.below())) && pos.getY() >= world.getMinBuildHeight()) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/FenceGateBlock.java b/src/main/java/net/minecraft/world/level/block/FenceGateBlock.java
|
||||
index a444a335727cf790e63fb9d0fd5d64657675b35c..6b8a61169b324e5b59502e4bf89266ee7f87861a 100644
|
||||
index 1224193a35abb8176b509ca8d8053d29c8cc6690..bdbbb45079dc7ef92f81d413ce099619e2ea23df 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/FenceGateBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/FenceGateBlock.java
|
||||
@@ -154,8 +154,13 @@ public class FenceGateBlock extends HorizontalDirectionalBlock {
|
||||
@@ -140,8 +140,13 @@ public class FenceGateBlock extends HorizontalDirectionalBlock {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@@ -755,8 +737,8 @@ index a444a335727cf790e63fb9d0fd5d64657675b35c..6b8a61169b324e5b59502e4bf89266ee
|
||||
+ world.setBlock(pos, (BlockState) ((BlockState) state.setValue(FenceGateBlock.POWERED, flag1)).setValue(FenceGateBlock.OPEN, openGate), 2);
|
||||
+ // Sakura end
|
||||
if ((Boolean) state.getValue(FenceGateBlock.OPEN) != flag1) {
|
||||
world.playSound((Player) null, pos, flag1 ? this.openSound : this.closeSound, SoundSource.BLOCKS, 1.0F, world.getRandom().nextFloat() * 0.1F + 0.9F);
|
||||
world.gameEvent((Entity) null, flag1 ? GameEvent.BLOCK_OPEN : GameEvent.BLOCK_CLOSE, pos);
|
||||
world.levelEvent((Player) null, flag1 ? 1008 : 1014, pos, 0);
|
||||
world.gameEvent(flag1 ? GameEvent.BLOCK_OPEN : GameEvent.BLOCK_CLOSE, pos);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/LadderBlock.java b/src/main/java/net/minecraft/world/level/block/LadderBlock.java
|
||||
index 6bcc83245e8046518921b82d948d45900ae0c8db..cee2e15af942915b4a68cd66e799a2c8b33e6823 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/LadderBlock.java
|
||||
@@ -796,10 +778,10 @@ index 6bcc83245e8046518921b82d948d45900ae0c8db..cee2e15af942915b4a68cd66e799a2c8
|
||||
case NORTH:
|
||||
return NORTH_AABB;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/LiquidBlock.java b/src/main/java/net/minecraft/world/level/block/LiquidBlock.java
|
||||
index 43e8ef1d6a65d4fd3fe53a587639ffb814368217..28bdb44599a8862d58cfb2e087119b843f25f311 100644
|
||||
index 8497adcba2570da8875c322e751fca2fdad057e5..f9ad605334971007efa5bbc122fd2d0ee40ab4c2 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/LiquidBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/LiquidBlock.java
|
||||
@@ -154,8 +154,26 @@ public class LiquidBlock extends Block implements BucketPickup {
|
||||
@@ -155,8 +155,26 @@ public class LiquidBlock extends Block implements BucketPickup {
|
||||
BlockPos blockposition1 = pos.relative(enumdirection.getOpposite());
|
||||
|
||||
if (world.getFluidState(blockposition1).is(FluidTags.WATER)) {
|
||||
@@ -829,10 +811,10 @@ index 43e8ef1d6a65d4fd3fe53a587639ffb814368217..28bdb44599a8862d58cfb2e087119b84
|
||||
if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, pos, block.defaultBlockState())) {
|
||||
this.fizz(world, pos);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
|
||||
index 5ea09cc455bd86beb450f0e0275d7c6c8da98084..002f807d19232f14fe8b195e0404a9bf333a9bdf 100644
|
||||
index b2522849d34bbd530c7086b6fbb0582f2d38fef7..5c4aaeac3d184379439925856a4e7b8598a6c8cf 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
|
||||
@@ -661,6 +661,10 @@ public class RedStoneWireBlock extends Block {
|
||||
@@ -669,6 +669,10 @@ public class RedStoneWireBlock extends Block {
|
||||
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
|
||||
if (!player.getAbilities().mayBuild) {
|
||||
return InteractionResult.PASS;
|
||||
@@ -897,10 +879,10 @@ index e09780f6e50e53b488e58aa6907935b3202c91ee..3aa05aae98d8d732529ecced81a972e2
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
|
||||
index f456ad8a74464414f69b616a48ee9a2c1cee4d90..bd1ebeccb75408b59cdf8ebe600da1a06f042131 100644
|
||||
index 2e5803035a46f890e8bfc59908c0040f9a960703..19edb98c92b27fb4481e4cbdd265f9a601ffb7b1 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
|
||||
@@ -157,6 +157,11 @@ public class PistonBaseBlock extends DirectionalBlock {
|
||||
@@ -156,6 +156,11 @@ public class PistonBaseBlock extends DirectionalBlock {
|
||||
// }
|
||||
// PAIL: checkME - what happened to setTypeAndData?
|
||||
// CraftBukkit end
|
||||
@@ -913,7 +895,7 @@ index f456ad8a74464414f69b616a48ee9a2c1cee4d90..bd1ebeccb75408b59cdf8ebe600da1a0
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonHeadBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonHeadBlock.java
|
||||
index 6091e3c3adbcc92c9ca438c301a99f646e3cb549..df6e859688c5b45a541b11f2046395474c083c1b 100644
|
||||
index 6c400fd706136cd015de57b9ba259b365b33d449..48c2547382f92a4c07ed8d469b0717520ac77f2a 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonHeadBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonHeadBlock.java
|
||||
@@ -132,6 +132,11 @@ public class PistonHeadBlock extends DirectionalBlock {
|
||||
@@ -928,10 +910,10 @@ index 6091e3c3adbcc92c9ca438c301a99f646e3cb549..df6e859688c5b45a541b11f204639547
|
||||
return this.isFittingBase(state, blockState) || blockState.is(Blocks.MOVING_PISTON) && blockState.getValue(FACING) == state.getValue(FACING);
|
||||
}
|
||||
|
||||
@@ -139,6 +144,10 @@ public class PistonHeadBlock extends DirectionalBlock {
|
||||
public void neighborChanged(BlockState state, Level world, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify) {
|
||||
@@ -140,6 +145,10 @@ public class PistonHeadBlock extends DirectionalBlock {
|
||||
if (state.canSurvive(world, pos)) {
|
||||
world.neighborChanged(pos.relative(state.getValue(FACING).getOpposite()), sourceBlock, sourcePos);
|
||||
BlockPos blockPos = pos.relative(state.getValue(FACING).getOpposite());
|
||||
world.getBlockState(blockPos).neighborChanged(world, blockPos, block, fromPos, false);
|
||||
+ // Sakura start - physics version api
|
||||
+ } else if (world.localConfig().config(pos).physicsVersion.before(1_9_0)) {
|
||||
+ world.setBlock(pos, Blocks.AIR.defaultBlockState(), 19);
|
||||
@@ -940,10 +922,10 @@ index 6091e3c3adbcc92c9ca438c301a99f646e3cb549..df6e859688c5b45a541b11f204639547
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
|
||||
index 26e11fbe0ddeed23d286e83adfa7d2a5e9cf88c8..044f6daf4a7d30b6d42a21a12fa409f05121ac91 100644
|
||||
index e6361fd5ffd4ad908b6ade9ae7b1b52cc0a7c603..51bd75c4ef5819ece80b820326ef065e14a5baa8 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
|
||||
@@ -159,6 +159,12 @@ public class PistonMovingBlockEntity extends BlockEntity {
|
||||
@@ -156,6 +156,12 @@ public class PistonMovingBlockEntity extends BlockEntity {
|
||||
|
||||
double i = 0.0D;
|
||||
|
||||
@@ -956,7 +938,7 @@ index 26e11fbe0ddeed23d286e83adfa7d2a5e9cf88c8..044f6daf4a7d30b6d42a21a12fa409f0
|
||||
for(AABB aABB2 : list2) {
|
||||
AABB aABB3 = PistonMath.getMovementArea(moveByPositionAndProgress(pos, aABB2, blockEntity), direction, d);
|
||||
AABB aABB4 = entity.getBoundingBox();
|
||||
@@ -280,14 +286,167 @@ public class PistonMovingBlockEntity extends BlockEntity {
|
||||
@@ -277,14 +283,167 @@ public class PistonMovingBlockEntity extends BlockEntity {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1124,7 +1106,7 @@ index 26e11fbe0ddeed23d286e83adfa7d2a5e9cf88c8..044f6daf4a7d30b6d42a21a12fa409f0
|
||||
world.removeBlockEntity(pos);
|
||||
blockEntity.setRemoved();
|
||||
if (world.getBlockState(pos).is(Blocks.MOVING_PISTON)) {
|
||||
@@ -308,13 +467,23 @@ public class PistonMovingBlockEntity extends BlockEntity {
|
||||
@@ -305,13 +464,23 @@ public class PistonMovingBlockEntity extends BlockEntity {
|
||||
}
|
||||
} else {
|
||||
float f = blockEntity.progress + 0.5F;
|
||||
@@ -1150,10 +1132,10 @@ index 26e11fbe0ddeed23d286e83adfa7d2a5e9cf88c8..044f6daf4a7d30b6d42a21a12fa409f0
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
|
||||
index 6a01bfd7aeded9d25eb2a96f2723a2a352f74147..90b4373dd4c0b4c05c69714b10639d20c69f60f9 100644
|
||||
index ff40fe323964f173561a6838fb443e79abf9df38..1f267a6815c51cc89e708ca5117bdc9f1955af33 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
|
||||
@@ -517,7 +517,7 @@ public abstract class FlowingFluid extends Fluid {
|
||||
@@ -505,7 +505,7 @@ public abstract class FlowingFluid extends Fluid {
|
||||
this.spread(world, pos, state);
|
||||
}
|
||||
|
||||
@@ -1163,7 +1145,7 @@ index 6a01bfd7aeded9d25eb2a96f2723a2a352f74147..90b4373dd4c0b4c05c69714b10639d20
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/material/LavaFluid.java b/src/main/java/net/minecraft/world/level/material/LavaFluid.java
|
||||
index 783e315d92227cbcb5cd207b0a06a12e0778d14b..ad001d4ae5ef5d0efc2c4fd04b1d8331cd40590a 100644
|
||||
index 5dfa257e99c778113cfa8ca74f56482285b3a006..769bfaca7bfa7c4e9847a18a9fcefb78a0249b51 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/material/LavaFluid.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/material/LavaFluid.java
|
||||
@@ -175,7 +175,10 @@ public abstract class LavaFluid extends FlowingFluid {
|
||||
@@ -1179,10 +1161,10 @@ index 783e315d92227cbcb5cd207b0a06a12e0778d14b..ad001d4ae5ef5d0efc2c4fd04b1d8331
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/level/material/WaterFluid.java b/src/main/java/net/minecraft/world/level/material/WaterFluid.java
|
||||
index 82e85fbbd45244d02df90fa00c9046e7f51275a2..43df400227429a8a1a18d5ad6fce8a57b198e766 100644
|
||||
index 56d50b9310d30e0f81f3d2549ff5c256eb07cc2a..4a476a933fc2ec5aa4192a755af59f99f93c29c9 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/material/WaterFluid.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/material/WaterFluid.java
|
||||
@@ -104,7 +104,10 @@ public abstract class WaterFluid extends FlowingFluid {
|
||||
@@ -103,7 +103,10 @@ public abstract class WaterFluid extends FlowingFluid {
|
||||
|
||||
@Override
|
||||
public boolean canBeReplacedWith(FluidState state, BlockGetter world, BlockPos pos, Fluid fluid, Direction direction) {
|
||||
@@ -5,37 +5,37 @@ Subject: [PATCH] Allow water in the nether
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/BucketItem.java b/src/main/java/net/minecraft/world/item/BucketItem.java
|
||||
index 5c6aa9c464784ad5ee366412d080c72d3d22a76f..4f21231d6ede7bf1b82185f115b2c48b87732c14 100644
|
||||
index a3f04f66c66f40068792da3ef0e75e7df102b0e0..99409b4c2fab2a9f068857d9248e8fe6ad76c0ae 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/BucketItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/BucketItem.java
|
||||
@@ -166,7 +166,7 @@ public class BucketItem extends Item implements DispensibleContainerItem {
|
||||
// CraftBukkit end
|
||||
if (!flag1) {
|
||||
return movingobjectpositionblock != null && this.emptyContents(entityhuman, world, movingobjectpositionblock.getBlockPos().relative(movingobjectpositionblock.getDirection()), (BlockHitResult) null, enumdirection, clicked, itemstack, enumhand); // CraftBukkit
|
||||
return movingobjectpositionblock != null && this.emptyContents(entityhuman, world, movingobjectpositionblock.getBlockPos().relative(movingobjectpositionblock.getDirection()), (BlockHitResult) null, enumdirection, clicked, itemstack, enumhand); // CraftBukkit // Paper
|
||||
- } else if (world.dimensionType().ultraWarm() && this.content.is(FluidTags.WATER)) {
|
||||
+ } else if (!world.sakuraConfig().environment.allowWaterInTheNether && world.dimensionType().ultraWarm() && this.content.is(FluidTags.WATER)) { // Sakura
|
||||
+ } else if (!world.sakuraConfig.allowWaterInTheNether && world.dimensionType().ultraWarm() && this.content.is(FluidTags.WATER)) { // Sakura
|
||||
int i = blockposition.getX();
|
||||
int j = blockposition.getY();
|
||||
int k = blockposition.getZ();
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/IceBlock.java b/src/main/java/net/minecraft/world/level/block/IceBlock.java
|
||||
index 64206d94a5bf210116d208f9678618b905a61428..ea336c764fa5f0ab9583eff2018c9594bf41b5d1 100644
|
||||
index 2676cddca511ea775766cec0001269407599df6e..d14b5b0cb4e57ea68d0ee4950ce48ce1e2bf49c3 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/IceBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/IceBlock.java
|
||||
@@ -31,7 +31,7 @@ public class IceBlock extends HalfTransparentBlock {
|
||||
public void afterDestroy(Level world, BlockPos pos, ItemStack stack) {
|
||||
// Paper end
|
||||
@@ -26,7 +26,7 @@ public class IceBlock extends HalfTransparentBlock {
|
||||
public void playerDestroy(Level world, Player player, BlockPos pos, BlockState state, @Nullable BlockEntity blockEntity, ItemStack stack) {
|
||||
super.playerDestroy(world, player, pos, state, blockEntity, stack);
|
||||
if (EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, stack) == 0) {
|
||||
- if (world.dimensionType().ultraWarm()) {
|
||||
+ if (!world.sakuraConfig().environment.allowWaterInTheNether && world.dimensionType().ultraWarm()) { // Sakura
|
||||
+ if (!world.sakuraConfig.allowWaterInTheNether && world.dimensionType().ultraWarm()) { // Sakura
|
||||
world.removeBlock(pos, false);
|
||||
return;
|
||||
}
|
||||
@@ -59,7 +59,7 @@ public class IceBlock extends HalfTransparentBlock {
|
||||
@@ -54,7 +54,7 @@ public class IceBlock extends HalfTransparentBlock {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
- if (world.dimensionType().ultraWarm()) {
|
||||
+ if (!world.sakuraConfig().environment.allowWaterInTheNether && world.dimensionType().ultraWarm()) { // Sakura
|
||||
+ if (!world.sakuraConfig.allowWaterInTheNether && world.dimensionType().ultraWarm()) { // Sakura
|
||||
world.removeBlock(pos, false);
|
||||
} else {
|
||||
world.setBlockAndUpdate(pos, Blocks.WATER.defaultBlockState());
|
||||
@@ -5,15 +5,15 @@ Subject: [PATCH] Configure concrete solidifying in water
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
index 05457d0a8fedeb66340486f8c82b2a694fe09378..358a2a5de2c39bb1b3829af29a4a70f2b720dc24 100644
|
||||
index c366486bc65bb331566f5831c0980364b7e00526..599c934dd1bc99e9c2a069c4f5a6050283c4149f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
@@ -284,7 +284,7 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -282,7 +282,7 @@ public class FallingBlockEntity extends Entity {
|
||||
// However, it makes sense for legacy versions pre-1.17 before the world height change.
|
||||
BlockPos blockposition = this.physics.before(1_17_0) ? this.patchedBlockPosition() : this.blockPosition();
|
||||
// Sakura end - physics version api
|
||||
- boolean flag = this.blockState.getBlock() instanceof ConcretePowderBlock;
|
||||
+ boolean flag = this.level.sakuraConfig().cannons.sand.concreteSolidifyInWater && this.blockState.getBlock() instanceof ConcretePowderBlock; // Sakura
|
||||
+ boolean flag = this.level.sakuraConfig.concreteSolidifyInWater && this.blockState.getBlock() instanceof ConcretePowderBlock; // Sakura
|
||||
boolean flag1 = flag && this.level.getFluidState(blockposition).is(FluidTags.WATER);
|
||||
double d0 = this.getDeltaMovement().lengthSqr();
|
||||
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Option for fast nether dimension lava
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/material/LavaFluid.java b/src/main/java/net/minecraft/world/level/material/LavaFluid.java
|
||||
index ad001d4ae5ef5d0efc2c4fd04b1d8331cd40590a..2d3d991c826286083377b5e92bf6d807c1836253 100644
|
||||
index 769bfaca7bfa7c4e9847a18a9fcefb78a0249b51..ed3b1225bd9e59b2eee64ac4bd03a6fa59f690e0 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/material/LavaFluid.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/material/LavaFluid.java
|
||||
@@ -183,7 +183,7 @@ public abstract class LavaFluid extends FlowingFluid {
|
||||
@@ -13,7 +13,7 @@ index ad001d4ae5ef5d0efc2c4fd04b1d8331cd40590a..2d3d991c826286083377b5e92bf6d807
|
||||
@Override
|
||||
public int getTickDelay(LevelReader world) {
|
||||
- return world.dimensionType().ultraWarm() ? 10 : 30;
|
||||
+ return world.dimensionType().ultraWarm() && !(world instanceof Level level && level.sakuraConfig().environment.disableFastNetherLava) ? 10 : 30; // Sakura
|
||||
+ return world.dimensionType().ultraWarm() && !(world instanceof Level level && level.sakuraConfig.disableFastNetherLava) ? 10 : 30; // Sakura
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -5,27 +5,27 @@ Subject: [PATCH] Allow explosions to destroy lava
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index cd8f19b6644fa43460f97525cf47526fd5db40b3..6f610de34ac165d2e9a2d353eee46f26da2c22c1 100644
|
||||
index d59f969f599ad7a76c3277f5ad2ead67572b0f3c..c1effe8ecd110ac39103cc7778e7070ac9c33732 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -321,6 +321,11 @@ public class Explosion {
|
||||
@@ -329,6 +329,11 @@ public class Explosion {
|
||||
return Optional.of(-0.3f);
|
||||
}
|
||||
// Sakura end - destroy water logged blocks
|
||||
+ // Sakura start - allow explosions to destroy lava
|
||||
+ if (blockState.is(Blocks.LAVA) && this.level.sakuraConfig().cannons.explosion.explodeLava) {
|
||||
+ if (blockState.is(Blocks.LAVA) && this.level.sakuraConfig.explodeLava) {
|
||||
+ return Optional.of(-0.3f);
|
||||
+ }
|
||||
+ // Sakura end - allow explosions to destroy lava
|
||||
}
|
||||
|
||||
return this.damageCalculator.getBlockExplosionResistance(this, this.level, pos, blockState, fluidState);
|
||||
@@ -615,7 +620,7 @@ public class Explosion {
|
||||
}
|
||||
@@ -612,7 +617,7 @@ public class Explosion {
|
||||
});
|
||||
}
|
||||
|
||||
- this.level.setBlock(blockposition, Blocks.AIR.defaultBlockState(), 3);
|
||||
+ this.level.setBlock(blockposition, Blocks.AIR.defaultBlockState(), this.level.sakuraConfig().cannons.explosion.explodeLava && iblockdata.is(Blocks.LAVA) ? 2 : 3); // Sakura - allow explosions to destroy lava
|
||||
+ this.level.setBlock(blockposition, Blocks.AIR.defaultBlockState(), this.level.sakuraConfig.explodeLava && iblockdata.is(Blocks.LAVA) ? 2 : 3); // Sakura - allow explosions to destroy lava
|
||||
block.wasExploded(this.level, blockposition, this);
|
||||
this.level.getProfiler().pop();
|
||||
}
|
||||
@@ -5,14 +5,14 @@ Subject: [PATCH] Disable bubble columns affecting cannon entities
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java b/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java
|
||||
index 461288cb56793f11e8dac80720b36cb9b42da518..63ec5bbb3fee17a5a08ec852de60426d0f26d520 100644
|
||||
index ee3045133965da67611f180835fa111998f918b4..8de2d8b1474fa45c097ac9964ecfd07c1351f103 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java
|
||||
@@ -39,6 +39,7 @@ public class BubbleColumnBlock extends Block implements BucketPickup {
|
||||
@Override
|
||||
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
|
||||
if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper
|
||||
+ if (!world.sakuraConfig().cannons.tntAndSandAffectedByBubbleColumns && (entity.isPrimedTNT || entity.isFallingBlock)) return; // Sakura - configure bubble columns affecting cannon entities
|
||||
+ if (!world.sakuraConfig.tntAndSandAffectedByBubbleColumns && (entity.isPrimedTNT || entity.isFallingBlock)) return; // Sakura - configure bubble columns affecting cannon entities
|
||||
BlockState blockState = world.getBlockState(pos.above());
|
||||
if (blockState.isAir()) {
|
||||
entity.onAboveBubbleCol(state.getValue(DRAG_DOWN));
|
||||
@@ -38,19 +38,19 @@ index 93977027caa8c398ca6f0d2bb0890231adf8bf49..07d3aac679ed4a3d85573706bd664e4d
|
||||
|
||||
if (predicate != null && !predicate.test(blockData, mutablePos)) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 4b35f249ee880e07acd0e0b642e86f6486a6ded8..28e1768bdcc2c45643272b759da95452a324a59d 100644
|
||||
index 2f9a4f0d458edfbff5979f9cde39eae1f8f922fb..f2dab7d69cd26474de88eae95b47f68414232cf6 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -691,6 +691,18 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -575,6 +575,18 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
return this.physics;
|
||||
}
|
||||
// Sakura end - physics version api
|
||||
+ // Sakura start - Treat all collidable blocks as full when moving fast
|
||||
+ public final boolean treatAllBlocksAsFullWhenMoving() {
|
||||
+ if (this.level.sakuraConfig().cannons.treatAllBlocksAsFullWhenMoving && (this.isPrimedTNT || this.isFallingBlock)) {
|
||||
+ if (this.level.sakuraConfig.collideWhenMoving && (this.isPrimedTNT || this.isFallingBlock)) {
|
||||
+ this.syncDeltaMovement();
|
||||
+ double horizontalMovementSqr = this.movementX*this.movementX + this.movementZ*this.movementZ;
|
||||
+ if (horizontalMovementSqr > Math.pow(this.level.sakuraConfig().cannons.treatAllBlocksAsFullWhenMovingFasterThan, 2.0)) {
|
||||
+ if (horizontalMovementSqr > Math.pow(this.level.sakuraConfig.collideMovingFasterThan, 2.0)) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
@@ -58,5 +58,5 @@ index 4b35f249ee880e07acd0e0b642e86f6486a6ded8..28e1768bdcc2c45643272b759da95452
|
||||
+ }
|
||||
+ // Sakura end - Treat all collidable blocks as full when moving fast
|
||||
|
||||
public Entity(EntityType<?> type, Level world) {
|
||||
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
|
||||
// Paper start
|
||||
/**
|
||||
@@ -5,69 +5,70 @@ Subject: [PATCH] Add redstone implementation API
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
|
||||
index 002f807d19232f14fe8b195e0404a9bf333a9bdf..a9f84d594e2adda096d872d4b7ca59e73305544b 100644
|
||||
index 5c4aaeac3d184379439925856a4e7b8598a6c8cf..50d96a6e2bcd4e276dbdbf99b55870782f92cc00 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
|
||||
@@ -262,7 +262,7 @@ public class RedStoneWireBlock extends Block {
|
||||
@@ -265,7 +265,7 @@ public class RedStoneWireBlock extends Block {
|
||||
* Note: Added 'source' argument so as to help determine direction of information flow
|
||||
*/
|
||||
private void updateSurroundingRedstone(Level worldIn, BlockPos pos, BlockState state, BlockPos source) {
|
||||
- if (worldIn.paperConfig().misc.redstoneImplementation == io.papermc.paper.configuration.WorldConfiguration.Misc.RedstoneImplementation.EIGENCRAFT) {
|
||||
+ if (worldIn.localConfig().config(pos).redstoneImplementation == io.papermc.paper.configuration.WorldConfiguration.Misc.RedstoneImplementation.EIGENCRAFT) { // Sakura
|
||||
- if (worldIn.paperConfig.redstoneImplementation == com.destroystokyo.paper.PaperWorldConfig.RedstoneImplementation.EIGENCRAFT) {
|
||||
+ if (worldIn.localConfig().config(pos).redstoneImplementation == com.destroystokyo.paper.PaperWorldConfig.RedstoneImplementation.EIGENCRAFT) { // Sakura
|
||||
turbo.updateSurroundingRedstone(worldIn, pos, state, source);
|
||||
return;
|
||||
}
|
||||
@@ -286,7 +286,7 @@ public class RedStoneWireBlock extends Block {
|
||||
@@ -289,7 +289,8 @@ public class RedStoneWireBlock extends Block {
|
||||
int k = worldIn.getBestNeighborSignal(pos1);
|
||||
this.shouldSignal = true;
|
||||
|
||||
- if (worldIn.paperConfig().misc.redstoneImplementation == io.papermc.paper.configuration.WorldConfiguration.Misc.RedstoneImplementation.VANILLA) {
|
||||
+ if (worldIn.localConfig().config(pos1).redstoneImplementation == io.papermc.paper.configuration.WorldConfiguration.Misc.RedstoneImplementation.VANILLA) { // Sakura
|
||||
- if (worldIn.paperConfig.redstoneImplementation == com.destroystokyo.paper.PaperWorldConfig.RedstoneImplementation.VANILLA) {
|
||||
+ final com.destroystokyo.paper.PaperWorldConfig.RedstoneImplementation redstoneImplementation = worldIn.localConfig().config(pos1).redstoneImplementation; // Sakura
|
||||
+ if (redstoneImplementation == com.destroystokyo.paper.PaperWorldConfig.RedstoneImplementation.VANILLA) { // Sakura
|
||||
// This code is totally redundant to if statements just below the loop.
|
||||
if (k > 0 && k > j - 1) {
|
||||
j = k;
|
||||
@@ -300,7 +300,7 @@ public class RedStoneWireBlock extends Block {
|
||||
@@ -303,7 +304,7 @@ public class RedStoneWireBlock extends Block {
|
||||
// redstone wire will be set to 'k'. If 'k' is already 15, then nothing inside the
|
||||
// following loop can affect the power level of the wire. Therefore, the loop is
|
||||
// skipped if k is already 15.
|
||||
- if (worldIn.paperConfig().misc.redstoneImplementation == io.papermc.paper.configuration.WorldConfiguration.Misc.RedstoneImplementation.VANILLA || k < 15) {
|
||||
+ if (worldIn.localConfig().config(pos1).redstoneImplementation == io.papermc.paper.configuration.WorldConfiguration.Misc.RedstoneImplementation.VANILLA || k < 15) { // Sakura
|
||||
- if (worldIn.paperConfig.redstoneImplementation == com.destroystokyo.paper.PaperWorldConfig.RedstoneImplementation.VANILLA || k < 15) {
|
||||
+ if (redstoneImplementation == com.destroystokyo.paper.PaperWorldConfig.RedstoneImplementation.VANILLA || k < 15) { // Sakura
|
||||
for (Direction enumfacing : Direction.Plane.HORIZONTAL) {
|
||||
BlockPos blockpos = pos1.relative(enumfacing);
|
||||
boolean flag = blockpos.getX() != pos2.getX() || blockpos.getZ() != pos2.getZ();
|
||||
@@ -319,7 +319,7 @@ public class RedStoneWireBlock extends Block {
|
||||
@@ -322,7 +323,7 @@ public class RedStoneWireBlock extends Block {
|
||||
}
|
||||
}
|
||||
|
||||
- if (worldIn.paperConfig().misc.redstoneImplementation == io.papermc.paper.configuration.WorldConfiguration.Misc.RedstoneImplementation.VANILLA) {
|
||||
+ if (worldIn.localConfig().config(pos1).redstoneImplementation == io.papermc.paper.configuration.WorldConfiguration.Misc.RedstoneImplementation.VANILLA) { // Sakura
|
||||
- if (worldIn.paperConfig.redstoneImplementation == com.destroystokyo.paper.PaperWorldConfig.RedstoneImplementation.VANILLA) {
|
||||
+ if (redstoneImplementation == com.destroystokyo.paper.PaperWorldConfig.RedstoneImplementation.VANILLA) { // Sakura
|
||||
// The old code would decrement the wire value only by 1 at a time.
|
||||
if (l > j) {
|
||||
j = l - 1;
|
||||
@@ -455,7 +455,7 @@ public class RedStoneWireBlock extends Block {
|
||||
@@ -463,7 +464,7 @@ public class RedStoneWireBlock extends Block {
|
||||
public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) {
|
||||
if (!oldState.is(state.getBlock()) && !world.isClientSide) {
|
||||
// Paper start - optimize redstone - replace call to updatePowerStrength
|
||||
- if (world.paperConfig().misc.redstoneImplementation == io.papermc.paper.configuration.WorldConfiguration.Misc.RedstoneImplementation.ALTERNATE_CURRENT) {
|
||||
+ if (world.localConfig().config(pos).redstoneImplementation == io.papermc.paper.configuration.WorldConfiguration.Misc.RedstoneImplementation.ALTERNATE_CURRENT) { // Sakura
|
||||
- if (world.paperConfig.redstoneImplementation == com.destroystokyo.paper.PaperWorldConfig.RedstoneImplementation.ALTERNATE_CURRENT) {
|
||||
+ if (world.localConfig().config(pos).redstoneImplementation == com.destroystokyo.paper.PaperWorldConfig.RedstoneImplementation.ALTERNATE_CURRENT) { // Sakura
|
||||
world.getWireHandler().onWireAdded(pos); // Alternate Current
|
||||
} else {
|
||||
this.updateSurroundingRedstone(world, pos, state, null); // vanilla/Eigencraft
|
||||
@@ -488,7 +488,7 @@ public class RedStoneWireBlock extends Block {
|
||||
@@ -496,7 +497,7 @@ public class RedStoneWireBlock extends Block {
|
||||
}
|
||||
|
||||
// Paper start - optimize redstone - replace call to updatePowerStrength
|
||||
- if (world.paperConfig().misc.redstoneImplementation == io.papermc.paper.configuration.WorldConfiguration.Misc.RedstoneImplementation.ALTERNATE_CURRENT) {
|
||||
+ if (world.localConfig().config(pos).redstoneImplementation == io.papermc.paper.configuration.WorldConfiguration.Misc.RedstoneImplementation.ALTERNATE_CURRENT) { // Sakura
|
||||
- if (world.paperConfig.redstoneImplementation == com.destroystokyo.paper.PaperWorldConfig.RedstoneImplementation.ALTERNATE_CURRENT) {
|
||||
+ if (world.localConfig().config(pos).redstoneImplementation == com.destroystokyo.paper.PaperWorldConfig.RedstoneImplementation.ALTERNATE_CURRENT) { // Sakura
|
||||
world.getWireHandler().onWireRemoved(pos, state); // Alternate Current
|
||||
} else {
|
||||
this.updateSurroundingRedstone(world, pos, state, null); // vanilla/Eigencraft
|
||||
@@ -529,7 +529,7 @@ public class RedStoneWireBlock extends Block {
|
||||
@@ -537,7 +538,7 @@ public class RedStoneWireBlock extends Block {
|
||||
if (!world.isClientSide) {
|
||||
// Paper start - optimize redstone (Alternate Current)
|
||||
// Alternate Current handles breaking of redstone wires in the WireHandler.
|
||||
- if (world.paperConfig().misc.redstoneImplementation == io.papermc.paper.configuration.WorldConfiguration.Misc.RedstoneImplementation.ALTERNATE_CURRENT) {
|
||||
+ if (world.localConfig().config(pos).redstoneImplementation == io.papermc.paper.configuration.WorldConfiguration.Misc.RedstoneImplementation.ALTERNATE_CURRENT) { // Sakura
|
||||
- if (world.paperConfig.redstoneImplementation == com.destroystokyo.paper.PaperWorldConfig.RedstoneImplementation.ALTERNATE_CURRENT) {
|
||||
+ if (world.localConfig().config(pos).redstoneImplementation == com.destroystokyo.paper.PaperWorldConfig.RedstoneImplementation.ALTERNATE_CURRENT) { // Sakura
|
||||
world.getWireHandler().onWireUpdated(pos);
|
||||
} else
|
||||
// Paper end
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Reduce entity tracker player updates
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index c3b3e984f8a19252b6feabb9ba1f7169dcec2fa2..5e326f26b5166b7ce79bad5724ae63392d53fa45 100644
|
||||
index 759ac36b32eaddcc0cff4c2308030b692d6fc7f4..ee7871ddd36b20206ef66372b04861d100601341 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -1254,6 +1254,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -2040,6 +2040,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
try {
|
||||
for (TrackedEntity tracker : this.entityMap.values()) {
|
||||
// update tracker entry
|
||||
@@ -16,7 +16,7 @@ index c3b3e984f8a19252b6feabb9ba1f7169dcec2fa2..5e326f26b5166b7ce79bad5724ae6339
|
||||
tracker.updatePlayers(tracker.entity.getPlayersInTrackRange());
|
||||
}
|
||||
} finally {
|
||||
@@ -1501,14 +1502,34 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -2232,14 +2233,34 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
private final int range;
|
||||
SectionPos lastSectionPos;
|
||||
public final Set<ServerPlayerConnection> seenBy = new ReferenceOpenHashSet<>(); // Paper - optimise map impl
|
||||
@@ -27,7 +27,7 @@ index c3b3e984f8a19252b6feabb9ba1f7169dcec2fa2..5e326f26b5166b7ce79bad5724ae6339
|
||||
this.serverEntity = new ServerEntity(ChunkMap.this.level, entity, j, flag, this::broadcast, this.seenBy); // CraftBukkit
|
||||
this.entity = entity;
|
||||
this.range = i;
|
||||
this.lastSectionPos = SectionPos.of((EntityAccess) entity);
|
||||
this.lastSectionPos = SectionPos.of(entity);
|
||||
+ // Sakura start - reduce entities looking for nearby players
|
||||
+ // Use a maximum of 20 ticks because stationary entities use Integer.MAX_VALUE
|
||||
+ // which causes them to turn invisible after untracking.
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Add option for legacy lava block formation
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/LiquidBlock.java b/src/main/java/net/minecraft/world/level/block/LiquidBlock.java
|
||||
index 28bdb44599a8862d58cfb2e087119b843f25f311..51dc3b81fcb76b1bc185486db26ca2a36ca36e98 100644
|
||||
index f9ad605334971007efa5bbc122fd2d0ee40ab4c2..30fd979fb5e375cbe4bacb441d7192b9a20b4a81 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/LiquidBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/LiquidBlock.java
|
||||
@@ -161,7 +161,15 @@ public class LiquidBlock extends Block implements BucketPickup {
|
||||
@@ -162,7 +162,15 @@ public class LiquidBlock extends Block implements BucketPickup {
|
||||
if (fluidState.isSource()) {
|
||||
block = Blocks.OBSIDIAN;
|
||||
} else {
|
||||
@@ -16,7 +16,7 @@ index 28bdb44599a8862d58cfb2e087119b843f25f311..51dc3b81fcb76b1bc185486db26ca2a3
|
||||
+ // Sakura start - legacy block formation
|
||||
+ final me.samsuik.sakura.physics.PhysicsVersion physics;
|
||||
+
|
||||
+ if (world.sakuraConfig().environment.blockGeneration.legacyBlockFormation) {
|
||||
+ if (world.sakuraConfig.legacyBlockFormation) {
|
||||
+ physics = me.samsuik.sakura.physics.PhysicsVersion.v1_12;
|
||||
+ } else {
|
||||
+ physics = world.localConfig().config(pos).physicsVersion;
|
||||
@@ -26,7 +26,7 @@ index 28bdb44599a8862d58cfb2e087119b843f25f311..51dc3b81fcb76b1bc185486db26ca2a3
|
||||
// SANITY: In legacy a patch by paper removes the fluid level condition from vanilla.
|
||||
if (physics.afterOrEqual(1_16_0) || physics.isLegacy()
|
||||
diff --git a/src/main/java/net/minecraft/world/level/material/LavaFluid.java b/src/main/java/net/minecraft/world/level/material/LavaFluid.java
|
||||
index 2d3d991c826286083377b5e92bf6d807c1836253..1fb85a64eca4ef8a778f5b8652f774d1cfb707c4 100644
|
||||
index ed3b1225bd9e59b2eee64ac4bd03a6fa59f690e0..0f13a5ea286ed42f117dd7473365ec642b46b82d 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/material/LavaFluid.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/material/LavaFluid.java
|
||||
@@ -177,7 +177,7 @@ public abstract class LavaFluid extends FlowingFluid {
|
||||
@@ -34,20 +34,20 @@ index 2d3d991c826286083377b5e92bf6d807c1836253..1fb85a64eca4ef8a778f5b8652f774d1
|
||||
// Sakura start
|
||||
return state.getHeight(world, pos) >= 0.44444445F && fluid.is(FluidTags.WATER)
|
||||
- && world instanceof Level level && level.localConfig().config(pos).physicsVersion.afterOrEqual(1_13_0);
|
||||
+ && world instanceof Level level && !level.sakuraConfig().environment.blockGeneration.legacyBlockFormation && level.localConfig().config(pos).physicsVersion.afterOrEqual(1_13_0);
|
||||
+ && world instanceof Level level && !level.sakuraConfig.legacyBlockFormation && level.localConfig().config(pos).physicsVersion.afterOrEqual(1_13_0);
|
||||
// Sakura end
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/material/WaterFluid.java b/src/main/java/net/minecraft/world/level/material/WaterFluid.java
|
||||
index 43df400227429a8a1a18d5ad6fce8a57b198e766..3a955377a13b67e955f90614b975f76f3fcfe9b8 100644
|
||||
index 4a476a933fc2ec5aa4192a755af59f99f93c29c9..f9e9332ef573c641e071400f5c8726190b464a56 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/material/WaterFluid.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/material/WaterFluid.java
|
||||
@@ -106,7 +106,7 @@ public abstract class WaterFluid extends FlowingFluid {
|
||||
@@ -105,7 +105,7 @@ public abstract class WaterFluid extends FlowingFluid {
|
||||
public boolean canBeReplacedWith(FluidState state, BlockGetter world, BlockPos pos, Fluid fluid, Direction direction) {
|
||||
// Sakura start
|
||||
return direction == Direction.DOWN && !fluid.is(FluidTags.WATER)
|
||||
- || fluid.is(FluidTags.LAVA) && world instanceof Level level && level.localConfig().config(pos).physicsVersion.before(1_13_0);
|
||||
+ || fluid.is(FluidTags.LAVA) && world instanceof Level level && (level.sakuraConfig().environment.blockGeneration.legacyBlockFormation || level.localConfig().config(pos).physicsVersion.before(1_13_0));
|
||||
+ || fluid.is(FluidTags.LAVA) && world instanceof Level level && (level.sakuraConfig.legacyBlockFormation || level.localConfig().config(pos).physicsVersion.before(1_13_0));
|
||||
// Sakura end
|
||||
}
|
||||
|
||||
28
patches/server/0045-Configure-mob-spawner-defaults.patch
Normal file
28
patches/server/0045-Configure-mob-spawner-defaults.patch
Normal file
@@ -0,0 +1,28 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samsuik <40902469+Samsuik@users.noreply.github.com>
|
||||
Date: Thu, 7 Dec 2023 16:30:24 +0000
|
||||
Subject: [PATCH] Configure mob spawner defaults
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
||||
index 4bfebbb2e87464cd47a38a5da6275b2c662fa052..c0850e49aa677ecb16ce551ea0268ff9b172b642 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
||||
@@ -44,7 +44,16 @@ public abstract class BaseSpawner {
|
||||
private final Random random = new Random();
|
||||
private int tickDelay = 0; // Paper
|
||||
|
||||
- public BaseSpawner() {}
|
||||
+ // Sakura start - configure spawner defaults
|
||||
+ public BaseSpawner() {
|
||||
+ this.minSpawnDelay = me.samsuik.sakura.configuration.SakuraGlobalConfig.get().minSpawnDelay;
|
||||
+ this.maxSpawnDelay = me.samsuik.sakura.configuration.SakuraGlobalConfig.get().maxSpawnDelay;
|
||||
+ this.spawnCount = me.samsuik.sakura.configuration.SakuraGlobalConfig.get().spawnCount;
|
||||
+ this.maxNearbyEntities = me.samsuik.sakura.configuration.SakuraGlobalConfig.get().maxNearbyEntities;
|
||||
+ this.requiredPlayerRange = me.samsuik.sakura.configuration.SakuraGlobalConfig.get().requiredPlayerRange;
|
||||
+ this.spawnRange = me.samsuik.sakura.configuration.SakuraGlobalConfig.get().spawnRange;
|
||||
+ }
|
||||
+ // Sakura end - configure spawner defaults
|
||||
|
||||
public void setEntityId(EntityType<?> type) {
|
||||
this.nextSpawnData.getEntityToSpawn().putString("id", Registry.ENTITY_TYPE.getKey(type).toString());
|
||||
@@ -5,17 +5,17 @@ Subject: [PATCH] Allow disabling random dispenser item selection
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java
|
||||
index 881379681c39230a00b3a1f11cd87498984396c7..73e6fbf818944e73885db9c528114b0ea684de47 100644
|
||||
index f74c5bb8e1ba42c77c59d481b871fd992483b128..4c77d0333808324640dfb77246baecf204188579 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java
|
||||
@@ -73,8 +73,15 @@ public class DispenserBlockEntity extends RandomizableContainerBlockEntity {
|
||||
@@ -75,8 +75,15 @@ public class DispenserBlockEntity extends RandomizableContainerBlockEntity {
|
||||
int j = 1;
|
||||
|
||||
for (int k = 0; k < this.items.size(); ++k) {
|
||||
- if (!((ItemStack) this.items.get(k)).isEmpty() && random.nextInt(j++) == 0) {
|
||||
- if (!((ItemStack) this.items.get(k)).isEmpty() && DispenserBlockEntity.RANDOM.nextInt(j++) == 0) {
|
||||
+ // Sakura start - allow disabling dispenser random item selection
|
||||
+ if (this.level.sakuraConfig().technical.dispenserRandomItemSelection || this instanceof DropperBlockEntity) {
|
||||
+ if (!((ItemStack) this.items.get(k)).isEmpty() && random.nextInt(j++) == 0) {
|
||||
+ if (this.level.sakuraConfig.dispenserRandomItemSelection || this instanceof DropperBlockEntity) {
|
||||
+ if (!((ItemStack) this.items.get(k)).isEmpty() && DispenserBlockEntity.RANDOM.nextInt(j++) == 0) {
|
||||
+ i = k;
|
||||
+ }
|
||||
+ } else if (!this.items.get(k).isEmpty()) {
|
||||
@@ -5,15 +5,15 @@ Subject: [PATCH] Add instant mob death animation
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 691f2c1d00d3cb17af017c997b11525709d6cd15..f2e0f4eb5f07ef4bd31282f3d12b8d8380ce22a0 100644
|
||||
index 94a98385742888544815e24ff39338f604d4ca86..3dd0fc22946459679aabb31bfe4ddb0580aa85f0 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -1696,6 +1696,12 @@ public abstract class LivingEntity extends Entity {
|
||||
@@ -1655,6 +1655,12 @@ public abstract class LivingEntity extends Entity {
|
||||
this.createWitherRose(entityliving);
|
||||
}
|
||||
|
||||
+ // Sakura start
|
||||
+ if (this.dead && this.level.sakuraConfig().entity.instantDeathAnimation && !(this instanceof Player)) {
|
||||
+ if (this.dead && this.level.sakuraConfig.instantDeathAnimation && !(this instanceof Player)) {
|
||||
+ this.deathTime = 20;
|
||||
+ return;
|
||||
+ }
|
||||
@@ -5,15 +5,15 @@ Subject: [PATCH] Configure fluids breaking redstone
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
|
||||
index 90b4373dd4c0b4c05c69714b10639d20c69f60f9..5089f51667912627cfeaac79be689aee151110ae 100644
|
||||
index 1f267a6815c51cc89e708ca5117bdc9f1955af33..8a23051a6c0dd230fb8ff805638a91aeaf9e9729 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
|
||||
@@ -465,6 +465,10 @@ public abstract class FlowingFluid extends Fluid {
|
||||
@@ -453,6 +453,10 @@ public abstract class FlowingFluid extends Fluid {
|
||||
|
||||
if (block instanceof LiquidBlockContainer) {
|
||||
return ((LiquidBlockContainer) block).canPlaceLiquid(world, pos, state, fluid);
|
||||
+ // Sakura start
|
||||
+ } else if (world instanceof Level level && !level.sakuraConfig().technical.redstone.fluidsBreakRedstone && (state.isSignalSource() || state.getBlock() instanceof net.minecraft.world.level.block.CarpetBlock)) {
|
||||
+ } else if (world instanceof Level level && !level.sakuraConfig.fluidsBreakRedstone && (state.isSignalSource() || state.getBlock() instanceof net.minecraft.world.level.block.CarpetBlock)) {
|
||||
+ return false;
|
||||
+ // Sakura end
|
||||
} else if (!(block instanceof DoorBlock) && !state.is(BlockTags.SIGNS) && !state.is(Blocks.LADDER) && !state.is(Blocks.SUGAR_CANE) && !state.is(Blocks.BUBBLE_COLUMN)) {
|
||||
@@ -1,28 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samsuik <40902469+Samsuik@users.noreply.github.com>
|
||||
Date: Thu, 7 Dec 2023 16:30:24 +0000
|
||||
Subject: [PATCH] Configure mob spawner defaults
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
||||
index af799b61cec48ca290ed66cb47cfc0b244ac41a7..c7c11747879fecd0e01a4c5de1c396957303f3bc 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
||||
@@ -47,7 +47,16 @@ public abstract class BaseSpawner {
|
||||
public int spawnRange = 4;
|
||||
private int tickDelay = 0; // Paper
|
||||
|
||||
- public BaseSpawner() {}
|
||||
+ // Sakura start - configure spawner defaults
|
||||
+ public BaseSpawner() {
|
||||
+ this.minSpawnDelay = me.samsuik.sakura.configuration.GlobalConfiguration.get().environment.mobSpawnerDefaults.minSpawnDelay;
|
||||
+ this.maxSpawnDelay = me.samsuik.sakura.configuration.GlobalConfiguration.get().environment.mobSpawnerDefaults.maxSpawnDelay;
|
||||
+ this.spawnCount = me.samsuik.sakura.configuration.GlobalConfiguration.get().environment.mobSpawnerDefaults.spawnCount;
|
||||
+ this.maxNearbyEntities = me.samsuik.sakura.configuration.GlobalConfiguration.get().environment.mobSpawnerDefaults.maxNearbyEntities;
|
||||
+ this.requiredPlayerRange = me.samsuik.sakura.configuration.GlobalConfiguration.get().environment.mobSpawnerDefaults.requiredPlayerRange;
|
||||
+ this.spawnRange = me.samsuik.sakura.configuration.GlobalConfiguration.get().environment.mobSpawnerDefaults.spawnRange;
|
||||
+ // Sakura end
|
||||
+ }
|
||||
|
||||
public void setEntityId(EntityType<?> type, @Nullable Level world, RandomSource random, BlockPos pos) {
|
||||
this.getOrCreateNextSpawnData(world, random, pos).getEntityToSpawn().putString("id", BuiltInRegistries.ENTITY_TYPE.getKey(type).toString());
|
||||
@@ -5,15 +5,15 @@ Subject: [PATCH] Option to disable explosions hurting players
|
||||
|
||||
|
||||
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 0807d9d33131bf36b02f075e2150eaf33774ad27..62b1009b28c28307e2226248181721bf67bfa079 100644
|
||||
index 92a7962edb01d5ef36a9e35cc0b6bacc879ccff2..6bd7e714d3d1242acfad7e701d425b4b456ad73a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -926,6 +926,11 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -903,6 +903,11 @@ public abstract class Player extends LivingEntity {
|
||||
|
||||
@Override
|
||||
public boolean isInvulnerableTo(DamageSource damageSource) {
|
||||
+ // Sakura start
|
||||
+ if (!this.level.sakuraConfig().cannons.explosion.explosionsHurtPlayers && damageSource.isExplosion()) {
|
||||
+ if (!this.level.sakuraConfig.explosionsHurtPlayers && damageSource.isExplosion()) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ // Sakura end
|
||||
@@ -5,17 +5,17 @@ Subject: [PATCH] Iron golems take fall damage
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/IronGolem.java b/src/main/java/net/minecraft/world/entity/animal/IronGolem.java
|
||||
index e73acfa2f5a4066fa1beee1758082a2fe97a43b3..3249197545ab5597b677c9e698c0aecaf024aeee 100644
|
||||
index 8299b48bad7a38d4310ca93b1de37d6c9170fc09..fc2b862d87d97aab1b31d6555cfc4940604f46b4 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/IronGolem.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/IronGolem.java
|
||||
@@ -249,6 +249,20 @@ public class IronGolem extends AbstractGolem implements NeutralMob {
|
||||
@@ -237,6 +237,20 @@ public class IronGolem extends AbstractGolem implements NeutralMob {
|
||||
|
||||
}
|
||||
|
||||
+ // Sakura start
|
||||
+ @Override
|
||||
+ protected int calculateFallDamage(float fallDistance, float damageMultiplier) {
|
||||
+ if (!this.level.sakuraConfig().entity.ironGolemsTakeFalldamage) {
|
||||
+ if (!this.level.sakuraConfig.ironGolemsTakeFalldamage) {
|
||||
+ return super.calculateFallDamage(fallDistance, damageMultiplier);
|
||||
+ } else {
|
||||
+ net.minecraft.world.effect.MobEffectInstance mobeffect = this.getEffect(net.minecraft.world.effect.MobEffects.JUMP);
|
||||
@@ -5,18 +5,18 @@ Subject: [PATCH] Add explosions dropping items config
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index 6f610de34ac165d2e9a2d353eee46f26da2c22c1..4047610d0a01ce58f023da9a810ea3f5320892e7 100644
|
||||
index c1effe8ecd110ac39103cc7778e7070ac9c33732..68b9b340b6dddcf29f7c3d80600854dd87b67f65 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -626,6 +626,11 @@ public class Explosion {
|
||||
@@ -623,6 +623,11 @@ public class Explosion {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Sakura start - config for explosions dropping items
|
||||
+ if (!this.level.sakuraConfig().cannons.explosion.explosionsDropItems) {
|
||||
+ if (!this.level.sakuraConfig.explosionsDropItems) {
|
||||
+ objectarraylist.clear();
|
||||
+ }
|
||||
+ // Sakura end - config for explosions dropping items
|
||||
objectlistiterator = objectarraylist.iterator();
|
||||
ObjectListIterator objectlistiterator = objectarraylist.iterator();
|
||||
|
||||
while (objectlistiterator.hasNext()) {
|
||||
@@ -5,12 +5,12 @@ Subject: [PATCH] Optimise check inside blocks and fluids
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 28e1768bdcc2c45643272b759da95452a324a59d..868649a111694e0d0c267f7fdc5ffd3fd01cd748 100644
|
||||
index f2dab7d69cd26474de88eae95b47f68414232cf6..80dfd159f8f71f9a6de38334d9ec5a50120ed324 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -1867,14 +1867,34 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
BlockPos blockposition1 = new BlockPos(axisalignedbb.maxX - offset, axisalignedbb.maxY - offset, axisalignedbb.maxZ - offset);
|
||||
// Sakura end
|
||||
@@ -1763,14 +1763,34 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
BlockPos blockposition = new BlockPos(axisalignedbb.minX + 0.001D, axisalignedbb.minY + 0.001D, axisalignedbb.minZ + 0.001D);
|
||||
BlockPos blockposition1 = new BlockPos(axisalignedbb.maxX - 0.001D, axisalignedbb.maxY - 0.001D, axisalignedbb.maxZ - 0.001D);
|
||||
|
||||
- if (this.level.hasChunksAt(blockposition, blockposition1)) {
|
||||
+ // Sakura start - optimise check inside blocks
|
||||
@@ -47,7 +47,7 @@ index 28e1768bdcc2c45643272b759da95452a324a59d..868649a111694e0d0c267f7fdc5ffd3f
|
||||
|
||||
try {
|
||||
iblockdata.entityInside(this.level, blockposition_mutableblockposition, this);
|
||||
@@ -4456,7 +4476,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -4245,7 +4265,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
}
|
||||
|
||||
public boolean updateFluidHeightAndDoFluidPushing(TagKey<Fluid> tag, double speed) {
|
||||
@@ -56,7 +56,7 @@ index 28e1768bdcc2c45643272b759da95452a324a59d..868649a111694e0d0c267f7fdc5ffd3f
|
||||
return false;
|
||||
} else {
|
||||
AABB axisalignedbb = this.getBoundingBox().deflate(0.001D);
|
||||
@@ -4473,11 +4493,31 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -4262,11 +4282,31 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
int k1 = 0;
|
||||
BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
|
||||
|
||||
@@ -6,15 +6,15 @@ Subject: [PATCH] Avoid searching for lava if throttled water flow speed is
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/LiquidBlock.java b/src/main/java/net/minecraft/world/level/block/LiquidBlock.java
|
||||
index 51dc3b81fcb76b1bc185486db26ca2a36ca36e98..211f4574c3053487ce689efc5cfc0f6d94b629a8 100644
|
||||
index 30fd979fb5e375cbe4bacb441d7192b9a20b4a81..f4f4ae2583bdbca4d9db9f20221d68d1881be2cd 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/LiquidBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/LiquidBlock.java
|
||||
@@ -113,7 +113,7 @@ public class LiquidBlock extends Block implements BucketPickup {
|
||||
@@ -114,7 +114,7 @@ public class LiquidBlock extends Block implements BucketPickup {
|
||||
|
||||
// Paper start - Get flow speed. Throttle if its water and flowing adjacent to lava
|
||||
public int getFlowSpeed(Level world, BlockPos blockposition) {
|
||||
- if (this.material == net.minecraft.world.level.material.Material.WATER) {
|
||||
+ if (this.material == net.minecraft.world.level.material.Material.WATER && this.fluid.getTickDelay(world) != world.paperConfig().environment.waterOverLavaFlowSpeed) { // Sakura
|
||||
- if (this.material == Material.WATER) {
|
||||
+ if (this.material == Material.WATER && this.fluid.getTickDelay(world) != world.paperConfig.waterOverLavaFlowSpeed) { // Sakura
|
||||
if (
|
||||
world.getMaterialIfLoaded(blockposition.north(1)) == net.minecraft.world.level.material.Material.LAVA ||
|
||||
world.getMaterialIfLoaded(blockposition.south(1)) == net.minecraft.world.level.material.Material.LAVA ||
|
||||
world.getMaterialIfLoaded(blockposition.north(1)) == Material.LAVA ||
|
||||
world.getMaterialIfLoaded(blockposition.south(1)) == Material.LAVA ||
|
||||
@@ -0,0 +1,29 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samsuik <kfian294ma4@gmail.com>
|
||||
Date: Mon, 22 Jan 2024 15:52:33 +0000
|
||||
Subject: [PATCH] Calculate biome noise once per chunk section
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
||||
index b11ad90c0956ac1b8ee069fa3f4553a2b4ce88e9..4ec096938dd66966ed3782d4e80bc4173045cd3c 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
||||
@@ -314,11 +314,17 @@ public class LevelChunkSection {
|
||||
try {
|
||||
int k = QuartPos.fromBlock(this.bottomBlockY());
|
||||
boolean flag = true;
|
||||
+ Holder<Biome> biomeHolder = null; // Sakura - calculate biome noise once per chunk section
|
||||
|
||||
for (int l = 0; l < 4; ++l) {
|
||||
for (int i1 = 0; i1 < 4; ++i1) {
|
||||
for (int j1 = 0; j1 < 4; ++j1) {
|
||||
- datapaletteblock.getAndSetUnchecked(l, i1, j1, biomeSupplier.getNoiseBiome(x + l, k + i1, z + j1, sampler));
|
||||
+ // Sakura start - calculate biome noise once per chunk section
|
||||
+ if (biomeHolder == null || !me.samsuik.sakura.configuration.SakuraGlobalConfig.get().calculateBiomeNoiseOncePerChunkSection) {
|
||||
+ biomeHolder = biomeSupplier.getNoiseBiome(x + l, k + i1, z + j1, sampler);
|
||||
+ }
|
||||
+ datapaletteblock.getAndSetUnchecked(l, i1, j1, biomeHolder);
|
||||
+ // Sakura end - calculate biome noise once per chunk section
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Fix doEntityDrops gamerule preventing falling blocks from
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
index 358a2a5de2c39bb1b3829af29a4a70f2b720dc24..d4e8bffc31415663fd3628ad33acc2d59e2036ca 100644
|
||||
index 599c934dd1bc99e9c2a069c4f5a6050283c4149f..b1f47ff80ed96c9f3ea1e4af45143c0d148c7226 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
@@ -359,10 +359,14 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -357,10 +357,14 @@ public class FallingBlockEntity extends Entity {
|
||||
tileentity.setChanged();
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Add entity travel distance limits
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index ab5472c27f94e196a2747466f8721173cef937fc..c32140ded7da15123774b2443830528598b982d4 100644
|
||||
index 71f96f0716e6001ea74690d43160c08ca6a3024e..7f7aae5c2e14dba493e44778254a45f51fd32ce4 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -1219,6 +1219,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -1143,6 +1143,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
if (isActive) { // Paper - EAR 2
|
||||
TimingHistory.activatedEntityTicks++;
|
||||
entity.tick();
|
||||
@@ -21,10 +21,10 @@ index ab5472c27f94e196a2747466f8721173cef937fc..c32140ded7da15123774b24438305285
|
||||
} else { entity.inactiveTick(); } // Paper - EAR 2
|
||||
this.getProfiler().pop();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 868649a111694e0d0c267f7fdc5ffd3fd01cd748..13906fc7d31e11d75754fe2c39c5ddf267d5ddb0 100644
|
||||
index 80dfd159f8f71f9a6de38334d9ec5a50120ed324..6934dec885c91d44a6c81bd6df75c2f5420e1fc3 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -703,6 +703,19 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -587,6 +587,19 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
return false;
|
||||
}
|
||||
// Sakura end - Treat all collidable blocks as full when moving fast
|
||||
@@ -42,13 +42,13 @@ index 868649a111694e0d0c267f7fdc5ffd3fd01cd748..13906fc7d31e11d75754fe2c39c5ddf2
|
||||
+ }
|
||||
+ // Sakura end - entity travel distance limits
|
||||
|
||||
public Entity(EntityType<?> type, Level world) {
|
||||
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
|
||||
@@ -750,6 +763,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
// Paper start
|
||||
/**
|
||||
@@ -684,6 +697,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
this.setPos(0.0D, 0.0D, 0.0D);
|
||||
this.eyeHeight = this.getEyeHeight(net.minecraft.world.entity.Pose.STANDING, this.dimensions);
|
||||
this.mergeLevel = level.sakuraConfig().cannons.mergeLevel; // Sakura
|
||||
+ this.travelDistanceLimit = Math.pow(level.sakuraConfig().entity.chunkTravelLimit.getOrDefault(type, Integer.MAX_VALUE) * 16.0, 2); // Sakura - entity travel distance limits
|
||||
this.mergeLevel = this.level.sakuraConfig.mergeLevel; // Sakura
|
||||
+ this.travelDistanceLimit = Math.pow(this.level.sakuraConfig.chunkTravelLimit.getOrDefault(type, Integer.MAX_VALUE) * 16.0, 2); // Sakura - entity travel distance limits
|
||||
}
|
||||
|
||||
public boolean isColliding(BlockPos pos, BlockState state) {
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Configure potion speed and breaking inside entities
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
||||
index 893975e8587b9036f622e2088c302e33004496d2..b0b96d3e254e96ca5b61ce7faea17baa9f85be23 100644
|
||||
index ccaa97956e40c6a79371d813719f65687991ec5b..73a9eb6fa8b33989f6da5e5e2455454528957631 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
||||
@@ -122,7 +122,7 @@ public abstract class Projectile extends Entity {
|
||||
@@ -121,7 +121,7 @@ public abstract class Projectile extends Entity {
|
||||
super.tick();
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ index 893975e8587b9036f622e2088c302e33004496d2..b0b96d3e254e96ca5b61ce7faea17baa
|
||||
|
||||
if (entity != null) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ProjectileUtil.java b/src/main/java/net/minecraft/world/entity/projectile/ProjectileUtil.java
|
||||
index 0524161f7cb414d526e6118258bddd989be6cc9a..ce237e75637d15e2eee70447feb97cbcbc6d384c 100644
|
||||
index 0524161f7cb414d526e6118258bddd989be6cc9a..dc02496d6c27290a0f6c49852e95b1014128e2fc 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/ProjectileUtil.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/ProjectileUtil.java
|
||||
@@ -29,7 +29,14 @@ public final class ProjectileUtil {
|
||||
@@ -28,7 +28,7 @@ index 0524161f7cb414d526e6118258bddd989be6cc9a..ce237e75637d15e2eee70447feb97cbc
|
||||
- HitResult hitResult2 = getEntityHitResult(level, entity, vec32, vec33, entity.getBoundingBox().expandTowards(entity.getDeltaMovement()).inflate(1.0D), predicate);
|
||||
+ // Sakura start - configure potion mechanics
|
||||
+ final HitResult hitResult2;
|
||||
+ if (level.sakuraConfig().entity.thrownPotion.allowBreakingInsideEntities && entity instanceof ThrownPotion) {
|
||||
+ if (level.sakuraConfig.allowBreakingInsideEntities && entity instanceof ThrownPotion) {
|
||||
+ hitResult2 = getEntityHitResult(entity, vec32, vec33, entity.getBoundingBox().expandTowards(vec3).inflate(1.0), predicate, 0.3f);
|
||||
+ } else {
|
||||
+ hitResult2 = getEntityHitResult(level, entity, vec32, vec33, entity.getBoundingBox().expandTowards(vec3).inflate(1.0), predicate, 0.3f);
|
||||
@@ -38,10 +38,10 @@ index 0524161f7cb414d526e6118258bddd989be6cc9a..ce237e75637d15e2eee70447feb97cbc
|
||||
hitResult = hitResult2;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
|
||||
index 1f1519c1b33d16eba59546c86f20a099486441d7..22afbd3054875cd769f42a3fbd89b51a2e1d94af 100644
|
||||
index fee09e6ff72cf1da389d5811dd005642cd50a5b4..4b51b792d69bb5fa69e21bd9f905a8c67046087f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
|
||||
@@ -60,6 +60,25 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
|
||||
@@ -58,6 +58,25 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
|
||||
super(EntityType.POTION, x, y, z, world);
|
||||
}
|
||||
|
||||
@@ -51,16 +51,16 @@ index 1f1519c1b33d16eba59546c86f20a099486441d7..22afbd3054875cd769f42a3fbd89b51a
|
||||
+ super.shoot(x, y, z, speed, divergence);
|
||||
+
|
||||
+ net.minecraft.world.phys.Vec3 movement = getDeltaMovement();
|
||||
+ double moveX = movement.x * this.level.sakuraConfig().entity.thrownPotion.horizontalSpeed;
|
||||
+ double moveY = movement.y * this.level.sakuraConfig().entity.thrownPotion.verticalSpeed;
|
||||
+ double moveZ = movement.z * this.level.sakuraConfig().entity.thrownPotion.horizontalSpeed;
|
||||
+ double moveX = movement.x * this.level.sakuraConfig.horizontalSpeed;
|
||||
+ double moveY = movement.y * this.level.sakuraConfig.verticalSpeed;
|
||||
+ double moveZ = movement.z * this.level.sakuraConfig.horizontalSpeed;
|
||||
+
|
||||
+ setDeltaMovement(moveX, moveY, moveZ);
|
||||
+ this.setDeltaMovement(moveX, moveY, moveZ);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ protected final boolean checkLeftOwner() {
|
||||
+ return super.checkLeftOwner() || this.level.sakuraConfig().entity.thrownPotion.allowBreakingInsideEntities && this.tickCount >= 5;
|
||||
+ return super.checkLeftOwner() || this.level.sakuraConfig.allowBreakingInsideEntities && this.tickCount >= 5;
|
||||
+ }
|
||||
+ // Sakura end - configure potion mechanics
|
||||
+
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Add outline colliison to enderpearls
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ProjectileUtil.java b/src/main/java/net/minecraft/world/entity/projectile/ProjectileUtil.java
|
||||
index ce237e75637d15e2eee70447feb97cbcbc6d384c..1736d6c7c5ca0205b7be302a0574a08b4b9ca548 100644
|
||||
index dc02496d6c27290a0f6c49852e95b1014128e2fc..92b0c54b88fab59cfb8cf69cb04bbcf2ce8ac6e3 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/ProjectileUtil.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/ProjectileUtil.java
|
||||
@@ -19,12 +19,17 @@ import net.minecraft.world.phys.HitResult;
|
||||
@@ -28,17 +28,17 @@ index ce237e75637d15e2eee70447feb97cbcbc6d384c..1736d6c7c5ca0205b7be302a0574a08b
|
||||
vec33 = hitResult.getLocation();
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrowableProjectile.java b/src/main/java/net/minecraft/world/entity/projectile/ThrowableProjectile.java
|
||||
index 88181c59e604ba3b132b9e695cef5eaf5b836029..864043a6abb48372231bb847af3f8c76e933194d 100644
|
||||
index 94d09b05737679b133ec462815b010b19c01b4fa..74d9b158af6ee5cff046534fd99505102d2de0e4 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/ThrowableProjectile.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrowableProjectile.java
|
||||
@@ -44,7 +44,15 @@ public abstract class ThrowableProjectile extends Projectile {
|
||||
@@ -45,7 +45,15 @@ public abstract class ThrowableProjectile extends Projectile {
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
- HitResult movingobjectposition = ProjectileUtil.getHitResult(this, this::canHitEntity);
|
||||
+ // Sakura start - enderpearls use outline for collision
|
||||
+ final net.minecraft.world.level.ClipContext.Block type;
|
||||
+ if (this.level.sakuraConfig().entity.enderPearl.useOutlineForCollision && this instanceof ThrownEnderpearl) {
|
||||
+ if (this.level.sakuraConfig.useOutlineForCollision && this instanceof ThrownEnderpearl) {
|
||||
+ type = net.minecraft.world.level.ClipContext.Block.OUTLINE;
|
||||
+ } else {
|
||||
+ type = net.minecraft.world.level.ClipContext.Block.COLLIDER;
|
||||
@@ -1,29 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samsuik <kfian294ma4@gmail.com>
|
||||
Date: Mon, 22 Jan 2024 15:52:33 +0000
|
||||
Subject: [PATCH] Calculate biome noise once per chunk section
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
||||
index b0c9fce9d4e06cac139e341d218d0b6aac1f1943..a256712836ae89bea619f534097d6111ba58d390 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
||||
@@ -315,11 +315,17 @@ public class LevelChunkSection {
|
||||
PalettedContainer<Holder<Biome>> datapaletteblock = this.biomes.recreate();
|
||||
int k = QuartPos.fromBlock(this.bottomBlockY());
|
||||
boolean flag = true;
|
||||
+ Holder<Biome> biomeHolder = null; // Sakura - calculate biome noise once per chunk section
|
||||
|
||||
for (int l = 0; l < 4; ++l) {
|
||||
for (int i1 = 0; i1 < 4; ++i1) {
|
||||
for (int j1 = 0; j1 < 4; ++j1) {
|
||||
- datapaletteblock.getAndSetUnchecked(l, i1, j1, biomeSupplier.getNoiseBiome(x + l, k + i1, z + j1, sampler));
|
||||
+ // Sakura start - calculate biome noise once per chunk section
|
||||
+ if (biomeHolder == null || !me.samsuik.sakura.configuration.GlobalConfiguration.get().environment.calculateBiomeNoiseOncePerChunkSection) {
|
||||
+ biomeHolder = biomeSupplier.getNoiseBiome(x + l, k + i1, z + j1, sampler);
|
||||
+ }
|
||||
+ datapaletteblock.getAndSetUnchecked(l, i1, j1, biomeHolder);
|
||||
+ // Sakura end - calculate biome noise once per chunk section
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,17 +5,17 @@ Subject: [PATCH] Disable player poses shrinking collision box
|
||||
|
||||
|
||||
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 62b1009b28c28307e2226248181721bf67bfa079..2c36d3c1939ca4185f4143b846c522a0c9f5b460 100644
|
||||
index 6bd7e714d3d1242acfad7e701d425b4b456ad73a..371737a38acb4ee5e7712e0e9d9db55f4303dfe1 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -2278,7 +2278,13 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -2246,7 +2246,13 @@ public abstract class Player extends LivingEntity {
|
||||
|
||||
@Override
|
||||
public EntityDimensions getDimensions(Pose pose) {
|
||||
- return (EntityDimensions) Player.POSES.getOrDefault(pose, Player.STANDING_DIMENSIONS);
|
||||
+ // Sakura start - player poses shrink collision box
|
||||
+ EntityDimensions dimensions = (EntityDimensions) Player.POSES.getOrDefault(pose, Player.STANDING_DIMENSIONS);
|
||||
+ if (!this.level.sakuraConfig().players.posesShrinkCollisionBox && dimensions.height == 0.6f) {
|
||||
+ if (!this.level.sakuraConfig.posesShrinkCollisionBox && dimensions.height == 0.6f) {
|
||||
+ dimensions = Player.STANDING_DIMENSIONS;
|
||||
+ }
|
||||
+ return dimensions;
|
||||
46
patches/server/0060-Mob-spawner-behaviour.patch
Normal file
46
patches/server/0060-Mob-spawner-behaviour.patch
Normal file
@@ -0,0 +1,46 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samsuik <kfian294ma4@gmail.com>
|
||||
Date: Thu, 28 Mar 2024 15:44:33 +0000
|
||||
Subject: [PATCH] Mob spawner behaviour
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
||||
index c0850e49aa677ecb16ce551ea0268ff9b172b642..7dac4a9707edc138cebcbf2eac88a82bcb17d120 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
||||
@@ -61,7 +61,7 @@ public abstract class BaseSpawner {
|
||||
}
|
||||
|
||||
public boolean isNearPlayer(Level world, BlockPos pos) {
|
||||
- return world.isAffectsSpawningPlayerNearby((double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, (double) this.requiredPlayerRange); // Paper
|
||||
+ return !world.sakuraConfig.requireNearbyPlayer || world.isAffectsSpawningPlayerNearby((double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, (double) this.requiredPlayerRange); // Sakura - mob spawner behaviour // Paper
|
||||
}
|
||||
|
||||
public void clientTick(Level world, BlockPos pos) {
|
||||
@@ -128,7 +128,7 @@ public abstract class BaseSpawner {
|
||||
if (!mobspawnerdata_a.blockLightLimit().isValueInRange(world.getBrightness(LightLayer.BLOCK, blockposition1)) || !mobspawnerdata_a.skyLightLimit().isValueInRange(world.getBrightness(LightLayer.SKY, blockposition1))) {
|
||||
continue;
|
||||
}
|
||||
- } else if (!SpawnPlacements.checkSpawnRules((EntityType) optional.get(), world, MobSpawnType.SPAWNER, blockposition1, world.getRandom())) {
|
||||
+ } else if (world.sakuraConfig.checkSpawnConditions && !SpawnPlacements.checkSpawnRules((EntityType) optional.get(), world, MobSpawnType.SPAWNER, blockposition1, world.getRandom())) { // Sakura - mob spawner behaviour
|
||||
continue;
|
||||
}
|
||||
// Paper start
|
||||
@@ -163,7 +163,7 @@ public abstract class BaseSpawner {
|
||||
return;
|
||||
}
|
||||
|
||||
- int k = world.getEntitiesOfClass(entity.getClass(), (new AABB((double) pos.getX(), (double) pos.getY(), (double) pos.getZ(), (double) (pos.getX() + 1), (double) (pos.getY() + 1), (double) (pos.getZ() + 1))).inflate((double) this.spawnRange)).size();
|
||||
+ int k = world.sakuraConfig.ignoreEntityLimit ? 0 : world.getEntitiesOfClass(entity.getClass(), (new AABB((double) pos.getX(), (double) pos.getY(), (double) pos.getZ(), (double) (pos.getX() + 1), (double) (pos.getY() + 1), (double) (pos.getZ() + 1))).inflate((double) this.spawnRange)).size(); // Sakura - mob spawner behaviour
|
||||
|
||||
if (k >= this.maxNearbyEntities) {
|
||||
this.delay(world, pos);
|
||||
@@ -175,7 +175,7 @@ public abstract class BaseSpawner {
|
||||
if (entity instanceof Mob) {
|
||||
Mob entityinsentient = (Mob) entity;
|
||||
|
||||
- if (this.nextSpawnData.getCustomSpawnRules().isEmpty() && !entityinsentient.checkSpawnRules(world, MobSpawnType.SPAWNER) || !entityinsentient.checkSpawnObstruction(world)) {
|
||||
+ if (world.sakuraConfig.checkSpawnConditions && (this.nextSpawnData.getCustomSpawnRules().isEmpty() && !entityinsentient.checkSpawnRules(world, MobSpawnType.SPAWNER) || !entityinsentient.checkSpawnObstruction(world))) { // Sakura - mob spawner behaviour
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Fix block placement causing physics when cancelled
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
index 31eed67d07097c7eb1b06547a9f556bcc709d96c..8970c0f6cf9a62f859e9a2bfd2f29b43bc0e1ac3 100644
|
||||
index 6837c965592d4584cfc958a1008b98791a0fc780..f09b1a806750c93b0be97e5a442b914202295665 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@@ -411,9 +411,16 @@ public final class ItemStack {
|
||||
@@ -390,9 +390,16 @@ public final class ItemStack {
|
||||
world.capturedTileEntities.clear(); // Paper - clear out tile entities as chests and such will pop loot
|
||||
// revert back all captured blocks
|
||||
world.preventPoiUpdated = true; // CraftBukkit - SPIGOT-5710
|
||||
@@ -26,10 +26,10 @@ index 31eed67d07097c7eb1b06547a9f556bcc709d96c..8970c0f6cf9a62f859e9a2bfd2f29b43
|
||||
|
||||
// Brute force all possible updates
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 3c37eaf12fc256a8edf5a5d060e4ca262ec83108..785f621ab4be55cb6f216bf11731aee2f40198c3 100644
|
||||
index bccb6bec25e693dfc60dc24807078768dbf1e6ed..e4a082384a4aacf2fa9c925ff5ebe7afb012c242 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -150,6 +150,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -145,6 +145,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
public org.bukkit.generator.ChunkGenerator generator;
|
||||
public static final boolean DEBUG_ENTITIES = Boolean.getBoolean("debug.entities"); // Paper
|
||||
|
||||
@@ -38,10 +38,10 @@ index 3c37eaf12fc256a8edf5a5d060e4ca262ec83108..785f621ab4be55cb6f216bf11731aee2
|
||||
public boolean captureBlockStates = false;
|
||||
public boolean captureTreeGeneration = false;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
|
||||
index a9f84d594e2adda096d872d4b7ca59e73305544b..42407844fb5af663f03bdcade2fe9c4a9e8058f8 100644
|
||||
index 50d96a6e2bcd4e276dbdbf99b55870782f92cc00..f94bcceb7c2749a9176d96c90832b0808de055f6 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
|
||||
@@ -475,7 +475,7 @@ public class RedStoneWireBlock extends Block {
|
||||
@@ -484,7 +484,7 @@ public class RedStoneWireBlock extends Block {
|
||||
|
||||
@Override
|
||||
public void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean moved) {
|
||||
@@ -50,15 +50,3 @@ index a9f84d594e2adda096d872d4b7ca59e73305544b..42407844fb5af663f03bdcade2fe9c4a
|
||||
super.onRemove(state, world, pos, newState, moved);
|
||||
if (!world.isClientSide) {
|
||||
Direction[] aenumdirection = Direction.values();
|
||||
diff --git a/src/main/java/net/minecraft/world/level/redstone/NeighborUpdater.java b/src/main/java/net/minecraft/world/level/redstone/NeighborUpdater.java
|
||||
index 19faa8f5f891c1ffbed0af8391dee8202433c447..2f07e1c8fc769a28f235858e1529ab154e0d2247 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/redstone/NeighborUpdater.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/redstone/NeighborUpdater.java
|
||||
@@ -52,6 +52,7 @@ public interface NeighborUpdater {
|
||||
|
||||
static void executeUpdate(Level world, BlockState state, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify) {
|
||||
try {
|
||||
+ if (world.preventNeighborUpdates) { return; } // Sakura - fix placement causing physics when event is cancelled
|
||||
// CraftBukkit start
|
||||
CraftWorld cworld = ((ServerLevel) world).getWorld();
|
||||
if (cworld != null) {
|
||||
@@ -0,0 +1,54 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samsuik <kfian294ma4@gmail.com>
|
||||
Date: Thu, 16 May 2024 21:20:52 +0100
|
||||
Subject: [PATCH] Use random chance for crop growth instead of age
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/CactusBlock.java b/src/main/java/net/minecraft/world/level/block/CactusBlock.java
|
||||
index 4323e5cc2054804243e8e2f24fd5447280f218de..7bb9d94d3a7241dcaf8d02f12ef6e698befb289f 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/CactusBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/CactusBlock.java
|
||||
@@ -46,6 +46,19 @@ public class CactusBlock extends Block {
|
||||
|
||||
@Override
|
||||
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
|
||||
+ // Sakura start - use random chance for crop growth
|
||||
+ if (world.sakuraConfig.useRandomChanceToGrow) {
|
||||
+ int modifier = world.spigotConfig.cactusModifier;
|
||||
+ if (random.nextFloat() >= modifier / (100.0f * 16)) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // set crop age to max so it grows right away
|
||||
+ state = state.setValue(CactusBlock.AGE, AGE.max);
|
||||
+ }
|
||||
+ this.ageAndGrow(state, world, pos, random);
|
||||
+ }
|
||||
+ private void ageAndGrow(BlockState state, ServerLevel world, BlockPos pos, Random random) {
|
||||
+ // Sakura end - use random chance for crop growth
|
||||
BlockPos blockposition1 = pos.above();
|
||||
|
||||
if (world.isEmptyBlock(blockposition1)) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java b/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java
|
||||
index 66c06e0f7c8d223a2b00bab57a15e3a705fe176a..9d0cde1cf6e89ef505010d38686ff540ade55e3c 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java
|
||||
@@ -45,6 +45,19 @@ public class SugarCaneBlock extends Block {
|
||||
|
||||
@Override
|
||||
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
|
||||
+ // Sakura start - use random chance for crop growth
|
||||
+ if (world.sakuraConfig.useRandomChanceToGrow) {
|
||||
+ int modifier = world.spigotConfig.caneModifier;
|
||||
+ if (random.nextFloat() >= modifier / (100.0f * 16)) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // set crop age to max so it grows right away
|
||||
+ state = state.setValue(SugarCaneBlock.AGE, AGE.max);
|
||||
+ }
|
||||
+ this.ageAndGrow(state, world, pos, random);
|
||||
+ }
|
||||
+ private void ageAndGrow(BlockState state, ServerLevel world, BlockPos pos, Random random) {
|
||||
+ // Sakura end - use random chance for crop growth
|
||||
if (world.isEmptyBlock(pos.above())) {
|
||||
int i;
|
||||
|
||||
@@ -48,10 +48,10 @@ index 0000000000000000000000000000000000000000..6cda6ba8e29587fd04b727ef18848476
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index f2e0f4eb5f07ef4bd31282f3d12b8d8380ce22a0..4de9d99999c82854460b08b8b841699132e2f1e9 100644
|
||||
index 3dd0fc22946459679aabb31bfe4ddb0580aa85f0..68623284e48a091c47efc78b238fd9a2afd07765 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -279,6 +279,64 @@ public abstract class LivingEntity extends Entity {
|
||||
@@ -275,6 +275,64 @@ public abstract class LivingEntity extends Entity {
|
||||
++this.noActionTime; // Above all the floats
|
||||
}
|
||||
// Spigot end
|
||||
@@ -64,7 +64,7 @@ index f2e0f4eb5f07ef4bd31282f3d12b8d8380ce22a0..4de9d99999c82854460b08b8b8416991
|
||||
+ if (attackSpeed != null) {
|
||||
+ attackSpeed.removeModifier(LEGACY_ATTACK_SPEED_MODIFIER);
|
||||
+
|
||||
+ if (this.level.sakuraConfig().players.combat.legacyCombatMechanics) {
|
||||
+ if (this.level.sakuraConfig.legacyCombatMechanics) {
|
||||
+ attackSpeed.addTransientModifier(LEGACY_ATTACK_SPEED_MODIFIER);
|
||||
+ }
|
||||
+ }
|
||||
@@ -74,7 +74,7 @@ index f2e0f4eb5f07ef4bd31282f3d12b8d8380ce22a0..4de9d99999c82854460b08b8b8416991
|
||||
+ AttributeInstance attackDamage = this.getAttribute(Attributes.ATTACK_DAMAGE);
|
||||
+ AttributeModifier legacyModifier = null;
|
||||
+
|
||||
+ if (this.level.sakuraConfig().players.combat.legacyCombatMechanics) {
|
||||
+ if (this.level.sakuraConfig.legacyCombatMechanics) {
|
||||
+ legacyModifier = this.getLegacyAttackModifier();
|
||||
+ }
|
||||
+
|
||||
@@ -116,12 +116,12 @@ index f2e0f4eb5f07ef4bd31282f3d12b8d8380ce22a0..4de9d99999c82854460b08b8b8416991
|
||||
|
||||
protected LivingEntity(EntityType<? extends LivingEntity> type, Level world) {
|
||||
super(type, world);
|
||||
@@ -2052,7 +2110,16 @@ public abstract class LivingEntity extends Entity {
|
||||
@@ -1969,7 +2027,16 @@ public abstract class LivingEntity extends Entity {
|
||||
protected float getDamageAfterArmorAbsorb(DamageSource source, float amount) {
|
||||
if (!source.isBypassArmor()) {
|
||||
// this.damageArmor(damagesource, f); // CraftBukkit - Moved into damageEntity0(DamageSource, float)
|
||||
+ // Sakura start - legacy combat mechanics
|
||||
+ if (!this.level.sakuraConfig().players.combat.legacyCombatMechanics) {
|
||||
+ if (!this.level.sakuraConfig.legacyCombatMechanics) {
|
||||
amount = CombatRules.getDamageAfterAbsorb(amount, (float) this.getArmorValue(), (float) this.getAttributeValue(Attributes.ARMOR_TOUGHNESS));
|
||||
+ } else {
|
||||
+ // See: applyArmorModifier(DamageSource, float)
|
||||
@@ -133,7 +133,7 @@ index f2e0f4eb5f07ef4bd31282f3d12b8d8380ce22a0..4de9d99999c82854460b08b8b8416991
|
||||
}
|
||||
|
||||
return amount;
|
||||
@@ -3142,6 +3209,12 @@ public abstract class LivingEntity extends Entity {
|
||||
@@ -3070,6 +3137,12 @@ public abstract class LivingEntity extends Entity {
|
||||
if (!itemstack1.isEmpty()) {
|
||||
this.getAttributes().addTransientAttributeModifiers(itemstack1.getAttributeModifiers(enumitemslot));
|
||||
}
|
||||
@@ -146,7 +146,7 @@ index f2e0f4eb5f07ef4bd31282f3d12b8d8380ce22a0..4de9d99999c82854460b08b8b8416991
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3288,7 +3361,7 @@ public abstract class LivingEntity extends Entity {
|
||||
@@ -3201,7 +3274,7 @@ public abstract class LivingEntity extends Entity {
|
||||
this.lastArmorItemStacks.set(slot.getIndex(), armor);
|
||||
}
|
||||
|
||||
@@ -156,24 +156,24 @@ index f2e0f4eb5f07ef4bd31282f3d12b8d8380ce22a0..4de9d99999c82854460b08b8b8416991
|
||||
}
|
||||
|
||||
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 2c36d3c1939ca4185f4143b846c522a0c9f5b460..979c2c8ac3ed68dc2c4741cddb0c4415326a9271 100644
|
||||
index 371737a38acb4ee5e7712e0e9d9db55f4303dfe1..77c6b49c89e13a85042bc3dd4d81f8c0a9d14224 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1251,7 +1251,7 @@ public abstract class Player extends LivingEntity {
|
||||
if (playerAttackEntityEvent.callEvent() && willAttack) { // Logic moved to willAttack local variable.
|
||||
{
|
||||
// Paper end
|
||||
@@ -1215,7 +1215,7 @@ public abstract class Player extends LivingEntity {
|
||||
public void attack(Entity target) {
|
||||
if (target.isAttackable()) {
|
||||
if (!target.skipAttackInteraction(this)) {
|
||||
- float f = (float) this.getAttributeValue(Attributes.ATTACK_DAMAGE);
|
||||
+ float f = this.getAttackDamageFromAttributes(); // Sakura - legacy combat mechanics
|
||||
float f1;
|
||||
|
||||
if (target instanceof LivingEntity) {
|
||||
@@ -1262,8 +1262,14 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -1226,8 +1226,14 @@ public abstract class Player extends LivingEntity {
|
||||
|
||||
float f2 = this.getAttackStrengthScale(0.5F);
|
||||
|
||||
+ // Sakura start - legacy combat mechanics
|
||||
+ if (!this.level.sakuraConfig().players.combat.legacyCombatMechanics) {
|
||||
+ if (!this.level.sakuraConfig.legacyCombatMechanics) {
|
||||
f *= 0.2F + f2 * f2 * 0.8F;
|
||||
f1 *= f2;
|
||||
+ } else if (f1 != 0.0) {
|
||||
@@ -183,16 +183,16 @@ index 2c36d3c1939ca4185f4143b846c522a0c9f5b460..979c2c8ac3ed68dc2c4741cddb0c4415
|
||||
// this.resetAttackCooldown(); // CraftBukkit - Moved to EntityLiving to reset the cooldown after the damage is dealt
|
||||
if (f > 0.0F || f1 > 0.0F) {
|
||||
boolean flag = f2 > 0.9F;
|
||||
@@ -1280,7 +1286,7 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -1244,7 +1250,7 @@ public abstract class Player extends LivingEntity {
|
||||
boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity; // Paper - Add critical damage API - conflict on change
|
||||
|
||||
flag2 = flag2 && !level.paperConfig().entities.behavior.disablePlayerCrits; // Paper
|
||||
flag2 = flag2 && !level.paperConfig.disablePlayerCrits; // Paper
|
||||
- flag2 = flag2 && !this.isSprinting();
|
||||
+ flag2 = flag2 && (this.level.sakuraConfig().players.combat.legacyCombatMechanics || !this.isSprinting()); // Sakura - legacy combat mechanics
|
||||
+ flag2 = flag2 && (this.level.sakuraConfig.legacyCombatMechanics || !this.isSprinting()); // Sakura - legacy combat mechanics
|
||||
if (flag2) {
|
||||
f *= 1.5F;
|
||||
}
|
||||
@@ -1472,6 +1478,27 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -1436,6 +1442,27 @@ public abstract class Player extends LivingEntity {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,15 +5,15 @@ Subject: [PATCH] Allow disabling sweep attacks
|
||||
|
||||
|
||||
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 979c2c8ac3ed68dc2c4741cddb0c4415326a9271..c990388f5b0146c9b94c8d825edb723f607d11df 100644
|
||||
index 77c6b49c89e13a85042bc3dd4d81f8c0a9d14224..180d561ecc88f2a190f1eb9dbe3cfe426d393be9 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1357,7 +1357,7 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -1321,7 +1321,7 @@ public abstract class Player extends LivingEntity {
|
||||
// Paper end
|
||||
}
|
||||
|
||||
- if (flag3) {
|
||||
+ if (flag3 && this.level.sakuraConfig().players.combat.allowSweepAttacks) { // Sakura - allow disabling sweep attacks
|
||||
+ if (flag3 && this.level.sakuraConfig.allowSweepAttacks) { // Sakura - allow disabling sweep attacks
|
||||
float f4 = 1.0F + EnchantmentHelper.getSweepingDamageRatio(this) * f;
|
||||
List<LivingEntity> list = this.level.getEntitiesOfClass(LivingEntity.class, target.getBoundingBox().inflate(1.0D, 0.25D, 1.0D));
|
||||
Iterator iterator = list.iterator();
|
||||
@@ -1,46 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samsuik <kfian294ma4@gmail.com>
|
||||
Date: Thu, 28 Mar 2024 15:44:33 +0000
|
||||
Subject: [PATCH] Mob spawner behaviour
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
||||
index c7c11747879fecd0e01a4c5de1c396957303f3bc..d97d1aa47590b7c8250f1221f078641e01e430eb 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
||||
@@ -64,7 +64,7 @@ public abstract class BaseSpawner {
|
||||
}
|
||||
|
||||
public boolean isNearPlayer(Level world, BlockPos pos) {
|
||||
- return world.hasNearbyAlivePlayerThatAffectsSpawning((double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, (double) this.requiredPlayerRange); // Paper - Affects Spawning API
|
||||
+ return !world.sakuraConfig().environment.mobSpawner.requireNearbyPlayer || world.hasNearbyAlivePlayerThatAffectsSpawning((double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, (double) this.requiredPlayerRange); // Sakura - mob spawner behaviour // Paper - Affects Spawning API
|
||||
}
|
||||
|
||||
public void clientTick(Level world, BlockPos pos) {
|
||||
@@ -135,7 +135,7 @@ public abstract class BaseSpawner {
|
||||
if (!mobspawnerdata_a.blockLightLimit().isValueInRange(world.getBrightness(LightLayer.BLOCK, blockposition1)) || !mobspawnerdata_a.skyLightLimit().isValueInRange(world.getBrightness(LightLayer.SKY, blockposition1))) {
|
||||
continue;
|
||||
}
|
||||
- } else if (!SpawnPlacements.checkSpawnRules((EntityType) optional.get(), world, MobSpawnType.SPAWNER, blockposition1, world.getRandom())) {
|
||||
+ } else if (world.sakuraConfig().environment.mobSpawner.checkSpawnConditions && !SpawnPlacements.checkSpawnRules((EntityType) optional.get(), world, MobSpawnType.SPAWNER, blockposition1, world.getRandom())) { // Sakura - mob spawner behaviour
|
||||
continue;
|
||||
}
|
||||
// Paper start
|
||||
@@ -170,7 +170,7 @@ public abstract class BaseSpawner {
|
||||
return;
|
||||
}
|
||||
|
||||
- int k = world.getEntitiesOfClass(entity.getClass(), (new AABB((double) pos.getX(), (double) pos.getY(), (double) pos.getZ(), (double) (pos.getX() + 1), (double) (pos.getY() + 1), (double) (pos.getZ() + 1))).inflate((double) this.spawnRange)).size();
|
||||
+ int k = world.sakuraConfig().environment.mobSpawner.ignoreEntityLimit ? 0 : world.getEntitiesOfClass(entity.getClass(), (new AABB((double) pos.getX(), (double) pos.getY(), (double) pos.getZ(), (double) (pos.getX() + 1), (double) (pos.getY() + 1), (double) (pos.getZ() + 1))).inflate((double) this.spawnRange)).size(); // Sakura - mob spawner behaviour
|
||||
|
||||
if (k >= this.maxNearbyEntities) {
|
||||
this.delay(world, pos);
|
||||
@@ -182,7 +182,7 @@ public abstract class BaseSpawner {
|
||||
if (entity instanceof Mob) {
|
||||
Mob entityinsentient = (Mob) entity;
|
||||
|
||||
- if (mobspawnerdata.getCustomSpawnRules().isEmpty() && !entityinsentient.checkSpawnRules(world, MobSpawnType.SPAWNER) || !entityinsentient.checkSpawnObstruction(world)) {
|
||||
+ if (world.sakuraConfig().environment.mobSpawner.checkSpawnConditions && (mobspawnerdata.getCustomSpawnRules().isEmpty() && !entityinsentient.checkSpawnRules(world, MobSpawnType.SPAWNER) || !entityinsentient.checkSpawnObstruction(world))) { // Sakura - mob spawner behaviour
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -5,15 +5,15 @@ Subject: [PATCH] Change shields to reduce damage
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 4de9d99999c82854460b08b8b841699132e2f1e9..659cf60f5a1da5c13ebdf2dc315f538265ba4a39 100644
|
||||
index 68623284e48a091c47efc78b238fd9a2afd07765..3e5bb455eb8f3591b564a59438671c8fdfba4996 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -2186,7 +2186,13 @@ public abstract class LivingEntity extends Entity {
|
||||
@@ -2101,7 +2101,13 @@ public abstract class LivingEntity extends Entity {
|
||||
Function<Double, Double> blocking = new Function<Double, Double>() {
|
||||
@Override
|
||||
public Double apply(Double f) {
|
||||
+ // Sakura start - shield damage reduction
|
||||
+ if (!level.sakuraConfig().players.combat.shieldDamageReduction || damagesource.getDirectEntity() instanceof AbstractArrow) {
|
||||
+ if (!LivingEntity.this.level.sakuraConfig.shieldDamageReduction || damagesource.getDirectEntity() instanceof AbstractArrow) {
|
||||
return -((LivingEntity.this.isDamageSourceBlocked(damagesource)) ? f : 0.0);
|
||||
+ } else {
|
||||
+ return -(LivingEntity.this.isBlocking() ? f * 0.5 : 0.0);
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Old enchanted golden apples
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 659cf60f5a1da5c13ebdf2dc315f538265ba4a39..7cb6e250bd1c14e557c359fe211d8a1f9b4de986 100644
|
||||
index 3e5bb455eb8f3591b564a59438671c8fdfba4996..e4cca2f8d39344cbc7987723b09882f591a273d7 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -4411,7 +4411,13 @@ public abstract class LivingEntity extends Entity {
|
||||
@@ -4308,7 +4308,13 @@ public abstract class LivingEntity extends Entity {
|
||||
Item item = stack.getItem();
|
||||
|
||||
if (item.isEdible()) {
|
||||
@@ -1,75 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samsuik <kfian294ma4@gmail.com>
|
||||
Date: Thu, 16 May 2024 21:20:52 +0100
|
||||
Subject: [PATCH] Use random chance for crop growth instead of age
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/CactusBlock.java b/src/main/java/net/minecraft/world/level/block/CactusBlock.java
|
||||
index 1ec242205b82a5a1f10deb2312795cc5dc157a76..2756ba14bdcd3b96dc945cd9281d2ec3eb9ffe9b 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/CactusBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/CactusBlock.java
|
||||
@@ -46,6 +46,19 @@ public class CactusBlock extends Block {
|
||||
|
||||
@Override
|
||||
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
||||
+ // Sakura start - use random chance for crop growth
|
||||
+ if (world.sakuraConfig().environment.crops.useRandomChanceToGrow) {
|
||||
+ int modifier = world.spigotConfig.cactusModifier;
|
||||
+ if (random.nextFloat() >= modifier / (100.0f * 16)) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // set crop age to max so it grows right away
|
||||
+ state = state.setValue(CactusBlock.AGE, AGE.max);
|
||||
+ }
|
||||
+ this.ageAndGrow(state, world, pos, random);
|
||||
+ }
|
||||
+ private void ageAndGrow(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
||||
+ // Sakura end - use random chance for crop growth
|
||||
BlockPos blockposition1 = pos.above();
|
||||
|
||||
if (world.isEmptyBlock(blockposition1)) {
|
||||
@@ -62,7 +75,11 @@ public class CactusBlock extends Block {
|
||||
if (j >= 15 || (modifier != 100 && random.nextFloat() < (modifier / (100.0f * 16)))) { // Spigot - SPIGOT-7159: Better modifier resolution
|
||||
CraftEventFactory.handleBlockGrowEvent(world, blockposition1, this.defaultBlockState()); // CraftBukkit
|
||||
BlockState iblockdata1 = (BlockState) state.setValue(CactusBlock.AGE, 0);
|
||||
-
|
||||
+ // Sakura start - use random chance for crop growth
|
||||
+ if (world.sakuraConfig().environment.crops.useRandomChanceToGrow) {
|
||||
+ world.neighborShapeChanged(Direction.UP, state, blockposition1, pos, 4, 1);
|
||||
+ }
|
||||
+ // Sakura end - use random chance for crop growth
|
||||
world.setBlock(pos, iblockdata1, 4);
|
||||
world.neighborChanged(iblockdata1, blockposition1, this, pos, false);
|
||||
} else if (modifier == 100 || random.nextFloat() < (modifier / (100.0f * 16))) { // Spigot - SPIGOT-7159: Better modifier resolution
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java b/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java
|
||||
index 6b400a4759c8c8612a3b5c96ca0d87ef9dc71435..c94c9eb7abc93f2baf79a3336d4b9b96ef3eea33 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java
|
||||
@@ -45,6 +45,19 @@ public class SugarCaneBlock extends Block {
|
||||
|
||||
@Override
|
||||
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
||||
+ // Sakura start - use random chance for crop growth
|
||||
+ if (world.sakuraConfig().environment.crops.useRandomChanceToGrow) {
|
||||
+ int modifier = world.spigotConfig.caneModifier;
|
||||
+ if (random.nextFloat() >= modifier / (100.0f * 16)) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // set crop age to max so it grows right away
|
||||
+ state = state.setValue(SugarCaneBlock.AGE, AGE.max);
|
||||
+ }
|
||||
+ this.ageAndGrow(state, world, pos, random);
|
||||
+ }
|
||||
+ private void ageAndGrow(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
||||
+ // Sakura end - use random chance for crop growth
|
||||
if (world.isEmptyBlock(pos.above())) {
|
||||
int i;
|
||||
|
||||
@@ -59,6 +72,7 @@ public class SugarCaneBlock extends Block {
|
||||
if (j >= 15 || (modifier != 100 && random.nextFloat() < (modifier / (100.0f * 16)))) { // Spigot - SPIGOT-7159: Better modifier resolution
|
||||
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, pos.above(), this.defaultBlockState()); // CraftBukkit
|
||||
world.setBlock(pos, (BlockState) state.setValue(SugarCaneBlock.AGE, 0), 4);
|
||||
+ // Sakura - conflict on change
|
||||
} else if (modifier == 100 || random.nextFloat() < (modifier / (100.0f * 16))) { // Spigot - SPIGOT-7159: Better modifier resolution
|
||||
world.setBlock(pos, (BlockState) state.setValue(SugarCaneBlock.AGE, j + 1), 4);
|
||||
}
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Configure fast health regen
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/food/FoodData.java b/src/main/java/net/minecraft/world/food/FoodData.java
|
||||
index 2934b6de1f1fb914a532ee20184df99d1acd8e65..9b4f0dfb6eea305063e145d45c98f57dd9c136a4 100644
|
||||
index 2934b6de1f1fb914a532ee20184df99d1acd8e65..f7c38dc7baf2500f958cab3c06bacdb96e83957c 100644
|
||||
--- a/src/main/java/net/minecraft/world/food/FoodData.java
|
||||
+++ b/src/main/java/net/minecraft/world/food/FoodData.java
|
||||
@@ -79,7 +79,7 @@ public class FoodData {
|
||||
@@ -13,7 +13,7 @@ index 2934b6de1f1fb914a532ee20184df99d1acd8e65..9b4f0dfb6eea305063e145d45c98f57d
|
||||
boolean flag = player.level.getGameRules().getBoolean(GameRules.RULE_NATURAL_REGENERATION);
|
||||
|
||||
- if (flag && this.saturationLevel > 0.0F && player.isHurt() && this.foodLevel >= 20) {
|
||||
+ if (flag && this.saturationLevel > 0.0F && player.isHurt() && this.foodLevel >= 20 && player.level.sakuraConfig().players.combat.fastHealthRegen) { // Sakura - configure fast health regen
|
||||
+ if (flag && this.saturationLevel > 0.0F && player.isHurt() && this.foodLevel >= 20 && player.level.sakuraConfig.fastHealthRegen) { // Sakura - configure fast health regen
|
||||
++this.tickTimer;
|
||||
if (this.tickTimer >= this.saturatedRegenRate) { // CraftBukkit
|
||||
float f = Math.min(this.saturationLevel, 6.0F);
|
||||
@@ -5,15 +5,15 @@ Subject: [PATCH] Add option for fishing hooks pulling entities
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
||||
index 70016e105066a16d19ebdf631cc3ef0a03466e3a..35151fa7c8bc8bcafffda6b0292e2c9c50caae43 100644
|
||||
index 5ad727d59f67a49c2ed5cb09be11c86e0b74d9f0..7b9a771cd1129963861cad97d49d43ba67b6ce66 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
||||
@@ -581,7 +581,7 @@ public class FishingHook extends Projectile {
|
||||
@@ -580,7 +580,7 @@ public class FishingHook extends Projectile {
|
||||
public void pullEntity(Entity entity) {
|
||||
Entity entity1 = this.getOwner();
|
||||
|
||||
- if (entity1 != null) {
|
||||
+ if (entity1 != null && (this.level.sakuraConfig().players.fishingHooksPullEntities || entity instanceof ItemEntity)) { // Sakura - Add option for fishing hooks pulling entities
|
||||
+ if (entity1 != null && (this.level.sakuraConfig.fishingHooksPullEntities || entity instanceof ItemEntity)) { // Sakura - Add option for fishing hooks pulling entities
|
||||
Vec3 vec3d = (new Vec3(entity1.getX() - this.getX(), entity1.getY() - this.getY(), entity1.getZ() - this.getZ())).scale(0.1D);
|
||||
|
||||
entity.setDeltaMovement(entity.getDeltaMovement().add(vec3d));
|
||||
@@ -5,23 +5,23 @@ Subject: [PATCH] Old combat sounds and particle effects
|
||||
|
||||
|
||||
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 c990388f5b0146c9b94c8d825edb723f607d11df..211d1dff3833bbf23a4d76ce70e8cf2ece2d8ec0 100644
|
||||
index 180d561ecc88f2a190f1eb9dbe3cfe426d393be9..618d9d066defa6fe941681e089ad7539f1738464 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1453,7 +1453,7 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -1417,7 +1417,7 @@ public abstract class Player extends LivingEntity {
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
- if (this.level instanceof ServerLevel && f5 > 2.0F) {
|
||||
+ if (this.level instanceof ServerLevel && f5 > 2.0F && !this.level.sakuraConfig().players.combat.oldSoundsAndParticleEffects) { // Sakura - old combat sounds and particles
|
||||
+ if (this.level instanceof ServerLevel && f5 > 2.0F && !this.level.sakuraConfig.oldSoundsAndParticleEffects) { // Sakura - old combat sounds and particles
|
||||
int k = (int) ((double) f5 * 0.5D);
|
||||
|
||||
((ServerLevel) this.level).sendParticles(ParticleTypes.DAMAGE_INDICATOR, target.getX(), target.getY(0.5D), target.getZ(), k, 0.1D, 0.0D, 0.1D, 0.2D);
|
||||
@@ -1937,6 +1937,7 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -1896,6 +1896,7 @@ public abstract class Player extends LivingEntity {
|
||||
}
|
||||
// Paper start - send SoundEffect to everyone who can see fromEntity
|
||||
private static void sendSoundEffect(Player fromEntity, double x, double y, double z, SoundEvent soundEffect, SoundSource soundCategory, float volume, float pitch) {
|
||||
+ if (fromEntity.level.sakuraConfig().players.combat.oldSoundsAndParticleEffects) return; // Sakura - old combat sounds and particles
|
||||
+ if (fromEntity.level.sakuraConfig.oldSoundsAndParticleEffects) return; // Sakura - old combat sounds and particles
|
||||
fromEntity.level.playSound(fromEntity, x, y, z, soundEffect, soundCategory, volume, pitch); // This will not send the effect to the entity himself
|
||||
if (fromEntity instanceof ServerPlayer) {
|
||||
((ServerPlayer) fromEntity).connection.send(new net.minecraft.network.protocol.game.ClientboundSoundPacket(net.minecraft.core.registries.BuiltInRegistries.SOUND_EVENT.wrapAsHolder(soundEffect), soundCategory, x, y, z, volume, pitch, fromEntity.random.nextLong()));
|
||||
((ServerPlayer) fromEntity).connection.send(new ClientboundSoundPacket(soundEffect, soundCategory, x, y, z, volume, pitch));
|
||||
@@ -5,15 +5,15 @@ Subject: [PATCH] Protect scaffolding from creepers
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index 4047610d0a01ce58f023da9a810ea3f5320892e7..ea37fb1f7107f38ae2de0c6335d83e4de8587b3b 100644
|
||||
index 68b9b340b6dddcf29f7c3d80600854dd87b67f65..edbe7bf8016c0f9d7f0edd960a5b8fa590020feb 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -326,6 +326,11 @@ public class Explosion {
|
||||
@@ -334,6 +334,11 @@ public class Explosion {
|
||||
return Optional.of(-0.3f);
|
||||
}
|
||||
// Sakura end - allow explosions to destroy lava
|
||||
+ // Sakura start - protect scaffolding from creepers
|
||||
+ if (this.level.sakuraConfig().cannons.explosion.protectScaffoldingFromCreepers && blockState.is(Blocks.SCAFFOLDING) && this.source instanceof net.minecraft.world.entity.monster.Creeper) {
|
||||
+ if (this.level.sakuraConfig.protectScaffoldingFromCreepers && blockState.is(Blocks.SCAFFOLDING) && this.source instanceof net.minecraft.world.entity.monster.Creeper) {
|
||||
+ return Optional.of(Blocks.BARRIER.getExplosionResistance());
|
||||
+ }
|
||||
+ // Sakura end - protect scaffolding from creepers
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Entity tracking range modifier
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index 5e326f26b5166b7ce79bad5724ae63392d53fa45..d7b3b3def7ae557dd8420096e8232a7be592ffcb 100644
|
||||
index ee7871ddd36b20206ef66372b04861d100601341..ed83c97b4859e1061f09bc6db6a36ae652d45c71 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -1620,7 +1620,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -2351,7 +2351,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
double vec3d_dx = player.getX() - this.entity.getX();
|
||||
double vec3d_dz = player.getZ() - this.entity.getZ();
|
||||
// Paper end - remove allocation of Vec3D here
|
||||
@@ -21,22 +21,22 @@ index 5e326f26b5166b7ce79bad5724ae63392d53fa45..d7b3b3def7ae557dd8420096e8232a7b
|
||||
double d2 = d0 * d0;
|
||||
boolean flag = d1 <= d2 && this.entity.broadcastToPlayer(player);
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 5f38f9a7aca3af47dc3454035a7faf1d30d05932..5b876f7ee8f34f553a5e02dd2a6771a374996950 100644
|
||||
index 8aea11619f256bcfd91cf9af968bee4daf0f3381..986ff99fe0e4d3dc080159a514044ffe0c846d11 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -269,6 +269,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -258,6 +258,7 @@ public class ServerPlayer extends Player {
|
||||
public double lastEntitySpawnRadiusSquared; // Paper - optimise isOutsideRange, this field is in blocks
|
||||
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
|
||||
public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper
|
||||
public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - there are a lot of changes to do if we change all methods leading to the event
|
||||
+ public double trackingRangeModifier = 1.0; // Sakura - entity tracking range modifier
|
||||
|
||||
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile) {
|
||||
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index aaa3b2aa8e8791d88e2fb08342ec8c133cd219d6..f05ede50e07805d2432c7ed6af02f8babb94c506 100644
|
||||
index f16ba5860484de0e211d954436d2e5106a651808..3461634deff779307be4e6a94d19cfcb5b3cbaae 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -2562,6 +2562,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2370,6 +2370,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
return (this.getHandle().clientViewDistance == null) ? Bukkit.getViewDistance() : this.getHandle().clientViewDistance;
|
||||
}
|
||||
|
||||
@@ -17,10 +17,10 @@ index a6b4cae3f04cda71629b5da3a08a8c4c7b51b8a7..b32a86c3b6e9d8b378626901389cf201
|
||||
entity.addDeltaMovement(x, y, z);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index ea37fb1f7107f38ae2de0c6335d83e4de8587b3b..26f65df8bb684f8f672c755f4c47cf9a64e459de 100644
|
||||
index edbe7bf8016c0f9d7f0edd960a5b8fa590020feb..43cca0134a6f609f88b6aab96a150543353bf1b6 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -490,6 +490,7 @@ public class Explosion {
|
||||
@@ -494,6 +494,7 @@ public class Explosion {
|
||||
if (entity.lastDamageCancelled) { // SPIGOT-5339, SPIGOT-6252, SPIGOT-6777: Skip entity if damage event was cancelled
|
||||
return; // Sakura - optimise vanilla explosions
|
||||
}
|
||||
@@ -5,17 +5,17 @@ Subject: [PATCH] Configurable left shooting and adjusting limits
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 13906fc7d31e11d75754fe2c39c5ddf267d5ddb0..8b7cb6929d40db0844b594282cf32d98e54c6217 100644
|
||||
index 6934dec885c91d44a6c81bd6df75c2f5420e1fc3..701597d3b809a0c62ad6b7302d55762e393fbcfc 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -716,6 +716,24 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -600,6 +600,24 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
return Math.max(x, z) >= this.travelDistanceLimit;
|
||||
}
|
||||
// Sakura end - entity travel distance limits
|
||||
+ // Sakura start - configurable left shooting and adjusting limits
|
||||
+ public final void limitLeftShooting() {
|
||||
+ Vec3 movement = this.getDeltaMovement();
|
||||
+ int threshold = this.level.sakuraConfig().cannons.restrictions.leftShootingThreshold.or(-1);
|
||||
+ int threshold = this.level.sakuraConfig.leftShootingThreshold.orElse(-1);
|
||||
+ if (threshold > 0 && (movement.x != 0.0 || movement.z != 0.0) && this.origin != null) {
|
||||
+ double travelledX = Math.abs(this.getX() - this.origin.getX());
|
||||
+ double travelledZ = Math.abs(this.getZ() - this.origin.getZ());
|
||||
@@ -31,16 +31,16 @@ index 13906fc7d31e11d75754fe2c39c5ddf267d5ddb0..8b7cb6929d40db0844b594282cf32d98
|
||||
+ }
|
||||
+ // Sakura end - configurable left shooting and adjusting limits
|
||||
|
||||
public Entity(EntityType<?> type, Level world) {
|
||||
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
|
||||
@@ -1654,6 +1672,25 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
// Paper start
|
||||
/**
|
||||
@@ -1567,6 +1585,25 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
final boolean xSmaller = this.physics == null || this.physics.afterOrEqual(1_14_0) ? Math.abs(x) < Math.abs(z)
|
||||
: this.physics.isLegacy() && Math.abs(x) > Math.abs(z);
|
||||
// Sakura end - physics version api
|
||||
+ // Sakura start - configurable left shooting and adjusting limits
|
||||
+ // NOTE: If scanAndCollide is made redundant by paper move this logic into CollisionUtil.
|
||||
+ // This is being after xSmaller is intentional, we do not want to change the adjust direction.
|
||||
+ int adjustDistance = this.level.sakuraConfig().cannons.restrictions.maxAdjustDistance.or(-1);
|
||||
+ int adjustDistance = this.level.sakuraConfig.maxAdjustDistance.orElse(-1);
|
||||
+ if (adjustDistance > 0) {
|
||||
+ if (xSmaller) { // adjust z -> x
|
||||
+ if (Math.abs(z) > adjustDistance) {
|
||||
@@ -60,10 +60,10 @@ index 13906fc7d31e11d75754fe2c39c5ddf267d5ddb0..8b7cb6929d40db0844b594282cf32d98
|
||||
if (y != 0.0) {
|
||||
y = this.scanY(currBoundingBox, y, bbList);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
index d4e8bffc31415663fd3628ad33acc2d59e2036ca..d38d6c269a5da6ff5b347c8838123d9f3b7593e4 100644
|
||||
index b1f47ff80ed96c9f3ea1e4af45143c0d148c7226..a42f0867c0b8eb81a3922da495d8672ef02983cb 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
@@ -257,6 +257,7 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -255,6 +255,7 @@ public class FallingBlockEntity extends Entity {
|
||||
// Sakura end - physics version api
|
||||
}
|
||||
|
||||
@@ -5,14 +5,14 @@ Subject: [PATCH] Allow projectiles to load chunks for collisions
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
index c56bc341ebb1592af9285d5e044951e7ae2ae0b2..070a0ce1c7140499be8222ad39e5ada0f79a0c82 100644
|
||||
index 53d0024daf6963ac4dab575666b0d6a74a39a958..e84bf61502c8c88ff1084ed14b859417736375cc 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
@@ -90,6 +90,7 @@ public abstract class AbstractArrow extends Projectile {
|
||||
@@ -88,6 +88,7 @@ public abstract class AbstractArrow extends Projectile {
|
||||
this.pickup = AbstractArrow.Pickup.DISALLOWED;
|
||||
this.baseDamage = 2.0D;
|
||||
this.soundEvent = this.getDefaultHitGroundSoundEvent();
|
||||
+ this.loadChunks = this.level.sakuraConfig().entity.projectilesLoadChunksForCollisions; // Sakura - allow projectiles to load chunks for collisions
|
||||
+ this.loadChunks = this.level.sakuraConfig.projectilesLoadChunksForCollisions; // Sakura - allow projectiles to load chunks for collisions
|
||||
}
|
||||
|
||||
protected AbstractArrow(EntityType<? extends AbstractArrow> type, double x, double y, double z, Level world) {
|
||||
@@ -5,15 +5,15 @@ Subject: [PATCH] Add max armour durability damage
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 7cb6e250bd1c14e557c359fe211d8a1f9b4de986..fd7c3b3bd3665a65c8412fd9455c2320878960a7 100644
|
||||
index e4cca2f8d39344cbc7987723b09882f591a273d7..4cf618bbdbad5dcc37dbceae891ee7fe67befa86 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -2278,6 +2278,12 @@ public abstract class LivingEntity extends Entity {
|
||||
@@ -2193,6 +2193,12 @@ public abstract class LivingEntity extends Entity {
|
||||
// Apply damage to armor
|
||||
if (!damagesource.isBypassArmor()) {
|
||||
float armorDamage = (float) (event.getDamage() + event.getDamage(DamageModifier.BLOCKING) + event.getDamage(DamageModifier.HARD_HAT));
|
||||
+ // Sakura start - add max armour durability damage
|
||||
+ int maxArmourDamage = this.level.sakuraConfig().players.combat.maxArmourDamage.or(-1);
|
||||
+ int maxArmourDamage = this.level.sakuraConfig.maxArmourDamage.orElse(-1);
|
||||
+ if (maxArmourDamage >= 0) {
|
||||
+ armorDamage = Math.min(armorDamage, maxArmourDamage);
|
||||
+ }
|
||||
@@ -27,10 +27,10 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index fd7c3b3bd3665a65c8412fd9455c2320878960a7..2111c8cbefadb998734eb1eb0c09492d3752bf66 100644
|
||||
index 4cf618bbdbad5dcc37dbceae891ee7fe67befa86..dbe40c2ef967166a6c315053a6a3196c3de94e96 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3755,7 +3755,10 @@ public abstract class LivingEntity extends Entity {
|
||||
@@ -3652,7 +3652,10 @@ public abstract class LivingEntity extends Entity {
|
||||
Vec3 vec3d1 = new Vec3(entity.getX(), entity.getEyeY(), entity.getZ());
|
||||
|
||||
// Paper - diff on change - used in CraftLivingEntity#hasLineOfSight(Location) and CraftWorld#lineOfSightExists
|
||||
@@ -64,10 +64,10 @@ index 04d45b2ddc3489c4d0764da1575cb9a373d9a490..5cb899dd7ab92552605e74b2840d57a4
|
||||
default BlockHitResult clip(ClipContext raytrace1, BlockPos blockposition) {
|
||||
// Paper start - Prevent raytrace from loading chunks
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 785f621ab4be55cb6f216bf11731aee2f40198c3..7c8c7f74bbb27ed8f23e2f99062e9502a3adf3f6 100644
|
||||
index e4a082384a4aacf2fa9c925ff5ebe7afb012c242..2cae6e4696071586a43b84ea216f02a53a56b11f 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -519,6 +519,90 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -385,6 +385,90 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
return x >= bb.minX && x <= bb.maxX && y >= bb.minY && y <= bb.maxY;
|
||||
}
|
||||
// Sakura end - physics version api
|
||||
@@ -156,5 +156,5 @@ index 785f621ab4be55cb6f216bf11731aee2f40198c3..7c8c7f74bbb27ed8f23e2f99062e9502
|
||||
+ }
|
||||
+ // Airplane end
|
||||
|
||||
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, Supplier<me.samsuik.sakura.configuration.WorldConfiguration> sakuraWorldConfigCreator, java.util.concurrent.Executor executor) { // Sakura // Paper - Async-Anti-Xray - Pass executor
|
||||
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
|
||||
public CraftServer getCraftServer() {
|
||||
return (CraftServer) Bukkit.getServer();
|
||||
@@ -25,10 +25,10 @@ index 5cb899dd7ab92552605e74b2840d57a40f4c1434..da60f48e50ecffd5bdd87badaaa7a515
|
||||
// Airplane end
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index 26f65df8bb684f8f672c755f4c47cf9a64e459de..8e8688402d27eaf79daf9027ac07e86f2a43a122 100644
|
||||
index 43cca0134a6f609f88b6aab96a150543353bf1b6..9b58f58ff40dc6952a8f32b6c1226f82a98fc6b8 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -373,6 +373,8 @@ public class Explosion {
|
||||
@@ -381,6 +381,8 @@ public class Explosion {
|
||||
// Sakura start - physics version api
|
||||
} else if (entity.physics().before(1_14_0)) {
|
||||
hitResult = entity.level.rayTrace(vec3d1, source);
|
||||
@@ -38,18 +38,18 @@ index 26f65df8bb684f8f672c755f4c47cf9a64e459de..8e8688402d27eaf79daf9027ac07e86f
|
||||
ClipContext.Block context = entity.physics().afterOrEqual(1_16_0) ? ClipContext.Block.COLLIDER : ClipContext.Block.OUTLINE;
|
||||
hitResult = entity.level.clip(new ClipContext(vec3d1, source, context, ClipContext.Fluid.NONE, entity)).getType();
|
||||
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 25ce337ed266be7bafeacd9eb6f53a9474775fc5..4b3a93feb78dccd33ab7caf792a86816423f26be 100644
|
||||
index da7b4783da35bc08f48f2fe31c4d06f9fb5e160f..f678238897402c7fc919b881f49df5d465fdb012 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
|
||||
@@ -734,6 +734,7 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
this.offsetType = (BlockBehaviour.OffsetType) blockbase_info.offsetType.apply(this.asState());
|
||||
this.spawnParticlesOnBreak = blockbase_info.spawnParticlesOnBreak;
|
||||
@@ -697,6 +697,7 @@ public abstract class BlockBehaviour {
|
||||
this.hasPostProcess = blockbase_info.hasPostProcess;
|
||||
this.emissiveRendering = blockbase_info.emissiveRendering;
|
||||
this.conditionallyFullOpaque = this.isOpaque() & this.isTransparentOnSomeFaces(); // Paper
|
||||
+ this.liquidBlock = block instanceof net.minecraft.world.level.block.LiquidBlock; // Sakura - optimise explosion raytracing
|
||||
}
|
||||
// Paper start - impl cached craft block data, lazy load to fix issue with loading at the wrong time
|
||||
private org.bukkit.craftbukkit.block.data.CraftBlockData cachedCraftBlockData;
|
||||
@@ -768,6 +769,12 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
@@ -736,6 +737,12 @@ public abstract class BlockBehaviour {
|
||||
return this.blockCollisionBehavior;
|
||||
}
|
||||
// Paper end
|
||||
@@ -61,7 +61,7 @@ index 25ce337ed266be7bafeacd9eb6f53a9474775fc5..4b3a93feb78dccd33ab7caf792a86816
|
||||
+ // Sakura end - optimise explosion raytracing
|
||||
|
||||
public void initCache() {
|
||||
this.fluidState = ((Block) this.owner).getFluidState(this.asState());
|
||||
this.fluid = this.getBlock().getFluidState(this.asState()); // Paper - moved from getFluid()
|
||||
diff --git a/src/main/java/net/minecraft/world/phys/shapes/VoxelShape.java b/src/main/java/net/minecraft/world/phys/shapes/VoxelShape.java
|
||||
index 2182afd1b95acf14c55bddfeec17dae0a63e1f00..5ef1748014ed4f9334fccc5f1344d676a19a2432 100644
|
||||
--- a/src/main/java/net/minecraft/world/phys/shapes/VoxelShape.java
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] PAPER - Check for block type in SculkSensorBlock#canActivate
|
||||
Backported https://github.com/PaperMC/Paper/commit/4e6a2a13a3e1f6fa1067a7821d2f018339395533
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/SculkSensorBlock.java b/src/main/java/net/minecraft/world/level/block/SculkSensorBlock.java
|
||||
index b1d86e5e04e762e9ed6136003cb3e05dffd7e8f1..99cf1d14efa76fec86d6502b37d0cb98d6c351d4 100644
|
||||
index 4a0e4b9c49f04d63ca0b7d0a6ce71680f911ff29..4a842e2302c1d186639c7e8f9766800e079dd125 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/SculkSensorBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/SculkSensorBlock.java
|
||||
@@ -200,7 +200,7 @@ public class SculkSensorBlock extends BaseEntityBlock implements SimpleWaterlogg
|
||||
@@ -223,7 +223,7 @@ public class SculkSensorBlock extends BaseEntityBlock implements SimpleWaterlogg
|
||||
}
|
||||
|
||||
public static boolean canActivate(BlockState state) {
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] PAPER Improve standard messenger logging
|
||||
Backported https://github.com/PaperMC/Paper/commit/7c9240f4a63b13be1fdcedbfb0270f9b49b75518
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index f05ede50e07805d2432c7ed6af02f8babb94c506..d5005ed440d5f51d18f30207751007e72eec0855 100644
|
||||
index 3461634deff779307be4e6a94d19cfcb5b3cbaae..138c0fd113c2cfd7be9554427a6a8c7c715a706f 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -2129,7 +2129,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -1950,7 +1950,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
// Paper end
|
||||
|
||||
public void addChannel(String channel) {
|
||||
@@ -9,10 +9,10 @@ as a result of redstone powering the trap door.
|
||||
Backported https://github.com/PaperMC/Paper/commit/4f9575eed827007f31ce17da471820fe8bc14573
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/TrapDoorBlock.java b/src/main/java/net/minecraft/world/level/block/TrapDoorBlock.java
|
||||
index 91966d9c90d30738a1912ab6ce81edd914b939ff..65d665aed39063dc799998777a3b562729aca48c 100644
|
||||
index c0d232e5ace817d64740ccfcad9880349410f5a1..42b776eaa5ada1fee7957ec82ee95efa7005190b 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/TrapDoorBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/TrapDoorBlock.java
|
||||
@@ -127,7 +127,26 @@ public class TrapDoorBlock extends HorizontalDirectionalBlock implements SimpleW
|
||||
@@ -129,7 +129,26 @@ public class TrapDoorBlock extends HorizontalDirectionalBlock implements SimpleW
|
||||
flag1 = eventRedstone.getNewCurrent() > 0;
|
||||
}
|
||||
// CraftBukkit end
|
||||
@@ -7,14 +7,14 @@ Subject: [PATCH] PAPER Make sure the player didn't disconnect when processing
|
||||
Backported https://github.com/PaperMC/Paper/commit/813d0399f9880c4ee5ccd3e60d9e20b358b70df2
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 60fc19f25245f491c31018ec7cb065ced3516c44..ca0e142503455d7c231627c4aa17337454c99d7d 100644
|
||||
index f451ed92f75a6f5553790ca97cabbcdfd0d3d169..ed872d7165982a28f702f258e342c3c681e3f5f4 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -2245,6 +2245,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
|
||||
if (optional.isPresent()) {
|
||||
this.server.submit(() -> {
|
||||
@@ -2114,6 +2114,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
boolean isSync = s.startsWith("/");
|
||||
if (isSync) {
|
||||
try {
|
||||
+ if (player.hasDisconnected()) return; // Paper
|
||||
this.performChatCommand(packet, (LastSeenMessages) optional.get());
|
||||
this.detectRateSpam("/" + packet.command()); // Spigot
|
||||
});
|
||||
this.server.server.playerCommandState = true;
|
||||
this.handleCommand(s);
|
||||
} finally {
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Improve paper biome cache locking
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
index 962c950ca9c7e047a3aec215d4faa73676049d36..f9f2119f6d48305641c088f76e2ef878fc776fe0 100644
|
||||
index bfe9dc935c87e01fb435d8b46ce413b84ca74856..526c7f4ae3388f5dbb5661f1be04ebb46f533f30 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
@@ -368,13 +368,28 @@ public class CraftBlock implements Block {
|
||||
@@ -366,13 +366,29 @@ public class CraftBlock implements Block {
|
||||
return (biome == null) ? Biome.CUSTOM : biome;
|
||||
}
|
||||
|
||||
@@ -20,8 +20,8 @@ index 962c950ca9c7e047a3aec215d4faa73676049d36..f9f2119f6d48305641c088f76e2ef878
|
||||
if (bio == null || bio == Biome.CUSTOM) {
|
||||
return null;
|
||||
}
|
||||
-
|
||||
- return registry.getHolderOrThrow(BIOME_KEY_CACHE.computeIfAbsent(bio, b -> ResourceKey.create(Registries.BIOME, CraftNamespacedKey.toMinecraft(b.getKey())))); // Paper - cache key
|
||||
|
||||
- return registry.getHolderOrThrow(BIOME_KEY_CACHE.computeIfAbsent(bio, b -> ResourceKey.create(net.minecraft.core.Registry.BIOME_REGISTRY, CraftNamespacedKey.toMinecraft(b.getKey())))); // Paper - cache key
|
||||
+ // NOTE: Could get rid of the map by splitting up this patch and storing a reference in Biome (under api)
|
||||
+ long stamp = BIOME_KEY_CACHE_LOCK.tryOptimisticRead();
|
||||
+ ResourceKey<net.minecraft.world.level.biome.Biome> biomeKey = null;
|
||||
@@ -32,7 +32,7 @@ index 962c950ca9c7e047a3aec215d4faa73676049d36..f9f2119f6d48305641c088f76e2ef878
|
||||
+ }
|
||||
+ if (biomeKey == null || !BIOME_KEY_CACHE_LOCK.validate(stamp)) {
|
||||
+ stamp = BIOME_KEY_CACHE_LOCK.writeLock();
|
||||
+ biomeKey = BIOME_KEY_CACHE.computeIfAbsent(bio, b -> ResourceKey.create(Registries.BIOME, CraftNamespacedKey.toMinecraft(b.getKey()))); // Paper - cache key
|
||||
+ biomeKey = BIOME_KEY_CACHE.computeIfAbsent(bio, b -> ResourceKey.create(net.minecraft.core.Registry.BIOME_REGISTRY, CraftNamespacedKey.toMinecraft(b.getKey()))); // Paper - cache key
|
||||
+ BIOME_KEY_CACHE_LOCK.unlockWrite(stamp);
|
||||
+ }
|
||||
+ return registry.getHolderOrThrow(biomeKey);
|
||||
@@ -5,11 +5,11 @@ Subject: [PATCH] Add lava flow speed api
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/LiquidBlock.java b/src/main/java/net/minecraft/world/level/block/LiquidBlock.java
|
||||
index 211f4574c3053487ce689efc5cfc0f6d94b629a8..0a53c34c051e5beb27f3250fdd501d672ea108b7 100644
|
||||
index f4f4ae2583bdbca4d9db9f20221d68d1881be2cd..4e54b631477b73c44b268d3a99af2468a9ca6b4f 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/LiquidBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/LiquidBlock.java
|
||||
@@ -123,7 +123,7 @@ public class LiquidBlock extends Block implements BucketPickup {
|
||||
return world.paperConfig().environment.waterOverLavaFlowSpeed;
|
||||
@@ -124,7 +124,7 @@ public class LiquidBlock extends Block implements BucketPickup {
|
||||
return world.paperConfig.waterOverLavaFlowSpeed;
|
||||
}
|
||||
}
|
||||
- return this.fluid.getTickDelay(world);
|
||||
@@ -18,7 +18,7 @@ index 211f4574c3053487ce689efc5cfc0f6d94b629a8..0a53c34c051e5beb27f3250fdd501d67
|
||||
// Paper end
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/material/Fluid.java b/src/main/java/net/minecraft/world/level/material/Fluid.java
|
||||
index 4a6b0869ac305d181e48d6c592d30af297486df0..e119ad20676dfadf0e575a8959d665e393e91608 100644
|
||||
index a961523886702dc7ce34be06f239927b2129476b..89bf13e5e595d0b6ef7661597b2196b757b8d7ee 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/material/Fluid.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/material/Fluid.java
|
||||
@@ -68,6 +68,12 @@ public abstract class Fluid {
|
||||
@@ -35,7 +35,7 @@ index 4a6b0869ac305d181e48d6c592d30af297486df0..e119ad20676dfadf0e575a8959d665e3
|
||||
|
||||
protected boolean isRandomlyTicking() {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/material/LavaFluid.java b/src/main/java/net/minecraft/world/level/material/LavaFluid.java
|
||||
index 1fb85a64eca4ef8a778f5b8652f774d1cfb707c4..36d6e7799b9f7e91d39c8080e839ce134034d187 100644
|
||||
index 0f13a5ea286ed42f117dd7473365ec642b46b82d..ea748b29cc7c00f0b2ffa9c162a6240989196de9 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/material/LavaFluid.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/material/LavaFluid.java
|
||||
@@ -181,6 +181,14 @@ public abstract class LavaFluid extends FlowingFluid {
|
||||
@@ -52,7 +52,7 @@ index 1fb85a64eca4ef8a778f5b8652f774d1cfb707c4..36d6e7799b9f7e91d39c8080e839ce13
|
||||
+
|
||||
@Override
|
||||
public int getTickDelay(LevelReader world) {
|
||||
return world.dimensionType().ultraWarm() && !(world instanceof Level level && level.sakuraConfig().environment.disableFastNetherLava) ? 10 : 30; // Sakura
|
||||
return world.dimensionType().ultraWarm() && !(world instanceof Level level && level.sakuraConfig.disableFastNetherLava) ? 10 : 30; // Sakura
|
||||
@@ -188,7 +196,7 @@ public abstract class LavaFluid extends FlowingFluid {
|
||||
|
||||
@Override
|
||||
22
patches/server/0084-temp.patch
Normal file
22
patches/server/0084-temp.patch
Normal file
@@ -0,0 +1,22 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samsuik <kfian294ma4@gmail.com>
|
||||
Date: Fri, 14 Mar 2025 18:37:26 +0000
|
||||
Subject: [PATCH] temp
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index d1b4eb9088d5780f56d8df2d4542e6d408c61e6c..fb9250a4e904e75604094694e1dc021e678d1389 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -201,7 +201,7 @@ tasks.registerRunTask("runReobf") {
|
||||
classpath(runtimeClasspathWithoutVanillaServer)
|
||||
}
|
||||
|
||||
-tasks.registerRunTask("runDev") {
|
||||
- description = "Spin up a non-relocated Mojang-mapped test server"
|
||||
- classpath(sourceSets.main.map { it.runtimeClasspath })
|
||||
-}
|
||||
+//tasks.registerRunTask("runDev") {
|
||||
+// description = "Spin up a non-relocated Mojang-mapped test server"
|
||||
+// classpath(sourceSets.main.map { it.runtimeClasspath })
|
||||
+//}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user