diff --git a/build.gradle.kts b/build.gradle.kts index a0ffe6d..e226007 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,7 +3,7 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent plugins { java - id("io.papermc.paperweight.patcher") version "2.0.0-beta.14" + id("io.papermc.paperweight.patcher") version "2.0.0-beta.16" } paperweight { diff --git a/gradle.properties b/gradle.properties index d9bd998..ab20232 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,8 +1,8 @@ group=me.samsuik.sakura -version=1.21.4-R0.1-SNAPSHOT -mcVersion=1.21.4 +version=1.21.5-R0.1-SNAPSHOT +mcVersion=1.21.5 -paperRef=9b1798d6438107fdf0d5939b79a8cf71f4d16e2c +paperRef=ce91a8ca123f4e853629d08705e4ece3a09a5a4d org.gradle.jvmargs=-Xmx2G org.gradle.vfs.watch=false diff --git a/sakura-api/build.gradle.kts.patch b/sakura-api/build.gradle.kts.patch index 0313e40..6e38f97 100644 --- a/sakura-api/build.gradle.kts.patch +++ b/sakura-api/build.gradle.kts.patch @@ -4,15 +4,15 @@ testRuntimeOnly("org.junit.platform:junit-platform-launcher") } --val generatedApiPath: java.nio.file.Path = layout.projectDirectory.dir("src/generated/java").asFile.toPath() -+val generatedApiPath: java.nio.file.Path = rootProject.layout.projectDirectory.dir("paper-api/src/generated/java").asFile.toPath() +-val generatedDir: java.nio.file.Path = layout.projectDirectory.dir("src/generated/java").asFile.toPath() ++val generatedDir: java.nio.file.Path = rootProject.layout.projectDirectory.dir("paper-api/src/generated/java").asFile.toPath() idea { module { - generatedSourceDirs.add(generatedApiPath.toFile()) + generatedSourceDirs.add(generatedDir.toFile()) @@ -103,6 +_,18 @@ main { java { - srcDir(generatedApiPath) + srcDir(generatedDir) + srcDir(file("../paper-api/src/main/java")) + } + resources { diff --git a/sakura-api/paper-patches/files/src/main/java/org/bukkit/Bukkit.java.patch b/sakura-api/paper-patches/files/src/main/java/org/bukkit/Bukkit.java.patch index 9a3946c..492e6ae 100644 --- a/sakura-api/paper-patches/files/src/main/java/org/bukkit/Bukkit.java.patch +++ b/sakura-api/paper-patches/files/src/main/java/org/bukkit/Bukkit.java.patch @@ -1,6 +1,6 @@ --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java -@@ -126,6 +_,20 @@ +@@ -127,6 +_,20 @@ // Paper end } diff --git a/sakura-api/paper-patches/files/src/main/java/org/bukkit/command/defaults/VersionCommand.java.patch b/sakura-api/paper-patches/files/src/main/java/org/bukkit/command/defaults/VersionCommand.java.patch index 8121fcb..79bd217 100644 --- a/sakura-api/paper-patches/files/src/main/java/org/bukkit/command/defaults/VersionCommand.java.patch +++ b/sakura-api/paper-patches/files/src/main/java/org/bukkit/command/defaults/VersionCommand.java.patch @@ -1,9 +1,9 @@ --- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java +++ b/src/main/java/org/bukkit/command/defaults/VersionCommand.java -@@ -33,6 +_,11 @@ +@@ -31,6 +_,11 @@ + import net.kyori.adventure.text.event.ClickEvent; import net.kyori.adventure.text.format.TextDecoration; import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; - // Paper end - version command 2.0 +// Sakura start - customise version command +import net.kyori.adventure.text.event.HoverEvent; +import net.kyori.adventure.text.minimessage.MiniMessage; @@ -12,7 +12,7 @@ public class VersionCommand extends BukkitCommand { private VersionFetcher versionFetcher; // Paper - version command 2.0 -@@ -44,6 +_,15 @@ +@@ -42,6 +_,15 @@ return versionFetcher; } @@ -28,7 +28,7 @@ public VersionCommand(@NotNull String name) { super(name); -@@ -55,11 +_,16 @@ +@@ -53,11 +_,16 @@ @Override public boolean execute(@NotNull CommandSender sender, @NotNull String currentAlias, @NotNull String[] args) { diff --git a/sakura-api/paper-patches/files/src/main/java/org/bukkit/entity/Entity.java.patch b/sakura-api/paper-patches/files/src/main/java/org/bukkit/entity/Entity.java.patch index ebe29e8..627e8ea 100644 --- a/sakura-api/paper-patches/files/src/main/java/org/bukkit/entity/Entity.java.patch +++ b/sakura-api/paper-patches/files/src/main/java/org/bukkit/entity/Entity.java.patch @@ -1,6 +1,6 @@ --- a/src/main/java/org/bukkit/entity/Entity.java +++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -35,6 +_,22 @@ +@@ -36,6 +_,22 @@ */ public interface Entity extends Metadatable, CommandSender, Nameable, PersistentDataHolder, net.kyori.adventure.text.event.HoverEventSource, net.kyori.adventure.sound.Sound.Emitter { // Paper diff --git a/sakura-api/paper-patches/features/0001-Client-Visibility-Settings-API.patch b/sakura-api/paper-patches/unapplied/features/0001-Client-Visibility-Settings-API.patch similarity index 100% rename from sakura-api/paper-patches/features/0001-Client-Visibility-Settings-API.patch rename to sakura-api/paper-patches/unapplied/features/0001-Client-Visibility-Settings-API.patch diff --git a/sakura-api/paper-patches/features/0002-Merge-Cannon-Entities-API.patch b/sakura-api/paper-patches/unapplied/features/0002-Merge-Cannon-Entities-API.patch similarity index 100% rename from sakura-api/paper-patches/features/0002-Merge-Cannon-Entities-API.patch rename to sakura-api/paper-patches/unapplied/features/0002-Merge-Cannon-Entities-API.patch diff --git a/sakura-server/build.gradle.kts.patch b/sakura-server/build.gradle.kts.patch index f8d11db..ba66e0c 100644 --- a/sakura-server/build.gradle.kts.patch +++ b/sakura-server/build.gradle.kts.patch @@ -1,16 +1,16 @@ --- a/paper-server/build.gradle.kts +++ b/paper-server/build.gradle.kts -@@ -9,6 +_,7 @@ +@@ -13,6 +_,7 @@ } val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/" +val serverBrand = rootProject.name dependencies { - mache("io.papermc:mache:1.21.4+build.7") -@@ -21,6 +_,17 @@ - // macheOldPath = file("F:\\Projects\\PaperTooling\\mache\\versions\\1.21.4\\src\\main\\java") - // gitFilePatches = true + mache("io.papermc:mache:1.21.5+build.1") +@@ -24,6 +_,17 @@ + minecraftVersion = providers.gradleProperty("mcVersion") + gitFilePatches = false + val fork = forks.register(serverBrand) { + upstream.patchDir("paperServer") { @@ -23,10 +23,10 @@ + + activeFork = fork + - spigot { - buildDataRef = "3edaf46ec1eed4115ce1b18d2846cded42577e42" - packageVersion = "v1_21_R3" // also needs to be updated in MappingEnvironment -@@ -101,7 +_,20 @@ + //updatingMinecraft { + // oldPaperCommit = "f4f275519f7c1fbe9db173b7144a4fe81440e365" + //} +@@ -108,7 +_,20 @@ } } @@ -48,7 +48,7 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) { extendsFrom(configurations.compileClasspath.get()) } -@@ -119,7 +_,7 @@ +@@ -130,7 +_,7 @@ } dependencies { @@ -57,3 +57,12 @@ implementation("ca.spottedleaf:concurrentutil:0.0.3") implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+ implementation("org.jline:jline-terminal-jni:3.27.1") // fall back to jni on java 21 +@@ -262,7 +_,7 @@ + jvmArgumentProviders.add(provider) + } + +-val generatedDir: java.nio.file.Path = layout.projectDirectory.dir("src/generated/java").asFile.toPath() ++val generatedDir: java.nio.file.Path = rootProject.layout.projectDirectory.dir("paper-server/src/generated/java").asFile.toPath() + idea { + module { + generatedSourceDirs.add(generatedDir.toFile()) diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java.patch deleted file mode 100644 index 1cb3a37..0000000 --- a/sakura-server/minecraft-patches/sources/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- a/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java -+++ b/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java -@@ -23,10 +_,10 @@ - this.items = NonNullList.withSize(items.size(), ItemStack.EMPTY); - - for (int i = 0; i < items.size(); i++) { -- this.items.set(i, items.get(i).copy()); -+ this.items.set(i, items.get(i).copyForPacket()); // Sakura - modify components sent to the client - } - -- this.carriedItem = carriedItem.copy(); -+ this.carriedItem = carriedItem.copyForPacket(); // Sakura - modify components sent to the client - } - - private ClientboundContainerSetContentPacket(RegistryFriendlyByteBuf buffer) { diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/server/MinecraftServer.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/server/MinecraftServer.java.patch index 8356090..174a42c 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/server/MinecraftServer.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/server/MinecraftServer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -300,6 +_,7 @@ +@@ -299,6 +_,7 @@ public volatile boolean abnormalExit; // Paper - Improved watchdog support public volatile Thread shutdownThread; // Paper - Improved watchdog support public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations; // Paper - add paper configuration files @@ -8,10 +8,10 @@ public boolean isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked private final Set pluginsBlockingSleep = new java.util.HashSet<>(); // Paper - API to allow/disallow tick sleeping public static final long SERVER_INIT = System.nanoTime(); // Paper - Lag compensation -@@ -390,6 +_,17 @@ - } +@@ -317,6 +_,17 @@ + thread.start(); + return minecraftServer; } - // Paper end - rewrite chunk system + // Sakura start - track tick information + private final me.samsuik.sakura.tps.TickInformationCollector tickInformationCollector = new me.samsuik.sakura.tps.TickInformationCollector(); + @@ -26,7 +26,7 @@ public MinecraftServer( // CraftBukkit start -@@ -471,6 +_,10 @@ +@@ -398,6 +_,10 @@ Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this)); // CraftBukkit end this.paperConfigurations = services.paperConfigurations(); // Paper - add paper configuration files @@ -37,7 +37,7 @@ } private void readScoreboard(DimensionDataStorage dataStorage) { -@@ -1221,6 +_,7 @@ +@@ -1139,6 +_,7 @@ if (++MinecraftServer.currentTick % MinecraftServer.SAMPLE_INTERVAL == 0) { final long diff = currentTime - tickSection; final java.math.BigDecimal currentTps = TPS_BASE.divide(new java.math.BigDecimal(diff), 30, java.math.RoundingMode.HALF_UP); @@ -45,10 +45,10 @@ tps1.add(currentTps, diff); tps5.add(currentTps, diff); tps15.add(currentTps, diff); -@@ -1256,6 +_,7 @@ - throw new RuntimeException("Chunk system crash propagated to tick()", crash); - } - // Paper end - rewrite chunk system +@@ -1167,6 +_,7 @@ + profilerFiller.push("tick"); + this.tickFrame.start(); + this.tickServer(flag ? () -> false : this::haveTime); + this.tickInformationCollector.tickDuration((System.nanoTime() - currentTime) / 1_000_000L); // Sakura - track tick information this.tickFrame.end(); profilerFiller.popPush("nextTickWait"); diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/server/dedicated/DedicatedServer.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/server/dedicated/DedicatedServer.java.patch index 305fa53..0d91e60 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/server/dedicated/DedicatedServer.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/server/dedicated/DedicatedServer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/dedicated/DedicatedServer.java +++ b/net/minecraft/server/dedicated/DedicatedServer.java -@@ -225,6 +_,11 @@ +@@ -184,6 +_,11 @@ this.server.spark.registerCommandBeforePlugins(this.server); // Paper - spark com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/server/level/ChunkMap.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/server/level/ChunkMap.java.patch index 5ba9156..d2061da 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/server/level/ChunkMap.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/server/level/ChunkMap.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/server/level/ChunkMap.java +++ b/net/minecraft/server/level/ChunkMap.java -@@ -129,7 +_,7 @@ - public final AtomicInteger tickingGenerated = new AtomicInteger(); // Paper - public +@@ -138,7 +_,7 @@ + private final AtomicInteger tickingGenerated = new AtomicInteger(); private final String storageName; private final PlayerMap playerMap = new PlayerMap(); - public final Int2ObjectMap entityMap = new Int2ObjectOpenHashMap<>(); + public final Int2ObjectMap entityMap = new me.samsuik.sakura.utils.collections.TrackedEntityChunkMap(); // Sakura - optimised tracked entity map private final Long2ByteMap chunkTypeCache = new Long2ByteOpenHashMap(); - // Paper - rewrite chunk system - public int serverViewDistance; -@@ -1217,7 +_,10 @@ + private final Long2LongMap nextChunkSaveTime = new Long2LongOpenHashMap(); + private final LongSet chunksToEagerlySave = new LongLinkedOpenHashSet(); +@@ -1420,7 +_,10 @@ double vec3_dz = player.getZ() - this.entity.getZ(); // Paper end - remove allocation of Vec3D here int playerViewDistance = ChunkMap.this.getPlayerViewDistance(player); diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/server/level/ServerLevel.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/server/level/ServerLevel.java.patch index 33776a2..d5d79e1 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/server/level/ServerLevel.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/server/level/ServerLevel.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -588,7 +_,7 @@ +@@ -343,7 +_,7 @@ org.bukkit.generator.BiomeProvider biomeProvider // CraftBukkit ) { // CraftBukkit start @@ -8,4 +8,4 @@ + super(serverLevelData, dimension, server.registryAccess(), levelStem.type(), false, isDebug, biomeZoomSeed, server.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> server.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(levelStorageAccess.levelDirectory.path(), serverLevelData.getLevelName(), dimension.location(), spigotConfig, server.registryAccess(), serverLevelData.getGameRules())), () -> server.sakuraConfigurations.createWorldConfig(me.samsuik.sakura.configuration.SakuraConfigurations.createWorldContextMap(levelStorageAccess.levelDirectory.path(), serverLevelData.getLevelName(), dimension.location(), server.registryAccess())), dispatcher); // Sakura - sakura configuration files // Paper - create paper world configs; Async-Anti-Xray: Pass executor this.pvpMode = server.isPvpAllowed(); this.levelStorageAccess = levelStorageAccess; - this.uuid = org.bukkit.craftbukkit.util.WorldUUID.getUUID(levelStorageAccess.levelDirectory.path().toFile()); + this.uuid = org.bukkit.craftbukkit.util.WorldUUID.getOrCreate(levelStorageAccess.levelDirectory.path().toFile()); diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/server/level/ServerPlayer.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/server/level/ServerPlayer.java.patch index f21a4c2..2fd9ab5 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/server/level/ServerPlayer.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/server/level/ServerPlayer.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/server/level/ServerPlayer.java +++ b/net/minecraft/server/level/ServerPlayer.java -@@ -430,6 +_,7 @@ - return this.viewDistanceHolder; - } - // Paper end - rewrite chunk system +@@ -422,6 +_,7 @@ + public @Nullable com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent + public @Nullable String clientBrandName = null; // Paper - Brand support + public @Nullable org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - Add API for quit reason; 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 level, GameProfile gameProfile, ClientInformation clientInformation) { diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/Entity.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/Entity.java.patch index adcf26a..0bec0e6 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/Entity.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/Entity.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -522,6 +_,7 @@ - } +@@ -405,6 +_,7 @@ + return this.dimensions.makeBoundingBox(x, y, z); } - // Paper end - optimise entity tracker + // Paper end + public boolean pushedByFluid = true; // Sakura - entity pushed by fluid api public Entity(EntityType entityType, Level level) { this.type = entityType; -@@ -4022,7 +_,7 @@ +@@ -3749,7 +_,7 @@ } public boolean isPushedByFluid() { diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/LivingEntity.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/LivingEntity.java.patch index b48af99..ef7c265 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/LivingEntity.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/LivingEntity.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java -@@ -307,6 +_,43 @@ - return this.getYHeadRot(); - } +@@ -274,6 +_,43 @@ + public net.kyori.adventure.util.TriState frictionState = net.kyori.adventure.util.TriState.NOT_SET; // Paper - Friction API + public int shieldBlockingDelay = this.level().paperConfig().misc.shieldBlockingDelay; // Paper - Make shield blocking delay configurable // CraftBukkit end + // Sakura start - legacy combat mechanics + private static final ResourceLocation LEGACY_COMBAT_MODIFIER_ID = ResourceLocation.fromNamespaceAndPath("sakura", "legacy_combat"); @@ -24,7 +24,7 @@ + AttributeModifier legacyModifier = null; + + if (this.level().sakuraConfig().players.combat.legacyCombatMechanics) { -+ ItemStack heldItem = this.getLastHandItem(EquipmentSlot.MAINHAND); ++ ItemStack heldItem = this.lastEquipmentItems.get(EquipmentSlot.MAINHAND); + double attackDifference = me.samsuik.sakura.player.combat.CombatUtil.getLegacyAttackDifference(heldItem); + legacyModifier = new AttributeModifier(LEGACY_COMBAT_MODIFIER_ID, attackDifference, AttributeModifier.Operation.ADD_VALUE); + } @@ -44,7 +44,7 @@ protected LivingEntity(EntityType entityType, Level level) { super(entityType, level); -@@ -1479,7 +_,7 @@ +@@ -1481,7 +_,7 @@ } // Paper end - Check distance in entity interactions @@ -53,16 +53,16 @@ if (!flag) { this.indicateDamage(d, d1); } -@@ -1570,7 +_,7 @@ +@@ -1676,7 +_,7 @@ } - protected void blockedByShield(LivingEntity defender) { -- defender.knockback(0.5, defender.getX() - this.getX(), defender.getZ() - this.getZ(), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.SHIELD_BLOCK); // CraftBukkit // Paper - fix attacker & knockback events -+ defender.knockback((float) this.level().sakuraConfig().players.knockback.shieldHitKnockback, defender.getX() - this.getX(), defender.getZ() - this.getZ(), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.SHIELD_BLOCK); // CraftBukkit // Paper - fix attacker & knockback events // Sakura - configure entity knockback + protected void blockedByItem(LivingEntity entity) { +- entity.knockback(0.5, entity.getX() - this.getX(), entity.getZ() - this.getZ(), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.SHIELD_BLOCK); // CraftBukkit // Paper - fix attacker & knockback events ++ entity.knockback((float) this.level().sakuraConfig().players.knockback.shieldHitKnockback, entity.getX() - this.getX(), entity.getZ() - this.getZ(), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.SHIELD_BLOCK); // CraftBukkit // Paper - fix attacker & knockback events // Sakura - configure entity knockback } private boolean checkTotemDeathProtection(DamageSource damageSource) { -@@ -1747,6 +_,12 @@ +@@ -1833,6 +_,12 @@ // Paper start if (this.dead) { // Paper @@ -75,7 +75,7 @@ this.level().broadcastEntityEvent(this, (byte)3); this.setPose(Pose.DYING); -@@ -1920,7 +_,7 @@ +@@ -2006,7 +_,7 @@ } public void knockback(double strength, double x, double z, @Nullable Entity attacker, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause eventCause) { // Paper - knockback events @@ -84,7 +84,7 @@ if (true || !(strength <= 0.0)) { // CraftBukkit - Call event even when force is 0 // this.hasImpulse = true; // CraftBukkit - Move down Vec3 deltaMovement = this.getDeltaMovement(); -@@ -1931,10 +_,18 @@ +@@ -2017,10 +_,18 @@ } Vec3 vec3 = new Vec3(x, 0.0, z).normalize().scale(strength); @@ -104,7 +104,23 @@ deltaMovement.z / 2.0 - vec3.z ); Vec3 diff = finalVelocity.subtract(deltaMovement); -@@ -2156,9 +_,21 @@ +@@ -2165,8 +_,14 @@ + } + } + ++ // Sakura start - configure iron golems taking fall damage ++ protected boolean isFallDamageImmune() { ++ return this.getType().is(EntityTypeTags.FALL_DAMAGE_IMMUNE); ++ } ++ + protected int calculateFallDamage(double fallDistance, float damageMultiplier) { +- if (this.getType().is(EntityTypeTags.FALL_DAMAGE_IMMUNE)) { ++ if (this.isFallDamageImmune()) { ++ // Sakura end - configure iron golems taking fall damage + return 0; + } else { + double d = this.calculateFallPower(fallDistance); +@@ -2224,9 +_,21 @@ protected float getDamageAfterArmorAbsorb(DamageSource damageSource, float damageAmount) { if (!damageSource.is(DamageTypeTags.BYPASSES_ARMOR)) { // this.hurtArmor(damageSource, damageAmount); // CraftBukkit - actuallyHurt(DamageSource, float, EntityDamageEvent) for damage handling @@ -126,21 +142,22 @@ } return damageAmount; -@@ -2252,6 +_,11 @@ - com.google.common.base.Function blocking = new com.google.common.base.Function() { - @Override - public Double apply(Double f) { -+ // Sakura start - shield damage reduction & allow blocking with swords -+ if (LivingEntity.this.isBlockingWithSword() || LivingEntity.this.level().sakuraConfig().players.combat.shieldDamageReduction && !(damagesource.getDirectEntity() instanceof AbstractArrow)) { -+ return -(LivingEntity.this.isBlocking() ? f * 0.5 : 0.0); -+ } -+ // Sakura end - shield damage reduction & allow blocking with swords - return -((LivingEntity.this.isDamageSourceBlocked(damagesource)) ? f : 0.0); +@@ -2312,6 +_,12 @@ + amount += hardHatModifier; + + com.google.common.base.Function blocking = mod -> { ++ // Sakura start - shield damage reduction & allow blocking with swords ++ // todo: 1.21.5 update ++ if (LivingEntity.this.isBlockingWithSword() || LivingEntity.this.level().sakuraConfig().players.combat.shieldDamageReduction && !(damagesource.getDirectEntity() instanceof AbstractArrow)) { ++ return -(LivingEntity.this.isBlocking() ? mod * 0.5 : 0.0); ++ } ++ // Sakura end - shield damage reduction & allow blocking with swords + if (!LivingEntity.this.canBlockAttack(damagesource, mod.floatValue())) { + return 0D; } - }; -@@ -2351,6 +_,12 @@ - armorDamage += (float) event.getDamage(DamageModifier.INVULNERABILITY_REDUCTION); +@@ -2406,6 +_,12 @@ armorDamage += (float) event.getDamage(DamageModifier.BLOCKING); + armorDamage += (float) event.getDamage(DamageModifier.FREEZING); armorDamage += (float) event.getDamage(DamageModifier.HARD_HAT); + // Sakura start - add max armour durability damage + final int maxArmourDamage = this.level().sakuraConfig().players.combat.maxArmourDamage.or(-1); @@ -151,7 +168,7 @@ this.hurtArmor(damageSource, armorDamage); } -@@ -3292,6 +_,11 @@ +@@ -3332,6 +_,11 @@ if (this.level() instanceof ServerLevel serverLevel) { EnchantmentHelper.runLocationChangedEffects(serverLevel, itemBySlot, this, equipmentSlot1); } @@ -163,16 +180,16 @@ } } -@@ -3517,7 +_,7 @@ +@@ -3532,7 +_,7 @@ } } // Paper end - Add EntityMoveEvent -- if (this.level() instanceof ServerLevel serverLevel && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) { -+ if (this.level() instanceof ServerLevel serverLevel && this.level().sakuraConfig().entity.waterSensitivity && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) { // Sakura - configure entity water sensitivity +- if (this.level() instanceof ServerLevel serverLevel && this.isSensitiveToWater() && this.isInWaterOrRain()) { ++ if (this.level() instanceof ServerLevel serverLevel && this.level().sakuraConfig().entity.waterSensitivity && this.isSensitiveToWater() && this.isInWaterOrRain()) { // Sakura - configure entity water sensitivity this.hurtServer(serverLevel, this.damageSources().drown(), 1.0F); } } -@@ -4072,8 +_,16 @@ +@@ -4099,8 +_,16 @@ } public boolean isBlocking() { diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/Mob.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/Mob.java.patch index 71ea142..2385c5d 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/Mob.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/Mob.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/Mob.java +++ b/net/minecraft/world/entity/Mob.java -@@ -846,7 +_,7 @@ +@@ -716,7 +_,7 @@ protected final void serverAiStep() { this.noActionTime++; // Paper start - Allow nerfed mobs to jump and float - if (!this.aware) { + if (!this.aware || this.level().sakuraConfig().entity.disableMobAi) { // Sakura - add option to disable entity ai - if (goalFloat != null) { - if (goalFloat.canUse()) goalFloat.tick(); + if (this.goalFloat != null) { + if (this.goalFloat.canUse()) this.goalFloat.tick(); this.getJumpControl().tick(); diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/animal/IronGolem.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/animal/IronGolem.java.patch index 1521ab5..53dcec8 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/animal/IronGolem.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/animal/IronGolem.java.patch @@ -1,19 +1,13 @@ --- a/net/minecraft/world/entity/animal/IronGolem.java +++ b/net/minecraft/world/entity/animal/IronGolem.java -@@ -228,6 +_,19 @@ +@@ -229,6 +_,13 @@ } } + // Sakura start - configure iron golems taking fall damage + @Override -+ protected int calculateFallDamage(float fallDistance, float damageMultiplier) { -+ if (!this.level().sakuraConfig().entity.ironGolemsTakeFalldamage) { -+ return super.calculateFallDamage(fallDistance, damageMultiplier); -+ } else { -+ float safeFallDistance = (float)this.getAttributeValue(Attributes.SAFE_FALL_DISTANCE); -+ float damage = fallDistance - safeFallDistance; -+ return net.minecraft.util.Mth.ceil(damage * damageMultiplier * this.getAttributeValue(Attributes.FALL_DAMAGE_MULTIPLIER)); -+ } ++ protected final boolean isFallDamageImmune() { ++ return !this.level().sakuraConfig().entity.ironGolemsTakeFalldamage && this.isFallDamageImmune(); + } + // Sakura end - configure iron golems taking fall damage + diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/item/FallingBlockEntity.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/item/FallingBlockEntity.java.patch index c83c0d6..4ddd763 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/item/FallingBlockEntity.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/item/FallingBlockEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/net/minecraft/world/entity/item/FallingBlockEntity.java -@@ -68,9 +_,11 @@ +@@ -70,9 +_,11 @@ public boolean forceTickAfterTeleportToDuplicate; protected static final EntityDataAccessor DATA_START_POS = SynchedEntityData.defineId(FallingBlockEntity.class, EntityDataSerializers.BLOCK_POS); public boolean autoExpire = true; // Paper - Expand FallingBlock API @@ -12,7 +12,7 @@ } public FallingBlockEntity(Level level, double x, double y, double z, BlockState state) { -@@ -85,6 +_,27 @@ +@@ -87,6 +_,27 @@ this.setStartPos(this.blockPosition()); } @@ -66,15 +66,15 @@ + if (canBeReplaced && flag3 && isFallingBlockInBounds(this.level(), blockPos)) { // Sakura - falling block stacking restrictions if (this.blockState.hasProperty(BlockStateProperties.WATERLOGGED) && this.level().getFluidState(blockPos).getType() == Fluids.WATER) { - this.blockState = this.blockState.setValue(BlockStateProperties.WATERLOGGED, Boolean.valueOf(true)); -@@ -243,6 +_,10 @@ - this.discard(EntityRemoveEvent.Cause.DROP); // CraftBukkit - add Bukkit remove cause + this.blockState = this.blockState.setValue(BlockStateProperties.WATERLOGGED, true); +@@ -240,6 +_,10 @@ + this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DROP); // CraftBukkit - add Bukkit remove cause this.callOnBrokenAfterFall(block, blockPos); this.spawnAtLocation(serverLevel, block); + // Sakura start - fix falling blocks staying alive when entity drops are disabled + } else { -+ this.discard(EntityRemoveEvent.Cause.DROP); // CraftBukkit - add Bukkit remove cause ++ this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DROP); // CraftBukkit - add Bukkit remove cause + // Sakura end - fix falling blocks staying alive when entity drops are disabled } } else { - this.discard(EntityRemoveEvent.Cause.DROP); // CraftBukkit - add Bukkit remove cause + this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DROP); // CraftBukkit - add Bukkit remove cause diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/item/ItemEntity.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/item/ItemEntity.java.patch index 1a1cc82..7407cac 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/item/ItemEntity.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/item/ItemEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/item/ItemEntity.java +++ b/net/minecraft/world/entity/item/ItemEntity.java -@@ -363,6 +_,11 @@ +@@ -370,6 +_,11 @@ @Override public boolean ignoreExplosion(Explosion explosion) { diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/item/PrimedTnt.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/item/PrimedTnt.java.patch index 7d3bb0d..b3aab8a 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/item/PrimedTnt.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/item/PrimedTnt.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/item/PrimedTnt.java +++ b/net/minecraft/world/entity/item/PrimedTnt.java -@@ -73,7 +_,28 @@ +@@ -76,7 +_,28 @@ this.yo = y; this.zo = z; this.owner = owner; @@ -30,7 +30,7 @@ @Override protected void defineSynchedData(SynchedEntityData.Builder builder) { -@@ -98,7 +_,7 @@ +@@ -101,7 +_,7 @@ @Override public void tick() { @@ -39,7 +39,7 @@ this.handlePortal(); this.applyGravity(); this.move(MoverType.SELF, this.getDeltaMovement()); -@@ -130,6 +_,14 @@ +@@ -133,6 +_,14 @@ this.level().addParticle(ParticleTypes.SMOKE, this.getX(), this.getY() + 0.5, this.getZ(), 0.0, 0.0, 0.0); } } @@ -54,7 +54,7 @@ // Paper start - Option to prevent TNT from moving in water if (!this.isRemoved() && this.wasTouchingWater && this.level().paperConfig().fixes.preventTntFromMovingInWater) { /* -@@ -248,7 +_,7 @@ +@@ -250,7 +_,7 @@ // Paper start - Option to prevent TNT from moving in water @Override public boolean isPushedByFluid() { diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/monster/Creeper.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/monster/Creeper.java.patch index 71e200e..46db60e 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/monster/Creeper.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/monster/Creeper.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/Creeper.java +++ b/net/minecraft/world/entity/monster/Creeper.java -@@ -250,7 +_,12 @@ +@@ -246,7 +_,12 @@ if (!event.isCancelled()) { // CraftBukkit end this.dead = true; diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/player/Player.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/player/Player.java.patch index dd0807a..0b4514c 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/player/Player.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/player/Player.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/world/entity/player/Player.java +++ b/net/minecraft/world/entity/player/Player.java -@@ -200,6 +_,7 @@ - private int currentImpulseContextResetGraceTime; +@@ -210,6 +_,7 @@ + private int currentImpulseContextResetGraceTime = 0; public boolean affectsSpawning = true; // Paper - Affects Spawning API public net.kyori.adventure.util.TriState flyingFallDamage = net.kyori.adventure.util.TriState.NOT_SET; // Paper - flying fall damage + private long lastSprintKnockback = -1; // Sakura - configure entity knockback // CraftBukkit start public boolean fauxSleeping; -@@ -895,6 +_,10 @@ +@@ -857,6 +_,10 @@ public boolean isInvulnerableTo(ServerLevel level, DamageSource damageSource) { if (super.isInvulnerableTo(level, damageSource)) { return true; @@ -19,7 +19,7 @@ } else if (damageSource.is(DamageTypeTags.IS_DROWNING)) { return !level.getGameRules().getBoolean(GameRules.RULE_DROWNING_DAMAGE); } else if (damageSource.is(DamageTypeTags.IS_FALL)) { -@@ -1225,13 +_,19 @@ +@@ -1170,13 +_,19 @@ if (playerAttackEntityEvent.callEvent() && willAttack) { // Logic moved to willAttack local variable. { // Paper end - PlayerAttackEntityEvent @@ -40,7 +40,7 @@ // this.resetAttackStrengthTicker(); // CraftBukkit - Moved to EntityLiving to reset the cooldown after the damage is dealt if (target.getType().is(EntityTypeTags.REDIRECTABLE_PROJECTILE) && target instanceof Projectile projectile) { -@@ -1249,7 +_,7 @@ +@@ -1194,7 +_,7 @@ if (f > 0.0F || f1 > 0.0F) { boolean flag = attackStrengthScale > 0.9F; boolean flag1; @@ -49,7 +49,7 @@ this.sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_KNOCKBACK, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility flag1 = true; } else { -@@ -1265,7 +_,7 @@ +@@ -1210,7 +_,7 @@ && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity @@ -58,7 +58,7 @@ flag2 = flag2 && !this.level().paperConfig().entities.behavior.disablePlayerCrits; // Paper - Toggleable player crits if (flag2) { damageSource = damageSource.critical(); // Paper - critical damage API -@@ -1292,7 +_,21 @@ +@@ -1237,7 +_,21 @@ if (flag4) { float f4 = this.getKnockback(target, damageSource) + (flag1 ? 1.0F : 0.0F); if (f4 > 0.0F) { @@ -81,7 +81,7 @@ livingEntity1.knockback( f4 * 0.5F, Mth.sin(this.getYRot() * (float) (Math.PI / 180.0)), -Mth.cos(this.getYRot() * (float) (Math.PI / 180.0)) , this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.ENTITY_ATTACK // Paper - knockback events -@@ -1314,7 +_,7 @@ +@@ -1259,7 +_,7 @@ // Paper end - Configurable sprint interruption on attack } @@ -90,16 +90,16 @@ float f5 = 1.0F + (float)this.getAttributeValue(Attributes.SWEEPING_DAMAGE_RATIO) * f; for (LivingEntity livingEntity2 : this.level() -@@ -1333,7 +_,7 @@ - } - // CraftBukkit end - livingEntity2.knockback( -- 0.4F, Mth.sin(this.getYRot() * (float) (Math.PI / 180.0)), -Mth.cos(this.getYRot() * (float) (Math.PI / 180.0)) -+ (float) this.level().sakuraConfig().players.knockback.sweepingEdgeKnockback, Mth.sin(this.getYRot() * (float) (Math.PI / 180.0)), -Mth.cos(this.getYRot() * (float) (Math.PI / 180.0)) // Sakura - configure entity knockback - , this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.SWEEP_ATTACK // CraftBukkit // Paper - knockback events - ); - // CraftBukkit - moved up -@@ -1423,7 +_,7 @@ +@@ -1275,7 +_,7 @@ + if (this.level() instanceof ServerLevel serverLevel && livingEntity2.hurtServer(serverLevel, damageSource.knownCause(org.bukkit.event.entity.EntityDamageEvent.DamageCause.ENTITY_SWEEP_ATTACK), f6) && !livingEntity2.lastDamageCancelled) { + // Paper end - Only apply knockback if the event is not cancelled + livingEntity2.knockback( +- 0.4F, Mth.sin(this.getYRot() * (float) (Math.PI / 180.0)), -Mth.cos(this.getYRot() * (float) (Math.PI / 180.0)) ++ (float) this.level().sakuraConfig().players.knockback.sweepingEdgeKnockback, Mth.sin(this.getYRot() * (float) (Math.PI / 180.0)), -Mth.cos(this.getYRot() * (float) (Math.PI / 180.0)) // Sakura - configure entity knockback + , this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.SWEEP_ATTACK // Paper - knockback events + ); + EnchantmentHelper.doPostAttackEffects(serverLevel, livingEntity2, damageSource); +@@ -1363,7 +_,7 @@ if (target instanceof LivingEntity) { float f7 = f3 - ((LivingEntity)target).getHealth(); this.awardStat(Stats.DAMAGE_DEALT, Math.round(f7 * 10.0F)); @@ -108,7 +108,7 @@ int i = (int)(f7 * 0.5); ((ServerLevel)this.level()) .sendParticles(ParticleTypes.DAMAGE_INDICATOR, target.getX(), target.getY(0.5), target.getZ(), i, 0.1, 0.0, 0.1, 0.2); -@@ -1826,6 +_,7 @@ +@@ -1753,6 +_,7 @@ // Paper start - send while respecting visibility private static void sendSoundEffect(Player fromEntity, double x, double y, double z, SoundEvent soundEffect, SoundSource soundCategory, float volume, float pitch) { @@ -116,7 +116,7 @@ fromEntity.level().playSound(fromEntity, x, y, z, soundEffect, soundCategory, volume, pitch); // This will not send the effect to the entity itself if (fromEntity instanceof ServerPlayer serverPlayer) { serverPlayer.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())); -@@ -2212,7 +_,13 @@ +@@ -2100,7 +_,13 @@ @Override public EntityDimensions getDefaultDimensions(Pose pose) { diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/ThrownPotion.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/AbstractThrownPotion.java.patch similarity index 73% rename from sakura-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/ThrownPotion.java.patch rename to sakura-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/AbstractThrownPotion.java.patch index 3ebce33..1d7c83f 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/ThrownPotion.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/AbstractThrownPotion.java.patch @@ -1,10 +1,9 @@ ---- a/net/minecraft/world/entity/projectile/ThrownPotion.java -+++ b/net/minecraft/world/entity/projectile/ThrownPotion.java -@@ -48,6 +_,25 @@ - public ThrownPotion(Level level, double x, double y, double z, ItemStack item) { - super(EntityType.POTION, x, y, z, level, item); +--- a/net/minecraft/world/entity/projectile/AbstractThrownPotion.java ++++ b/net/minecraft/world/entity/projectile/AbstractThrownPotion.java +@@ -42,6 +_,25 @@ + super(entityType, x, y, z, level, item); } -+ + + // Sakura start - configure potion mechanics + @Override + public void shoot(double x, double y, double z, float speed, float divergence) { @@ -23,6 +22,7 @@ + return super.checkLeftOwner() || this.level().sakuraConfig().entity.thrownPotion.allowBreakingInsideEntities && this.tickCount >= 5; + } + // Sakura end - configure potion mechanics - ++ @Override - protected Item getDefaultItem() { + protected double getDefaultGravity() { + return 0.05; diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/FishingHook.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/FishingHook.java.patch index c8cfb32..14a9ff9 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/FishingHook.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/FishingHook.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/projectile/FishingHook.java +++ b/net/minecraft/world/entity/projectile/FishingHook.java -@@ -288,6 +_,12 @@ +@@ -284,6 +_,12 @@ if (!this.level().isClientSide) { this.setHookedEntity(result.getEntity()); } @@ -13,7 +13,7 @@ } @Override -@@ -603,7 +_,7 @@ +@@ -585,7 +_,7 @@ public void pullEntity(Entity entity) { Entity owner = this.getOwner(); diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/ThrowableProjectile.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/ThrowableProjectile.java.patch index e6501d5..d8493e6 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/ThrowableProjectile.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/ThrowableProjectile.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/projectile/ThrowableProjectile.java +++ b/net/minecraft/world/entity/projectile/ThrowableProjectile.java -@@ -41,12 +_,18 @@ +@@ -42,12 +_,18 @@ return true; } diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/ThrownEnderpearl.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/ThrownEnderpearl.java.patch index 611cfaf..4c2aa0d 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/ThrownEnderpearl.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/ThrownEnderpearl.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/projectile/ThrownEnderpearl.java +++ b/net/minecraft/world/entity/projectile/ThrownEnderpearl.java -@@ -186,6 +_,13 @@ +@@ -182,6 +_,13 @@ } } diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/food/FoodData.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/food/FoodData.java.patch index 617b9ba..2c37589 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/food/FoodData.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/food/FoodData.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/food/FoodData.java +++ b/net/minecraft/world/food/FoodData.java -@@ -63,7 +_,7 @@ +@@ -65,7 +_,7 @@ } boolean _boolean = serverLevel.getGameRules().getBoolean(GameRules.RULE_NATURAL_REGENERATION); diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/inventory/AbstractContainerMenu.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/inventory/AbstractContainerMenu.java.patch new file mode 100644 index 0000000..3a6caf7 --- /dev/null +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/inventory/AbstractContainerMenu.java.patch @@ -0,0 +1,20 @@ +--- a/net/minecraft/world/inventory/AbstractContainerMenu.java ++++ b/net/minecraft/world/inventory/AbstractContainerMenu.java +@@ -192,7 +_,7 @@ + + for (int size = this.slots.size(); i < size; i++) { + ItemStack item = this.slots.get(i).getItem(); +- list.add(item.copy()); ++ list.add(item.copyForPacket()); // Sakura - modify components sent to the client + this.remoteSlots.get(i).force(item); + } + +@@ -205,7 +_,7 @@ + } + + if (this.synchronizer != null) { +- this.synchronizer.sendInitialData(this, list, carried.copy(), this.remoteDataSlots.toIntArray()); ++ this.synchronizer.sendInitialData(this, list, carried.copyForPacket(), this.remoteDataSlots.toIntArray()); // Sakura - modify components sent to the client + this.synchronizer.sendOffHandSlotChange(); // Paper - Sync offhand slot in menus; update player's offhand since the offhand slot is not added to the slots for menus but can be changed by swapping from a menu slot + } + } diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/item/BucketItem.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/item/BucketItem.java.patch index b2c9d42..e3b100e 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/item/BucketItem.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/item/BucketItem.java.patch @@ -3,7 +3,7 @@ @@ -147,7 +_,7 @@ // CraftBukkit end if (!flag) { - return result != null && this.emptyContents(player, level, result.getBlockPos().relative(result.getDirection()), null, enumdirection, clicked, itemstack, enumhand); // CraftBukkit + return hitResult != null && this.emptyContents(entity, level, hitResult.getBlockPos().relative(hitResult.getDirection()), null, direction, clicked, itemstack, hand); // CraftBukkit - } else if (level.dimensionType().ultraWarm() && this.content.is(FluidTags.WATER)) { + } else if (!level.sakuraConfig().environment.allowWaterInTheNether && level.dimensionType().ultraWarm() && this.content.is(FluidTags.WATER)) { // Sakura - allow water in the nether int x = pos.getX(); diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/item/Item.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/item/Item.java.patch index 1454934..cac51f4 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/item/Item.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/item/Item.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/Item.java +++ b/net/minecraft/world/item/Item.java -@@ -121,6 +_,11 @@ +@@ -136,6 +_,11 @@ return this.builtInRegistryHolder; } diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/item/ItemStack.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/item/ItemStack.java.patch index 6e00132..51383d1 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/item/ItemStack.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/item/ItemStack.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/ItemStack.java +++ b/net/minecraft/world/item/ItemStack.java -@@ -826,6 +_,15 @@ +@@ -831,6 +_,15 @@ return this.getItem().interactLivingEntity(this, player, entity, usedHand); } @@ -14,5 +14,5 @@ + // Sakura end - modify components sent to the client + public ItemStack copy() { - // Paper start - Perf: Optimize Hoppers - return this.copy(false); + if (this.isEmpty()) { + return EMPTY; diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/item/Items.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/item/Items.java.patch index e8bc645..7357b13 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/item/Items.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/item/Items.java.patch @@ -1,39 +1,45 @@ --- a/net/minecraft/world/item/Items.java +++ b/net/minecraft/world/item/Items.java -@@ -1083,27 +_,27 @@ - public static final Item GOLD_INGOT = registerItem("gold_ingot"); - public static final Item NETHERITE_INGOT = registerItem("netherite_ingot", new Item.Properties().fireResistant()); +@@ -1107,32 +_,32 @@ + public static final Item GOLD_INGOT = registerItem("gold_ingot", new Item.Properties().trimMaterial(TrimMaterials.GOLD)); + public static final Item NETHERITE_INGOT = registerItem("netherite_ingot", new Item.Properties().fireResistant().trimMaterial(TrimMaterials.NETHERITE)); public static final Item NETHERITE_SCRAP = registerItem("netherite_scrap", new Item.Properties().fireResistant()); -- public static final Item WOODEN_SWORD = registerItem("wooden_sword", properties -> new SwordItem(ToolMaterial.WOOD, 3.0F, -2.4F, properties)); -+ public static final Item WOODEN_SWORD = registerItem("wooden_sword", properties -> new me.samsuik.sakura.player.item.BlockableSwordItem(ToolMaterial.WOOD, 3.0F, -2.4F, properties)); // Sakura - allow blocking with swords +- public static final Item WOODEN_SWORD = registerItem("wooden_sword", new Item.Properties().sword(ToolMaterial.WOOD, 3.0F, -2.4F)); ++ public static final Item WOODEN_SWORD = registerItem("wooden_sword", properties -> new me.samsuik.sakura.player.item.BlockableSwordItem(new Item.Properties().sword(ToolMaterial.WOOD, 3.0F, -2.4F))); // Sakura - allow blocking with swords public static final Item WOODEN_SHOVEL = registerItem("wooden_shovel", properties -> new ShovelItem(ToolMaterial.WOOD, 1.5F, -3.0F, properties)); - public static final Item WOODEN_PICKAXE = registerItem("wooden_pickaxe", properties -> new PickaxeItem(ToolMaterial.WOOD, 1.0F, -2.8F, properties)); + public static final Item WOODEN_PICKAXE = registerItem("wooden_pickaxe", new Item.Properties().pickaxe(ToolMaterial.WOOD, 1.0F, -2.8F)); public static final Item WOODEN_AXE = registerItem("wooden_axe", properties -> new AxeItem(ToolMaterial.WOOD, 6.0F, -3.2F, properties)); public static final Item WOODEN_HOE = registerItem("wooden_hoe", properties -> new HoeItem(ToolMaterial.WOOD, 0.0F, -3.0F, properties)); -- public static final Item STONE_SWORD = registerItem("stone_sword", properties -> new SwordItem(ToolMaterial.STONE, 3.0F, -2.4F, properties)); -+ public static final Item STONE_SWORD = registerItem("stone_sword", properties -> new me.samsuik.sakura.player.item.BlockableSwordItem(ToolMaterial.STONE, 3.0F, -2.4F, properties)); // Sakura - allow blocking with swords +- public static final Item STONE_SWORD = registerItem("stone_sword", new Item.Properties().sword(ToolMaterial.STONE, 3.0F, -2.4F)); ++ public static final Item STONE_SWORD = registerItem("stone_sword", properties -> new me.samsuik.sakura.player.item.BlockableSwordItem(new Item.Properties().sword(ToolMaterial.STONE, 3.0F, -2.4F))); // Sakura - allow blocking with swords public static final Item STONE_SHOVEL = registerItem("stone_shovel", properties -> new ShovelItem(ToolMaterial.STONE, 1.5F, -3.0F, properties)); - public static final Item STONE_PICKAXE = registerItem("stone_pickaxe", properties -> new PickaxeItem(ToolMaterial.STONE, 1.0F, -2.8F, properties)); + public static final Item STONE_PICKAXE = registerItem("stone_pickaxe", new Item.Properties().pickaxe(ToolMaterial.STONE, 1.0F, -2.8F)); public static final Item STONE_AXE = registerItem("stone_axe", properties -> new AxeItem(ToolMaterial.STONE, 7.0F, -3.2F, properties)); public static final Item STONE_HOE = registerItem("stone_hoe", properties -> new HoeItem(ToolMaterial.STONE, -1.0F, -2.0F, properties)); -- public static final Item GOLDEN_SWORD = registerItem("golden_sword", properties -> new SwordItem(ToolMaterial.GOLD, 3.0F, -2.4F, properties)); -+ public static final Item GOLDEN_SWORD = registerItem("golden_sword", properties -> new me.samsuik.sakura.player.item.BlockableSwordItem(ToolMaterial.GOLD, 3.0F, -2.4F, properties)); // Sakura - allow blocking with swords +- public static final Item GOLDEN_SWORD = registerItem("golden_sword", new Item.Properties().sword(ToolMaterial.GOLD, 3.0F, -2.4F)); ++ public static final Item GOLDEN_SWORD = registerItem("golden_sword", properties -> new me.samsuik.sakura.player.item.BlockableSwordItem(new Item.Properties().sword(ToolMaterial.GOLD, 3.0F, -2.4F))); // Sakura - allow blocking with swords public static final Item GOLDEN_SHOVEL = registerItem("golden_shovel", properties -> new ShovelItem(ToolMaterial.GOLD, 1.5F, -3.0F, properties)); - public static final Item GOLDEN_PICKAXE = registerItem("golden_pickaxe", properties -> new PickaxeItem(ToolMaterial.GOLD, 1.0F, -2.8F, properties)); + public static final Item GOLDEN_PICKAXE = registerItem("golden_pickaxe", new Item.Properties().pickaxe(ToolMaterial.GOLD, 1.0F, -2.8F)); public static final Item GOLDEN_AXE = registerItem("golden_axe", properties -> new AxeItem(ToolMaterial.GOLD, 6.0F, -3.0F, properties)); public static final Item GOLDEN_HOE = registerItem("golden_hoe", properties -> new HoeItem(ToolMaterial.GOLD, 0.0F, -3.0F, properties)); -- public static final Item IRON_SWORD = registerItem("iron_sword", properties -> new SwordItem(ToolMaterial.IRON, 3.0F, -2.4F, properties)); -+ public static final Item IRON_SWORD = registerItem("iron_sword", properties -> new me.samsuik.sakura.player.item.BlockableSwordItem(ToolMaterial.IRON, 3.0F, -2.4F, properties)); // Sakura - allow blocking with swords +- public static final Item IRON_SWORD = registerItem("iron_sword", new Item.Properties().sword(ToolMaterial.IRON, 3.0F, -2.4F)); ++ public static final Item IRON_SWORD = registerItem("iron_sword", properties -> new me.samsuik.sakura.player.item.BlockableSwordItem(new Item.Properties().sword(ToolMaterial.IRON, 3.0F, -2.4F))); // Sakura - allow blocking with swords public static final Item IRON_SHOVEL = registerItem("iron_shovel", properties -> new ShovelItem(ToolMaterial.IRON, 1.5F, -3.0F, properties)); - public static final Item IRON_PICKAXE = registerItem("iron_pickaxe", properties -> new PickaxeItem(ToolMaterial.IRON, 1.0F, -2.8F, properties)); + public static final Item IRON_PICKAXE = registerItem("iron_pickaxe", new Item.Properties().pickaxe(ToolMaterial.IRON, 1.0F, -2.8F)); public static final Item IRON_AXE = registerItem("iron_axe", properties -> new AxeItem(ToolMaterial.IRON, 6.0F, -3.1F, properties)); public static final Item IRON_HOE = registerItem("iron_hoe", properties -> new HoeItem(ToolMaterial.IRON, -2.0F, -1.0F, properties)); -- public static final Item DIAMOND_SWORD = registerItem("diamond_sword", properties -> new SwordItem(ToolMaterial.DIAMOND, 3.0F, -2.4F, properties)); -+ public static final Item DIAMOND_SWORD = registerItem("diamond_sword", properties -> new me.samsuik.sakura.player.item.BlockableSwordItem(ToolMaterial.DIAMOND, 3.0F, -2.4F, properties)); // Sakura - allow blocking with swords +- public static final Item DIAMOND_SWORD = registerItem("diamond_sword", new Item.Properties().sword(ToolMaterial.DIAMOND, 3.0F, -2.4F)); ++ public static final Item DIAMOND_SWORD = registerItem("diamond_sword", properties -> new me.samsuik.sakura.player.item.BlockableSwordItem(new Item.Properties().sword(ToolMaterial.DIAMOND, 3.0F, -2.4F))); // Sakura - allow blocking with swords public static final Item DIAMOND_SHOVEL = registerItem("diamond_shovel", properties -> new ShovelItem(ToolMaterial.DIAMOND, 1.5F, -3.0F, properties)); - public static final Item DIAMOND_PICKAXE = registerItem("diamond_pickaxe", properties -> new PickaxeItem(ToolMaterial.DIAMOND, 1.0F, -2.8F, properties)); + public static final Item DIAMOND_PICKAXE = registerItem("diamond_pickaxe", new Item.Properties().pickaxe(ToolMaterial.DIAMOND, 1.0F, -2.8F)); public static final Item DIAMOND_AXE = registerItem("diamond_axe", properties -> new AxeItem(ToolMaterial.DIAMOND, 5.0F, -3.0F, properties)); -@@ -1194,6 +_,7 @@ + public static final Item DIAMOND_HOE = registerItem("diamond_hoe", properties -> new HoeItem(ToolMaterial.DIAMOND, -3.0F, 0.0F, properties)); +- public static final Item NETHERITE_SWORD = registerItem("netherite_sword", new Item.Properties().sword(ToolMaterial.NETHERITE, 3.0F, -2.4F).fireResistant()); ++ public static final Item NETHERITE_SWORD = registerItem("netherite_sword", properties -> new me.samsuik.sakura.player.item.BlockableSwordItem(new Item.Properties().sword(ToolMaterial.NETHERITE, 3.0F, -2.4F).fireResistant())); // Sakura - allow blocking with swords + public static final Item NETHERITE_SHOVEL = registerItem( + "netherite_shovel", properties -> new ShovelItem(ToolMaterial.NETHERITE, 1.5F, -3.0F, properties), new Item.Properties().fireResistant() + ); +@@ -1210,6 +_,7 @@ public static final Item GOLDEN_APPLE = registerItem("golden_apple", new Item.Properties().food(Foods.GOLDEN_APPLE, Consumables.GOLDEN_APPLE)); public static final Item ENCHANTED_GOLDEN_APPLE = registerItem( "enchanted_golden_apple", @@ -41,7 +47,7 @@ new Item.Properties() .rarity(Rarity.RARE) .food(Foods.ENCHANTED_GOLDEN_APPLE, Consumables.ENCHANTED_GOLDEN_APPLE) -@@ -1295,12 +_,12 @@ +@@ -1311,12 +_,12 @@ (block, properties) -> new HangingSignItem(block, Blocks.WARPED_WALL_HANGING_SIGN, properties), new Item.Properties().stacksTo(16) ); @@ -57,7 +63,7 @@ ); public static final Item POWDER_SNOW_BUCKET = registerItem( "powder_snow_bucket", -@@ -1311,6 +_,7 @@ +@@ -1327,6 +_,7 @@ public static final Item LEATHER = registerItem("leather"); public static final Item MILK_BUCKET = registerItem( "milk_bucket", diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/BaseSpawner.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/BaseSpawner.java.patch index 8ea169e..51dff6e 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/BaseSpawner.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/BaseSpawner.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/BaseSpawner.java +++ b/net/minecraft/world/level/BaseSpawner.java -@@ -46,12 +_,24 @@ +@@ -48,12 +_,24 @@ public int spawnRange = 4; private int tickDelay = 0; // Paper - Configurable mob spawner tick rate @@ -17,7 +17,7 @@ + public void setEntityId(EntityType type, @Nullable Level level, RandomSource random, BlockPos pos) { this.getOrCreateNextSpawnData(level, random, pos).getEntityToSpawn().putString("id", BuiltInRegistries.ENTITY_TYPE.getKey(type).toString()); - this.spawnPotentials = SimpleWeightedRandomList.empty(); // CraftBukkit - SPIGOT-3496, MC-92282 + this.spawnPotentials = WeightedList.of(); // CraftBukkit - SPIGOT-3496, MC-92282 } public boolean isNearPlayer(Level level, BlockPos pos) { @@ -25,7 +25,7 @@ return level.hasNearbyAlivePlayerThatAffectsSpawning(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, this.requiredPlayerRange); // Paper - Affects Spawning API } -@@ -117,7 +_,7 @@ +@@ -122,7 +_,7 @@ if (!customSpawnRules.isValidPosition(blockPos, serverLevel)) { continue; } @@ -34,22 +34,22 @@ continue; } -@@ -145,12 +_,19 @@ +@@ -150,12 +_,19 @@ return; } -- int size1 = serverLevel.getEntities( +- int size = serverLevel.getEntities( - EntityTypeTest.forExactClass(entity.getClass()), - new AABB(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1).inflate(this.spawnRange), - EntitySelector.NO_SPECTATORS - ) - .size(); + // Sakura start - configure mob spawner behaviour -+ final int size1; ++ final int size; + if (serverLevel.sakuraConfig().environment.mobSpawner.ignoreEntityLimit) { -+ size1 = 0; ++ size = 0; + } else { -+ size1 = serverLevel.getEntities( ++ size = serverLevel.getEntities( + EntityTypeTest.forExactClass(entity.getClass()), + new AABB(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1).inflate(this.spawnRange), + EntitySelector.NO_SPECTATORS @@ -57,12 +57,12 @@ + .size(); + } + // Sakura end - configure mob spawner behaviour - if (size1 >= this.maxNearbyEntities) { + if (size >= this.maxNearbyEntities) { this.delay(serverLevel, pos); return; -@@ -159,8 +_,11 @@ +@@ -164,8 +_,11 @@ entity.preserveMotion = true; // Paper - Fix Entity Teleportation and cancel velocity if teleported; preserve entity motion from tag - entity.moveTo(entity.getX(), entity.getY(), entity.getZ(), random.nextFloat() * 360.0F, 0.0F); + entity.snapTo(entity.getX(), entity.getY(), entity.getZ(), random.nextFloat() * 360.0F, 0.0F); if (entity instanceof Mob mob) { - if (nextSpawnData.getCustomSpawnRules().isEmpty() && !mob.checkSpawnRules(serverLevel, EntitySpawnReason.SPAWNER) - || !mob.checkSpawnObstruction(serverLevel)) { diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/Level.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/Level.java.patch index 567cce6..37fd669 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/Level.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/Level.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java -@@ -118,7 +_,7 @@ - public final List blockEntityTickers = Lists.newArrayList(); // Paper - public +@@ -108,7 +_,7 @@ + public final List blockEntityTickers = Lists.newArrayList(); public final NeighborUpdater neighborUpdater; private final List pendingBlockEntityTickers = Lists.newArrayList(); - private boolean tickingBlockEntities; @@ -9,7 +9,7 @@ public final Thread thread; private final boolean isDebug; private int skyDarken; -@@ -168,6 +_,18 @@ +@@ -158,6 +_,18 @@ return this.paperConfig; } // Paper end - add paper world config @@ -26,18 +26,15 @@ + } + // Sakura end - local config and property storage - public final io.papermc.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray - public static BlockPos lastPhysicsProblem; // Spigot -@@ -840,6 +_,7 @@ + public static @Nullable BlockPos lastPhysicsProblem; // Spigot + private int tileTickPosition; +@@ -203,10 +_,12 @@ org.bukkit.World.Environment env, // CraftBukkit java.util.function.Function paperWorldConfigCreator, // Paper - create paper world config + java.util.function.Supplier sakuraWorldConfigCreator, // Sakura - sakura configuration files java.util.concurrent.Executor executor // Paper - Anti-Xray ) { - // Paper start - getblock optimisations - cache world height/sections -@@ -853,6 +_,7 @@ - // Paper end - getblock optimisations - cache world height/sections this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) levelData).getLevelName()); // Spigot this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config + this.sakuraConfig = sakuraWorldConfigCreator.get(); // Sakura - sakura configuration files diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/ServerExplosion.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/ServerExplosion.java.patch index db1ff38..ddc2dd9 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/ServerExplosion.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/ServerExplosion.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/world/level/ServerExplosion.java +++ b/net/minecraft/world/level/ServerExplosion.java -@@ -306,6 +_,7 @@ - return (float)missedRays / (float)totalRays; - } - // Paper end - collisions optimisations +@@ -60,6 +_,7 @@ + public float yield; + // CraftBukkit end + public boolean excludeSourceFromDamage = true; // Paper - Allow explosions to damage source + private final boolean consistentRadius; // Sakura - consistent explosion radius public ServerExplosion( ServerLevel level, -@@ -326,6 +_,7 @@ +@@ -80,6 +_,7 @@ this.damageSource = damageSource == null ? level.damageSources().explosion(this) : damageSource; this.damageCalculator = damageCalculator == null ? this.makeDamageCalculator(source) : damageCalculator; this.yield = this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F; // CraftBukkit @@ -16,16 +16,16 @@ } private ExplosionDamageCalculator makeDamageCalculator(@Nullable Entity entity) { -@@ -415,7 +_,7 @@ - - ray += 3; - -- float power = this.radius * (0.7F + this.level.random.nextFloat() * 0.6F); -+ float power = this.radius * (0.7F + (this.consistentRadius ? 0.7F : this.level.random.nextFloat()) * 0.6F); // Sakura - consistent explosion radius - - do { - final int blockX = Mth.floor(currX); -@@ -629,6 +_,12 @@ +@@ -145,7 +_,7 @@ + d /= squareRoot; + d1 /= squareRoot; + d2 /= squareRoot; +- float f = this.radius * (0.7F + this.level.random.nextFloat() * 0.6F); ++ float f = this.radius * (0.7F + (this.consistentRadius ? 0.7F : this.level.random.nextFloat()) * 0.6F); // Sakura - consistent explosion radius + double d3 = this.center.x; + double d4 = this.center.y; + double d5 = this.center.z; +@@ -336,6 +_,12 @@ .getBlockState(blockPos) .onExplosionHit(this.level, blockPos, this, (itemStack, blockPos1) -> addOrAppendStack(list, itemStack, blockPos1)); } diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/BubbleColumnBlock.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/BubbleColumnBlock.java.patch index a1a3bfe..c5e62d1 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/BubbleColumnBlock.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/BubbleColumnBlock.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/world/level/block/BubbleColumnBlock.java +++ b/net/minecraft/world/level/block/BubbleColumnBlock.java -@@ -49,6 +_,13 @@ +@@ -50,6 +_,13 @@ @Override - protected void entityInside(BlockState state, Level level, BlockPos pos, Entity entity) { + protected void entityInside(BlockState state, Level level, BlockPos pos, Entity entity, InsideBlockEffectApplier effectApplier) { if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(level, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent + // Sakura start - configure bubble columns affecting cannon entities + if (!level.sakuraConfig().cannons.tntAndSandAffectedByBubbleColumns && ( @@ -12,5 +12,5 @@ + } + // Sakura end - configure bubble columns affecting cannon entities BlockState blockState = level.getBlockState(pos.above()); - if (blockState.isAir()) { - entity.onAboveBubbleCol(state.getValue(DRAG_DOWN)); + boolean flag = blockState.getCollisionShape(level, pos).isEmpty() && blockState.getFluidState().isEmpty(); + if (flag) { diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/CactusBlock.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/CactusBlock.java.patch index 07721c0..6871851 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/CactusBlock.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/CactusBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/CactusBlock.java +++ b/net/minecraft/world/level/block/CactusBlock.java -@@ -48,6 +_,19 @@ +@@ -52,6 +_,19 @@ @Override protected void randomTick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) { @@ -20,15 +20,16 @@ BlockPos blockPos = pos.above(); if (level.isEmptyBlock(blockPos)) { int i = 1; -@@ -63,6 +_,11 @@ - if (ageValue >= 15 || (modifier != 100 && random.nextFloat() < (modifier / (100.0f * 16)))) { // Spigot - SPIGOT-7159: Better modifier - org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(level, blockPos, this.defaultBlockState()); // CraftBukkit - BlockState blockState = state.setValue(AGE, Integer.valueOf(0)); -+ // Sakura start - use random chance for crop growth; fix cactus growing next to a block and not breaking -+ if (level.sakuraConfig().environment.crops.useRandomChanceToGrow) { -+ level.neighborShapeChanged(Direction.UP, blockPos, pos, state, 4, 1); -+ } -+ // Sakura end - use random chance for crop growth; fix cactus growing next to a block and not breaking - level.setBlock(pos, blockState, 4); - level.neighborChanged(blockState, blockPos, this, null, false); - } else if (modifier == 100 || random.nextFloat() < (modifier / (100.0f * 16))) { // Spigot - SPIGOT-7159: Better modifier resolution +@@ -75,6 +_,12 @@ + } + // Paper end + BlockState blockState = state.setValue(AGE, 0); ++ // Sakura start - use random chance for crop growth; fix cactus growing next to a block and not breaking ++ // todo: 1.21.5 update ++ /*if (level.sakuraConfig().environment.crops.useRandomChanceToGrow) { ++ level.neighborShapeChanged(Direction.UP, blockPos, pos, state, 4, 1); ++ }*/ ++ // Sakura end - use random chance for crop growth; fix cactus growing next to a block and not breaking + level.setBlock(pos, blockState, 260); + level.neighborChanged(blockState, blockPos, this, null, false); + } diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/CarpetBlock.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/CarpetBlock.java.patch deleted file mode 100644 index 6996036..0000000 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/CarpetBlock.java.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- a/net/minecraft/world/level/block/CarpetBlock.java -+++ b/net/minecraft/world/level/block/CarpetBlock.java -@@ -15,6 +_,7 @@ - public class CarpetBlock extends Block { - public static final MapCodec CODEC = simpleCodec(CarpetBlock::new); - protected static final VoxelShape SHAPE = Block.box(0.0, 0.0, 0.0, 16.0, 1.0, 16.0); -+ private static final VoxelShape SHAPE_COPY = SHAPE.copy(); // Sakura - protect block shapes against plugins - - @Override - public MapCodec codec() { -@@ -27,7 +_,7 @@ - - @Override - protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { -- return SHAPE; -+ return SHAPE_COPY; // Sakura - protect block shapes against plugins - } - - @Override diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/LadderBlock.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/LadderBlock.java.patch deleted file mode 100644 index d941465..0000000 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/LadderBlock.java.patch +++ /dev/null @@ -1,36 +0,0 @@ ---- a/net/minecraft/world/level/block/LadderBlock.java -+++ b/net/minecraft/world/level/block/LadderBlock.java -@@ -29,6 +_,12 @@ - protected static final VoxelShape WEST_AABB = Block.box(13.0, 0.0, 0.0, 16.0, 16.0, 16.0); - protected static final VoxelShape SOUTH_AABB = Block.box(0.0, 0.0, 0.0, 16.0, 16.0, 3.0); - protected static final VoxelShape NORTH_AABB = Block.box(0.0, 0.0, 13.0, 16.0, 16.0, 16.0); -+ // Sakura start - protect block shapes against plugins -+ private static final VoxelShape EAST_AABB_COPY = EAST_AABB.copy(); -+ private static final VoxelShape WEST_AABB_COPY = WEST_AABB.copy(); -+ private static final VoxelShape SOUTH_AABB_COPY = SOUTH_AABB.copy(); -+ private static final VoxelShape NORTH_AABB_COPY = NORTH_AABB.copy(); -+ // Sakura end - protect block shapes against plugins - - @Override - public MapCodec codec() { -@@ -44,14 +_,16 @@ - protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { - switch ((Direction)state.getValue(FACING)) { - case NORTH: -- return NORTH_AABB; -+ // Sakura start - protect block shapes against plugins -+ return NORTH_AABB_COPY; - case SOUTH: -- return SOUTH_AABB; -+ return SOUTH_AABB_COPY; - case WEST: -- return WEST_AABB; -+ return WEST_AABB_COPY; - case EAST: - default: -- return EAST_AABB; -+ return EAST_AABB_COPY; -+ // Sakura end - protect block shapes against plugins - } - } - diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/SugarCaneBlock.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/SugarCaneBlock.java.patch index 6f4a80c..a30be3b 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/SugarCaneBlock.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/SugarCaneBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/SugarCaneBlock.java +++ b/net/minecraft/world/level/block/SugarCaneBlock.java -@@ -49,6 +_,19 @@ +@@ -48,6 +_,19 @@ @Override protected void randomTick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) { @@ -20,11 +20,11 @@ if (level.isEmptyBlock(pos.above())) { int i = 1; -@@ -62,6 +_,7 @@ - if (ageValue >= 15 || (modifier != 100 && random.nextFloat() < (modifier / (100.0f * 16)))) { // Spigot - SPIGOT-7159: Better modifier resolution - org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(level, pos.above(), this.defaultBlockState()); // CraftBukkit - level.setBlock(pos, state.setValue(AGE, Integer.valueOf(0)), 4); +@@ -61,6 +_,7 @@ + if (ageValue >= 15 || (modifier != 100 && random.nextFloat() < (modifier / (100.0F * 16)))) { // Spigot - SPIGOT-7159: Better modifier resolution + org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(level, pos.above(), this.defaultBlockState(), 3); // CraftBukkit + level.setBlock(pos, state.setValue(AGE, 0), 260); + // Sakura - use random chance for crop growth; conflict on change - } else if (modifier == 100 || random.nextFloat() < (modifier / (100.0f * 16))) { // Spigot - SPIGOT-7159: Better modifier resolution - level.setBlock(pos, state.setValue(AGE, Integer.valueOf(ageValue + 1)), 4); + } else if (modifier == 100 || random.nextFloat() < (modifier / (100.0F * 16))) { // Spigot - SPIGOT-7159: Better modifier resolution + level.setBlock(pos, state.setValue(AGE, ageValue + 1), 260); } diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/entity/DispenserBlockEntity.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/entity/DispenserBlockEntity.java.patch index 7617494..3b95e97 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/entity/DispenserBlockEntity.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/entity/DispenserBlockEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/entity/DispenserBlockEntity.java +++ b/net/minecraft/world/level/block/entity/DispenserBlockEntity.java -@@ -65,8 +_,11 @@ +@@ -70,8 +_,11 @@ int i = -1; int i1 = 1; diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/piston/PistonBaseBlock.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/piston/PistonBaseBlock.java.patch index be1773c..9bfb497 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/piston/PistonBaseBlock.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/piston/PistonBaseBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/piston/PistonBaseBlock.java +++ b/net/minecraft/world/level/block/piston/PistonBaseBlock.java -@@ -392,6 +_,14 @@ +@@ -369,6 +_,14 @@ for (int i1 = toPush.size() - 1; i1 >= 0; i1--) { // Paper start - fix a variety of piston desync dupes boolean allowDesync = io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowPistonDuplication; diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java.patch index 8f5df7f..affba4c 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java +++ b/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java -@@ -43,6 +_,11 @@ - private float progressO; +@@ -47,6 +_,11 @@ + private float progressO = 0.0F; private long lastTicked; private int deathTicks; + // Sakura start - cache moving block entity collision shape @@ -12,7 +12,7 @@ public PistonMovingBlockEntity(BlockPos pos, BlockState blockState) { super(BlockEntityType.PISTON, pos, blockState); -@@ -351,6 +_,18 @@ +@@ -363,6 +_,18 @@ } public VoxelShape getCollisionShape(BlockGetter level, BlockPos pos) { @@ -30,4 +30,4 @@ + // Sakura end - cache moving block entity collision shape VoxelShape collisionShape; if (!this.extending && this.isSourcePiston && this.movedState.getBlock() instanceof PistonBaseBlock) { - collisionShape = this.movedState.setValue(PistonBaseBlock.EXTENDED, Boolean.valueOf(true)).getCollisionShape(level, pos); + collisionShape = this.movedState.setValue(PistonBaseBlock.EXTENDED, true).getCollisionShape(level, pos); diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/chunk/LevelChunkSection.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/chunk/LevelChunkSection.java.patch index 515439f..23ec403 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/chunk/LevelChunkSection.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/chunk/LevelChunkSection.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/chunk/LevelChunkSection.java +++ b/net/minecraft/world/level/chunk/LevelChunkSection.java -@@ -310,12 +_,18 @@ +@@ -205,12 +_,18 @@ public void fillBiomesFromNoise(BiomeResolver biomeResolver, Climate.Sampler climateSampler, int x, int y, int z) { PalettedContainer> palettedContainer = this.biomes.recreate(); diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/material/FlowingFluid.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/material/FlowingFluid.java.patch index 423bd3a..775fd20 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/material/FlowingFluid.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/material/FlowingFluid.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/material/FlowingFluid.java +++ b/net/minecraft/world/level/material/FlowingFluid.java -@@ -152,12 +_,12 @@ +@@ -110,12 +_,12 @@ } protected void spread(ServerLevel level, BlockPos pos, BlockState blockState, FluidState fluidState) { @@ -15,7 +15,7 @@ Fluid type = newLiquid.getType(); if (fluidState1.canBeReplacedWith(level, blockPos, type, Direction.DOWN) && canHoldSpecificFluid(level, blockPos, blockState1, type)) { // CraftBukkit start -@@ -199,6 +_,11 @@ +@@ -157,6 +_,11 @@ BlockPos blockPos = pos.relative(direction); final BlockState blockStateIfLoaded = level.getBlockStateIfLoaded(blockPos); // Paper - Prevent chunk loading from fluid flowing if (blockStateIfLoaded == null) continue; // Paper - Prevent chunk loading from fluid flowing @@ -27,7 +27,7 @@ // CraftBukkit start org.bukkit.block.Block source = org.bukkit.craftbukkit.block.CraftBlock.at(level, pos); org.bukkit.event.block.BlockFromToEvent event = new org.bukkit.event.block.BlockFromToEvent(source, org.bukkit.craftbukkit.block.CraftBlock.notchToBlockFace(direction)); -@@ -213,17 +_,71 @@ +@@ -171,17 +_,71 @@ } } @@ -101,7 +101,7 @@ if (fluidState.isSource()) { i1++; } -@@ -236,19 +_,11 @@ +@@ -194,19 +_,11 @@ BlockState blockState1 = level.getBlockState(mutableBlockPos.setWithOffset(pos, Direction.DOWN)); FluidState fluidState1 = blockState1.getFluidState(); if (blockState1.isSolid() || this.isSourceBlockOfThisType(fluidState1)) { @@ -122,8 +122,8 @@ + return i; // Sakura - optimise new liquid level } - // Paper start - fluid method optimisations -@@ -413,7 +_,7 @@ + private static boolean canPassThroughWall( +@@ -362,7 +_,7 @@ if (blockState == null) continue; // Paper - Prevent chunk loading from fluid flowing FluidState fluidState = blockState.getFluidState(); if (this.canMaybePassThrough(level, pos, state, direction, blockPos, blockState, fluidState)) { @@ -132,7 +132,7 @@ if (canHoldSpecificFluid(level, blockPos, blockState, newLiquid.getType())) { if (spreadContext == null) { spreadContext = new FlowingFluid.SpreadContext(level, pos); -@@ -464,6 +_,11 @@ +@@ -413,6 +_,11 @@ } private static boolean canHoldSpecificFluid(BlockGetter level, BlockPos pos, BlockState state, Fluid fluid) { @@ -144,7 +144,7 @@ return !(state.getBlock() instanceof LiquidBlockContainer liquidBlockContainer) || liquidBlockContainer.canPlaceLiquid(null, level, pos, state, fluid); } -@@ -476,7 +_,7 @@ +@@ -425,7 +_,7 @@ @Override public void tick(ServerLevel level, BlockPos pos, BlockState blockState, FluidState fluidState) { if (!fluidState.isSource()) { diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/material/Fluid.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/material/Fluid.java.patch index cc9bae7..96feb31 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/material/Fluid.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/material/Fluid.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/material/Fluid.java +++ b/net/minecraft/world/level/material/Fluid.java -@@ -67,6 +_,12 @@ +@@ -73,6 +_,12 @@ protected abstract boolean canBeReplacedWith(FluidState state, BlockGetter level, BlockPos pos, Fluid fluid, Direction direction); diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/material/LavaFluid.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/material/LavaFluid.java.patch index 7b6837c..7d180ef 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/material/LavaFluid.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/material/LavaFluid.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/material/LavaFluid.java +++ b/net/minecraft/world/level/material/LavaFluid.java -@@ -177,12 +_,20 @@ +@@ -189,12 +_,20 @@ @Override public int getTickDelay(LevelReader level) { diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/redstone/ExperimentalRedstoneUtils.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/redstone/ExperimentalRedstoneUtils.java.patch index 12bedbb..f1bc138 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/redstone/ExperimentalRedstoneUtils.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/redstone/ExperimentalRedstoneUtils.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/world/level/redstone/ExperimentalRedstoneUtils.java +++ b/net/minecraft/world/level/redstone/ExperimentalRedstoneUtils.java -@@ -18,6 +_,7 @@ +@@ -14,6 +_,7 @@ + orientation = orientation.withUp(up); + } + ++ // Sakura - redstone implementation api; conflict on change + if (front != null) { orientation = orientation.withFront(front); } - // Paper start - Optimize redstone (Alternate Current) - use default front instead of random -+ // Sakura - redstone implementation api; conflict on change - else if (level.paperConfig().misc.redstoneImplementation == io.papermc.paper.configuration.WorldConfiguration.Misc.RedstoneImplementation.ALTERNATE_CURRENT) { - orientation = orientation.withFront(Direction.WEST); - } diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/phys/shapes/VoxelShape.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/phys/shapes/VoxelShape.java.patch deleted file mode 100644 index c4b3107..0000000 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/phys/shapes/VoxelShape.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- a/net/minecraft/world/phys/shapes/VoxelShape.java -+++ b/net/minecraft/world/phys/shapes/VoxelShape.java -@@ -433,6 +_,12 @@ - ); - } - // Paper end - optimise collisions -+ // Sakura start - protect block shapes against plugins -+ public final VoxelShape copy() { -+ this.cachedToAABBs = null; -+ return this.move(Vec3.ZERO); -+ } -+ // Sakura end - protect block shapes against plugins - - protected VoxelShape(DiscreteVoxelShape shape) { - this.shape = shape; diff --git a/sakura-server/minecraft-patches/features/0001-Track-block-changes-and-level-tick-scheduler.patch b/sakura-server/minecraft-patches/unapplied/features/0001-Track-block-changes-and-level-tick-scheduler.patch similarity index 100% rename from sakura-server/minecraft-patches/features/0001-Track-block-changes-and-level-tick-scheduler.patch rename to sakura-server/minecraft-patches/unapplied/features/0001-Track-block-changes-and-level-tick-scheduler.patch diff --git a/sakura-server/minecraft-patches/features/0002-Client-Visibility-Settings.patch b/sakura-server/minecraft-patches/unapplied/features/0002-Client-Visibility-Settings.patch similarity index 100% rename from sakura-server/minecraft-patches/features/0002-Client-Visibility-Settings.patch rename to sakura-server/minecraft-patches/unapplied/features/0002-Client-Visibility-Settings.patch diff --git a/sakura-server/minecraft-patches/features/0003-Load-Chunks-on-Movement.patch b/sakura-server/minecraft-patches/unapplied/features/0003-Load-Chunks-on-Movement.patch similarity index 100% rename from sakura-server/minecraft-patches/features/0003-Load-Chunks-on-Movement.patch rename to sakura-server/minecraft-patches/unapplied/features/0003-Load-Chunks-on-Movement.patch diff --git a/sakura-server/minecraft-patches/features/0004-Slice-Packet-obfuscation-and-reduction.patch b/sakura-server/minecraft-patches/unapplied/features/0004-Slice-Packet-obfuscation-and-reduction.patch similarity index 100% rename from sakura-server/minecraft-patches/features/0004-Slice-Packet-obfuscation-and-reduction.patch rename to sakura-server/minecraft-patches/unapplied/features/0004-Slice-Packet-obfuscation-and-reduction.patch diff --git a/sakura-server/minecraft-patches/features/0005-Optimise-paper-explosions.patch b/sakura-server/minecraft-patches/unapplied/features/0005-Optimise-paper-explosions.patch similarity index 100% rename from sakura-server/minecraft-patches/features/0005-Optimise-paper-explosions.patch rename to sakura-server/minecraft-patches/unapplied/features/0005-Optimise-paper-explosions.patch diff --git a/sakura-server/minecraft-patches/features/0006-Store-Entity-Data-State.patch b/sakura-server/minecraft-patches/unapplied/features/0006-Store-Entity-Data-State.patch similarity index 100% rename from sakura-server/minecraft-patches/features/0006-Store-Entity-Data-State.patch rename to sakura-server/minecraft-patches/unapplied/features/0006-Store-Entity-Data-State.patch diff --git a/sakura-server/minecraft-patches/features/0007-Merge-Cannon-Entities.patch b/sakura-server/minecraft-patches/unapplied/features/0007-Merge-Cannon-Entities.patch similarity index 100% rename from sakura-server/minecraft-patches/features/0007-Merge-Cannon-Entities.patch rename to sakura-server/minecraft-patches/unapplied/features/0007-Merge-Cannon-Entities.patch diff --git a/sakura-server/minecraft-patches/features/0008-Replace-explosion-density-cache.patch b/sakura-server/minecraft-patches/unapplied/features/0008-Replace-explosion-density-cache.patch similarity index 100% rename from sakura-server/minecraft-patches/features/0008-Replace-explosion-density-cache.patch rename to sakura-server/minecraft-patches/unapplied/features/0008-Replace-explosion-density-cache.patch diff --git a/sakura-server/minecraft-patches/features/0009-Optimise-explosions-in-protected-regions.patch b/sakura-server/minecraft-patches/unapplied/features/0009-Optimise-explosions-in-protected-regions.patch similarity index 100% rename from sakura-server/minecraft-patches/features/0009-Optimise-explosions-in-protected-regions.patch rename to sakura-server/minecraft-patches/unapplied/features/0009-Optimise-explosions-in-protected-regions.patch diff --git a/sakura-server/minecraft-patches/features/0010-Specialised-Explosions.patch b/sakura-server/minecraft-patches/unapplied/features/0010-Specialised-Explosions.patch similarity index 100% rename from sakura-server/minecraft-patches/features/0010-Specialised-Explosions.patch rename to sakura-server/minecraft-patches/unapplied/features/0010-Specialised-Explosions.patch diff --git a/sakura-server/minecraft-patches/features/0011-Optimise-cannon-entity-movement.patch b/sakura-server/minecraft-patches/unapplied/features/0011-Optimise-cannon-entity-movement.patch similarity index 100% rename from sakura-server/minecraft-patches/features/0011-Optimise-cannon-entity-movement.patch rename to sakura-server/minecraft-patches/unapplied/features/0011-Optimise-cannon-entity-movement.patch diff --git a/sakura-server/minecraft-patches/features/0012-Add-maxSearch-to-getEntities.patch b/sakura-server/minecraft-patches/unapplied/features/0012-Add-maxSearch-to-getEntities.patch similarity index 100% rename from sakura-server/minecraft-patches/features/0012-Add-maxSearch-to-getEntities.patch rename to sakura-server/minecraft-patches/unapplied/features/0012-Add-maxSearch-to-getEntities.patch diff --git a/sakura-server/minecraft-patches/features/0013-Use-maxEntityCollision-limit-for-entity-retrieval.patch b/sakura-server/minecraft-patches/unapplied/features/0013-Use-maxEntityCollision-limit-for-entity-retrieval.patch similarity index 100% rename from sakura-server/minecraft-patches/features/0013-Use-maxEntityCollision-limit-for-entity-retrieval.patch rename to sakura-server/minecraft-patches/unapplied/features/0013-Use-maxEntityCollision-limit-for-entity-retrieval.patch diff --git a/sakura-server/minecraft-patches/features/0014-Explosion-Durable-Blocks.patch b/sakura-server/minecraft-patches/unapplied/features/0014-Explosion-Durable-Blocks.patch similarity index 100% rename from sakura-server/minecraft-patches/features/0014-Explosion-Durable-Blocks.patch rename to sakura-server/minecraft-patches/unapplied/features/0014-Explosion-Durable-Blocks.patch diff --git a/sakura-server/minecraft-patches/features/0015-Destroy-Waterlogged-Blocks.patch b/sakura-server/minecraft-patches/unapplied/features/0015-Destroy-Waterlogged-Blocks.patch similarity index 100% rename from sakura-server/minecraft-patches/features/0015-Destroy-Waterlogged-Blocks.patch rename to sakura-server/minecraft-patches/unapplied/features/0015-Destroy-Waterlogged-Blocks.patch diff --git a/sakura-server/minecraft-patches/features/0016-Configure-cannon-physics.patch b/sakura-server/minecraft-patches/unapplied/features/0016-Configure-cannon-physics.patch similarity index 100% rename from sakura-server/minecraft-patches/features/0016-Configure-cannon-physics.patch rename to sakura-server/minecraft-patches/unapplied/features/0016-Configure-cannon-physics.patch diff --git a/sakura-server/minecraft-patches/features/0017-Allow-explosions-to-destroy-lava.patch b/sakura-server/minecraft-patches/unapplied/features/0017-Allow-explosions-to-destroy-lava.patch similarity index 100% rename from sakura-server/minecraft-patches/features/0017-Allow-explosions-to-destroy-lava.patch rename to sakura-server/minecraft-patches/unapplied/features/0017-Allow-explosions-to-destroy-lava.patch diff --git a/sakura-server/minecraft-patches/features/0018-Collide-with-non-solid-blocks.patch b/sakura-server/minecraft-patches/unapplied/features/0018-Collide-with-non-solid-blocks.patch similarity index 100% rename from sakura-server/minecraft-patches/features/0018-Collide-with-non-solid-blocks.patch rename to sakura-server/minecraft-patches/unapplied/features/0018-Collide-with-non-solid-blocks.patch diff --git a/sakura-server/minecraft-patches/features/0019-Reduce-entity-tracker-player-updates.patch b/sakura-server/minecraft-patches/unapplied/features/0019-Reduce-entity-tracker-player-updates.patch similarity index 100% rename from sakura-server/minecraft-patches/features/0019-Reduce-entity-tracker-player-updates.patch rename to sakura-server/minecraft-patches/unapplied/features/0019-Reduce-entity-tracker-player-updates.patch diff --git a/sakura-server/minecraft-patches/features/0020-Legacy-lava-block-formation.patch b/sakura-server/minecraft-patches/unapplied/features/0020-Legacy-lava-block-formation.patch similarity index 100% rename from sakura-server/minecraft-patches/features/0020-Legacy-lava-block-formation.patch rename to sakura-server/minecraft-patches/unapplied/features/0020-Legacy-lava-block-formation.patch diff --git a/sakura-server/minecraft-patches/features/0021-Add-entity-travel-distance-limits.patch b/sakura-server/minecraft-patches/unapplied/features/0021-Add-entity-travel-distance-limits.patch similarity index 100% rename from sakura-server/minecraft-patches/features/0021-Add-entity-travel-distance-limits.patch rename to sakura-server/minecraft-patches/unapplied/features/0021-Add-entity-travel-distance-limits.patch diff --git a/sakura-server/minecraft-patches/features/0022-Protect-scaffolding-from-creepers.patch b/sakura-server/minecraft-patches/unapplied/features/0022-Protect-scaffolding-from-creepers.patch similarity index 100% rename from sakura-server/minecraft-patches/features/0022-Protect-scaffolding-from-creepers.patch rename to sakura-server/minecraft-patches/unapplied/features/0022-Protect-scaffolding-from-creepers.patch diff --git a/sakura-server/minecraft-patches/features/0023-Configurable-left-shooting-and-adjusting-limits.patch b/sakura-server/minecraft-patches/unapplied/features/0023-Configurable-left-shooting-and-adjusting-limits.patch similarity index 100% rename from sakura-server/minecraft-patches/features/0023-Configurable-left-shooting-and-adjusting-limits.patch rename to sakura-server/minecraft-patches/unapplied/features/0023-Configurable-left-shooting-and-adjusting-limits.patch diff --git a/sakura-server/minecraft-patches/features/0024-Optimise-hopper-ticking.patch b/sakura-server/minecraft-patches/unapplied/features/0024-Optimise-hopper-ticking.patch similarity index 100% rename from sakura-server/minecraft-patches/features/0024-Optimise-hopper-ticking.patch rename to sakura-server/minecraft-patches/unapplied/features/0024-Optimise-hopper-ticking.patch diff --git a/sakura-server/minecraft-patches/features/0025-Optimise-entity-scheduler-ticking.patch b/sakura-server/minecraft-patches/unapplied/features/0025-Optimise-entity-scheduler-ticking.patch similarity index 100% rename from sakura-server/minecraft-patches/features/0025-Optimise-entity-scheduler-ticking.patch rename to sakura-server/minecraft-patches/unapplied/features/0025-Optimise-entity-scheduler-ticking.patch diff --git a/sakura-server/minecraft-patches/features/0026-Optimise-check-inside-blocks-and-traverse-blocks.patch b/sakura-server/minecraft-patches/unapplied/features/0026-Optimise-check-inside-blocks-and-traverse-blocks.patch similarity index 100% rename from sakura-server/minecraft-patches/features/0026-Optimise-check-inside-blocks-and-traverse-blocks.patch rename to sakura-server/minecraft-patches/unapplied/features/0026-Optimise-check-inside-blocks-and-traverse-blocks.patch diff --git a/sakura-server/minecraft-patches/features/0027-copy-EntityList-implementation-to-BasicEntityList.patch b/sakura-server/minecraft-patches/unapplied/features/0027-copy-EntityList-implementation-to-BasicEntityList.patch similarity index 100% rename from sakura-server/minecraft-patches/features/0027-copy-EntityList-implementation-to-BasicEntityList.patch rename to sakura-server/minecraft-patches/unapplied/features/0027-copy-EntityList-implementation-to-BasicEntityList.patch diff --git a/sakura-server/minecraft-patches/features/0028-Cache-vanilla-and-eigencraft-redstone-wires.patch b/sakura-server/minecraft-patches/unapplied/features/0028-Cache-vanilla-and-eigencraft-redstone-wires.patch similarity index 100% rename from sakura-server/minecraft-patches/features/0028-Cache-vanilla-and-eigencraft-redstone-wires.patch rename to sakura-server/minecraft-patches/unapplied/features/0028-Cache-vanilla-and-eigencraft-redstone-wires.patch diff --git a/sakura-server/minecraft-patches/features/0029-Configure-breaking-blocks-outside-the-world-border.patch b/sakura-server/minecraft-patches/unapplied/features/0029-Configure-breaking-blocks-outside-the-world-border.patch similarity index 100% rename from sakura-server/minecraft-patches/features/0029-Configure-breaking-blocks-outside-the-world-border.patch rename to sakura-server/minecraft-patches/unapplied/features/0029-Configure-breaking-blocks-outside-the-world-border.patch diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/RedStoneWireBlock.java.patch b/sakura-server/minecraft-patches/unapplied/rejected/net/minecraft/world/level/block/RedStoneWireBlock.java.patch.rej similarity index 93% rename from sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/RedStoneWireBlock.java.patch rename to sakura-server/minecraft-patches/unapplied/rejected/net/minecraft/world/level/block/RedStoneWireBlock.java.patch.rej index 0a595ae..43f4341 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/block/RedStoneWireBlock.java.patch +++ b/sakura-server/minecraft-patches/unapplied/rejected/net/minecraft/world/level/block/RedStoneWireBlock.java.patch.rej @@ -1,6 +1,5 @@ ---- a/net/minecraft/world/level/block/RedStoneWireBlock.java -+++ b/net/minecraft/world/level/block/RedStoneWireBlock.java -@@ -300,7 +_,7 @@ +++++ REJECTED HUNK: 1 +@@ -300,7 +300,7 @@ * Note: Added 'source' argument so as to help determine direction of information flow */ private void updateSurroundingRedstone(Level worldIn, BlockPos pos, BlockState state, @Nullable Orientation orientation, boolean blockAdded) { @@ -9,7 +8,10 @@ // since 24w33a the source pos is no longer given, but instead an Orientation parameter // when this is not null, it can be used to find the source pos, which the turbo uses // to find the direction of information flow -@@ -373,7 +_,7 @@ +++++ END HUNK + +++++ REJECTED HUNK: 2 +@@ -373,7 +373,7 @@ protected void onPlace(BlockState state, Level level, BlockPos pos, BlockState oldState, boolean isMoving) { if (!oldState.is(state.getBlock()) && !level.isClientSide) { // Paper start - optimize redstone - replace call to updatePowerStrength @@ -18,7 +20,10 @@ level.getWireHandler().onWireAdded(pos, state); // Alternate Current } else { this.updateSurroundingRedstone(level, pos, state, null, true); // Vanilla/Eigencraft -@@ -398,7 +_,7 @@ +++++ END HUNK + +++++ REJECTED HUNK: 3 +@@ -398,7 +398,7 @@ } // Paper start - optimize redstone - replace call to updatePowerStrength @@ -27,7 +32,10 @@ level.getWireHandler().onWireRemoved(pos, state); // Alternate Current } else { this.updateSurroundingRedstone(level, pos, state, null, false); // Vanilla/Eigencraft -@@ -429,7 +_,7 @@ +++++ END HUNK + +++++ REJECTED HUNK: 4 +@@ -429,7 +429,7 @@ if (!level.isClientSide) { // Paper start - optimize redstone (Alternate Current) // Alternate Current handles breaking of redstone wires in the WireHandler. @@ -36,3 +44,4 @@ level.getWireHandler().onWireUpdated(pos, state, orientation); } else // Paper end - optimize redstone (Alternate Current) +++++ END HUNK diff --git a/sakura-server/minecraft-patches/unapplied/update b/sakura-server/minecraft-patches/unapplied/update new file mode 100644 index 0000000..0b9d1d9 --- /dev/null +++ b/sakura-server/minecraft-patches/unapplied/update @@ -0,0 +1,4 @@ +the rejected redstone wire file patch should be a feature patch +need to look into the cactusblock changes +update the blockable sword logic +uncomment code in specialisedexplosion and tntexplosion when the moonrise patch is updated \ No newline at end of file diff --git a/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/CraftServer.java.patch b/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/CraftServer.java.patch index 113ba6a..29d243d 100644 --- a/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/CraftServer.java.patch +++ b/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/CraftServer.java.patch @@ -1,6 +1,6 @@ --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1088,6 +_,7 @@ +@@ -1064,6 +_,7 @@ org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot this.console.paperConfigurations.reloadConfigs(this.console); @@ -8,7 +8,7 @@ for (ServerLevel world : this.console.getAllLevels()) { // world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && config.spawnMonsters); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean)) -@@ -1119,6 +_,7 @@ +@@ -1095,6 +_,7 @@ this.reloadData(); org.spigotmc.SpigotConfig.registerCommands(); // Spigot io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper diff --git a/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/CraftWorld.java.patch b/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/CraftWorld.java.patch index 6b7b7a8..ac7dfa4 100644 --- a/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/CraftWorld.java.patch +++ b/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/CraftWorld.java.patch @@ -1,6 +1,6 @@ --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -282,6 +_,12 @@ +@@ -283,6 +_,12 @@ ).isValid(); } // Paper end diff --git a/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/Main.java.patch b/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/Main.java.patch index 628cad3..6c88840 100644 --- a/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/Main.java.patch +++ b/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/Main.java.patch @@ -1,8 +1,8 @@ --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -176,6 +_,14 @@ +@@ -165,6 +_,14 @@ + .defaultsTo(new File[] {}) .describedAs("Jar file"); - // Paper end + // Sakura start - sakura configuration files + acceptsAll(asList("sakura-dir", "sakura-settings-directory"), "Directory for Sakura settings") @@ -12,6 +12,6 @@ + .describedAs("Config directory"); + // Sakura end - sakura configuration files + - // Paper start acceptsAll(asList("server-name"), "Name of the server") .withRequiredArg() + .ofType(String.class) diff --git a/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java.patch b/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java.patch index db80324..5ce9605 100644 --- a/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java.patch +++ b/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java.patch @@ -1,6 +1,6 @@ --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -90,6 +_,18 @@ +@@ -95,6 +_,18 @@ this.entityType = CraftEntityType.minecraftToBukkit(entity.getType()); } diff --git a/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java.patch b/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java.patch index 116a45f..6367f79 100644 --- a/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java.patch +++ b/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java.patch @@ -1,6 +1,6 @@ --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -230,6 +_,18 @@ +@@ -233,6 +_,18 @@ this.firstPlayed = System.currentTimeMillis(); } diff --git a/sakura-server/paper-patches/features/0001-Client-Visibility-Settings.patch b/sakura-server/paper-patches/unapplied/features/0001-Client-Visibility-Settings.patch similarity index 100% rename from sakura-server/paper-patches/features/0001-Client-Visibility-Settings.patch rename to sakura-server/paper-patches/unapplied/features/0001-Client-Visibility-Settings.patch diff --git a/sakura-server/paper-patches/features/0002-Merge-Cannon-Entities.patch b/sakura-server/paper-patches/unapplied/features/0002-Merge-Cannon-Entities.patch similarity index 100% rename from sakura-server/paper-patches/features/0002-Merge-Cannon-Entities.patch rename to sakura-server/paper-patches/unapplied/features/0002-Merge-Cannon-Entities.patch diff --git a/sakura-server/paper-patches/features/0003-Specialised-Explosions.patch b/sakura-server/paper-patches/unapplied/features/0003-Specialised-Explosions.patch similarity index 100% rename from sakura-server/paper-patches/features/0003-Specialised-Explosions.patch rename to sakura-server/paper-patches/unapplied/features/0003-Specialised-Explosions.patch diff --git a/sakura-server/paper-patches/features/0004-Optimise-entity-scheduler-ticking.patch b/sakura-server/paper-patches/unapplied/features/0004-Optimise-entity-scheduler-ticking.patch similarity index 100% rename from sakura-server/paper-patches/features/0004-Optimise-entity-scheduler-ticking.patch rename to sakura-server/paper-patches/unapplied/features/0004-Optimise-entity-scheduler-ticking.patch diff --git a/sakura-server/src/main/java/me/samsuik/sakura/entity/EntityState.java b/sakura-server/src/main/java/me/samsuik/sakura/entity/EntityState.java index fa73f30..35a3d95 100644 --- a/sakura-server/src/main/java/me/samsuik/sakura/entity/EntityState.java +++ b/sakura-server/src/main/java/me/samsuik/sakura/entity/EntityState.java @@ -10,7 +10,7 @@ import org.jspecify.annotations.NullMarked; import java.util.Optional; @NullMarked -public record EntityState(Vec3 position, Vec3 momentum, AABB bb, Vec3 stuckSpeed, Optional supportingPos, boolean onGround, float fallDistance) { +public record EntityState(Vec3 position, Vec3 momentum, AABB bb, Vec3 stuckSpeed, Optional supportingPos, boolean onGround, double fallDistance) { public static EntityState of(Entity entity) { return new EntityState( entity.position(), entity.getDeltaMovement(), entity.getBoundingBox(), diff --git a/sakura-server/src/main/java/me/samsuik/sakura/player/item/BlockableSwordItem.java b/sakura-server/src/main/java/me/samsuik/sakura/player/item/BlockableSwordItem.java index ca0b5af..a5af7d2 100644 --- a/sakura-server/src/main/java/me/samsuik/sakura/player/item/BlockableSwordItem.java +++ b/sakura-server/src/main/java/me/samsuik/sakura/player/item/BlockableSwordItem.java @@ -15,7 +15,7 @@ import net.minecraft.world.level.Level; import org.jspecify.annotations.NullMarked; @NullMarked -public final class BlockableSwordItem extends SwordItem { +public final class BlockableSwordItem extends Item { private static final Consumable BLOCKING_ANIMATION = Consumable.builder() .consumeSeconds(720000) .animation(ItemUseAnimation.BLOCK) @@ -23,8 +23,8 @@ public final class BlockableSwordItem extends SwordItem { .hasConsumeParticles(false) .build(); - public BlockableSwordItem(ToolMaterial material, float attackDamage, float attackSpeed, Properties properties) { - super(material, attackDamage, attackSpeed, properties); + public BlockableSwordItem(Properties properties) { + super(properties); } @Override diff --git a/sakura-server/src/main/java/me/samsuik/sakura/player/visibility/PlayerVisibilitySettings.java b/sakura-server/src/main/java/me/samsuik/sakura/player/visibility/PlayerVisibilitySettings.java index 938fe21..946cbd7 100644 --- a/sakura-server/src/main/java/me/samsuik/sakura/player/visibility/PlayerVisibilitySettings.java +++ b/sakura-server/src/main/java/me/samsuik/sakura/player/visibility/PlayerVisibilitySettings.java @@ -44,16 +44,11 @@ public final class PlayerVisibilitySettings implements VisibilitySettings { } public void loadData(@NonNull CompoundTag tag) { - if (!tag.contains(SETTINGS_COMPOUND_TAG, CompoundTag.TAG_COMPOUND)) { - return; - } - - CompoundTag settingsTag = tag.getCompound(SETTINGS_COMPOUND_TAG); + CompoundTag settingsTag = tag.getCompoundOrEmpty(SETTINGS_COMPOUND_TAG); for (VisibilityType type : VisibilityTypes.types()) { - if (settingsTag.contains(type.key(), CompoundTag.TAG_STRING)) { - VisibilityState state = VisibilityState.valueOf(settingsTag.getString(type.key())); - this.visibilityStates.put(type, state); - } + String typeKey = type.key(); + String stateName = settingsTag.getStringOr(typeKey, type.getDefault().name()); + this.set(type, VisibilityState.valueOf(stateName)); } } diff --git a/sakura-server/src/main/java/me/samsuik/sakura/tps/TickInformationCollector.java b/sakura-server/src/main/java/me/samsuik/sakura/tps/TickInformationCollector.java index 5f88e17..e736e1d 100644 --- a/sakura-server/src/main/java/me/samsuik/sakura/tps/TickInformationCollector.java +++ b/sakura-server/src/main/java/me/samsuik/sakura/tps/TickInformationCollector.java @@ -26,7 +26,8 @@ public final class TickInformationCollector { int entities = 0; for (ServerLevel level : levels) { chunks += level.chunkSource.getFullChunksCount(); - entities += level.entityTickList.entities.size(); + // todo 1.21.5 update + //entities += level.entityTickList.entities.size(); } double averageTick = this.tickSamples.longStream()