9
0
mirror of https://github.com/Samsuik/Sakura.git synced 2025-12-21 15:59:26 +00:00

Start updating to 1.21.5

This commit is contained in:
Samsuik
2025-03-30 13:40:09 +01:00
parent 1316e8819b
commit 0ecadc00f6
95 changed files with 328 additions and 360 deletions

View File

@@ -3,7 +3,7 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent
plugins { plugins {
java java
id("io.papermc.paperweight.patcher") version "2.0.0-beta.14" id("io.papermc.paperweight.patcher") version "2.0.0-beta.16"
} }
paperweight { paperweight {

View File

@@ -1,8 +1,8 @@
group=me.samsuik.sakura group=me.samsuik.sakura
version=1.21.4-R0.1-SNAPSHOT version=1.21.5-R0.1-SNAPSHOT
mcVersion=1.21.4 mcVersion=1.21.5
paperRef=9b1798d6438107fdf0d5939b79a8cf71f4d16e2c paperRef=ce91a8ca123f4e853629d08705e4ece3a09a5a4d
org.gradle.jvmargs=-Xmx2G org.gradle.jvmargs=-Xmx2G
org.gradle.vfs.watch=false org.gradle.vfs.watch=false

View File

@@ -4,15 +4,15 @@
testRuntimeOnly("org.junit.platform:junit-platform-launcher") testRuntimeOnly("org.junit.platform:junit-platform-launcher")
} }
-val generatedApiPath: java.nio.file.Path = layout.projectDirectory.dir("src/generated/java").asFile.toPath() -val generatedDir: 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 = rootProject.layout.projectDirectory.dir("paper-api/src/generated/java").asFile.toPath()
idea { idea {
module { module {
generatedSourceDirs.add(generatedApiPath.toFile()) generatedSourceDirs.add(generatedDir.toFile())
@@ -103,6 +_,18 @@ @@ -103,6 +_,18 @@
main { main {
java { java {
srcDir(generatedApiPath) srcDir(generatedDir)
+ srcDir(file("../paper-api/src/main/java")) + srcDir(file("../paper-api/src/main/java"))
+ } + }
+ resources { + resources {

View File

@@ -1,6 +1,6 @@
--- a/src/main/java/org/bukkit/Bukkit.java --- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java
@@ -126,6 +_,20 @@ @@ -127,6 +_,20 @@
// Paper end // Paper end
} }

View File

@@ -1,9 +1,9 @@
--- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java --- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java
+++ b/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.format.TextDecoration;
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
// Paper end - version command 2.0
+// Sakura start - customise version command +// Sakura start - customise version command
+import net.kyori.adventure.text.event.HoverEvent; +import net.kyori.adventure.text.event.HoverEvent;
+import net.kyori.adventure.text.minimessage.MiniMessage; +import net.kyori.adventure.text.minimessage.MiniMessage;
@@ -12,7 +12,7 @@
public class VersionCommand extends BukkitCommand { public class VersionCommand extends BukkitCommand {
private VersionFetcher versionFetcher; // Paper - version command 2.0 private VersionFetcher versionFetcher; // Paper - version command 2.0
@@ -44,6 +_,15 @@ @@ -42,6 +_,15 @@
return versionFetcher; return versionFetcher;
} }
@@ -28,7 +28,7 @@
public VersionCommand(@NotNull String name) { public VersionCommand(@NotNull String name) {
super(name); super(name);
@@ -55,11 +_,16 @@ @@ -53,11 +_,16 @@
@Override @Override
public boolean execute(@NotNull CommandSender sender, @NotNull String currentAlias, @NotNull String[] args) { public boolean execute(@NotNull CommandSender sender, @NotNull String currentAlias, @NotNull String[] args) {

View File

@@ -1,6 +1,6 @@
--- a/src/main/java/org/bukkit/entity/Entity.java --- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/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.text.event.HoverEvent.ShowEntity>, net.kyori.adventure.sound.Sound.Emitter { // Paper public interface Entity extends Metadatable, CommandSender, Nameable, PersistentDataHolder, net.kyori.adventure.text.event.HoverEventSource<net.kyori.adventure.text.event.HoverEvent.ShowEntity>, net.kyori.adventure.sound.Sound.Emitter { // Paper

View File

@@ -1,16 +1,16 @@
--- a/paper-server/build.gradle.kts --- a/paper-server/build.gradle.kts
+++ b/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 paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
+val serverBrand = rootProject.name +val serverBrand = rootProject.name
dependencies { dependencies {
mache("io.papermc:mache:1.21.4+build.7") mache("io.papermc:mache:1.21.5+build.1")
@@ -21,6 +_,17 @@ @@ -24,6 +_,17 @@
// macheOldPath = file("F:\\Projects\\PaperTooling\\mache\\versions\\1.21.4\\src\\main\\java") minecraftVersion = providers.gradleProperty("mcVersion")
// gitFilePatches = true gitFilePatches = false
+ val fork = forks.register(serverBrand) { + val fork = forks.register(serverBrand) {
+ upstream.patchDir("paperServer") { + upstream.patchDir("paperServer") {
@@ -23,10 +23,10 @@
+ +
+ activeFork = fork + activeFork = fork
+ +
spigot { //updatingMinecraft {
buildDataRef = "3edaf46ec1eed4115ce1b18d2846cded42577e42" // oldPaperCommit = "f4f275519f7c1fbe9db173b7144a4fe81440e365"
packageVersion = "v1_21_R3" // also needs to be updated in MappingEnvironment //}
@@ -101,7 +_,20 @@ @@ -108,7 +_,20 @@
} }
} }
@@ -48,7 +48,7 @@
configurations.named(log4jPlugins.compileClasspathConfigurationName) { configurations.named(log4jPlugins.compileClasspathConfigurationName) {
extendsFrom(configurations.compileClasspath.get()) extendsFrom(configurations.compileClasspath.get())
} }
@@ -119,7 +_,7 @@ @@ -130,7 +_,7 @@
} }
dependencies { dependencies {
@@ -57,3 +57,12 @@
implementation("ca.spottedleaf:concurrentutil:0.0.3") 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-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 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())

View File

@@ -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) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/MinecraftServer.java --- a/net/minecraft/server/MinecraftServer.java
+++ b/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 boolean abnormalExit; // Paper - Improved watchdog support
public volatile Thread shutdownThread; // 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 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 public boolean isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked
private final Set<String> pluginsBlockingSleep = new java.util.HashSet<>(); // Paper - API to allow/disallow tick sleeping private final Set<String> pluginsBlockingSleep = new java.util.HashSet<>(); // Paper - API to allow/disallow tick sleeping
public static final long SERVER_INIT = System.nanoTime(); // Paper - Lag compensation 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 + // Sakura start - track tick information
+ private final me.samsuik.sakura.tps.TickInformationCollector tickInformationCollector = new me.samsuik.sakura.tps.TickInformationCollector(); + private final me.samsuik.sakura.tps.TickInformationCollector tickInformationCollector = new me.samsuik.sakura.tps.TickInformationCollector();
+ +
@@ -26,7 +26,7 @@
public MinecraftServer( public MinecraftServer(
// CraftBukkit start // CraftBukkit start
@@ -471,6 +_,10 @@ @@ -398,6 +_,10 @@
Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this)); Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this));
// CraftBukkit end // CraftBukkit end
this.paperConfigurations = services.paperConfigurations(); // Paper - add paper configuration files this.paperConfigurations = services.paperConfigurations(); // Paper - add paper configuration files
@@ -37,7 +37,7 @@
} }
private void readScoreboard(DimensionDataStorage dataStorage) { private void readScoreboard(DimensionDataStorage dataStorage) {
@@ -1221,6 +_,7 @@ @@ -1139,6 +_,7 @@
if (++MinecraftServer.currentTick % MinecraftServer.SAMPLE_INTERVAL == 0) { if (++MinecraftServer.currentTick % MinecraftServer.SAMPLE_INTERVAL == 0) {
final long diff = currentTime - tickSection; final long diff = currentTime - tickSection;
final java.math.BigDecimal currentTps = TPS_BASE.divide(new java.math.BigDecimal(diff), 30, java.math.RoundingMode.HALF_UP); 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); tps1.add(currentTps, diff);
tps5.add(currentTps, diff); tps5.add(currentTps, diff);
tps15.add(currentTps, diff); tps15.add(currentTps, diff);
@@ -1256,6 +_,7 @@ @@ -1167,6 +_,7 @@
throw new RuntimeException("Chunk system crash propagated to tick()", crash); profilerFiller.push("tick");
} this.tickFrame.start();
// Paper end - rewrite chunk system this.tickServer(flag ? () -> false : this::haveTime);
+ this.tickInformationCollector.tickDuration((System.nanoTime() - currentTime) / 1_000_000L); // Sakura - track tick information + this.tickInformationCollector.tickDuration((System.nanoTime() - currentTime) / 1_000_000L); // Sakura - track tick information
this.tickFrame.end(); this.tickFrame.end();
profilerFiller.popPush("nextTickWait"); profilerFiller.popPush("nextTickWait");

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/dedicated/DedicatedServer.java --- a/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/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 this.server.spark.registerCommandBeforePlugins(this.server); // Paper - spark
com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now

View File

@@ -1,15 +1,15 @@
--- a/net/minecraft/server/level/ChunkMap.java --- a/net/minecraft/server/level/ChunkMap.java
+++ b/net/minecraft/server/level/ChunkMap.java +++ b/net/minecraft/server/level/ChunkMap.java
@@ -129,7 +_,7 @@ @@ -138,7 +_,7 @@
public final AtomicInteger tickingGenerated = new AtomicInteger(); // Paper - public private final AtomicInteger tickingGenerated = new AtomicInteger();
private final String storageName; private final String storageName;
private final PlayerMap playerMap = new PlayerMap(); private final PlayerMap playerMap = new PlayerMap();
- public final Int2ObjectMap<ChunkMap.TrackedEntity> entityMap = new Int2ObjectOpenHashMap<>(); - public final Int2ObjectMap<ChunkMap.TrackedEntity> entityMap = new Int2ObjectOpenHashMap<>();
+ public final Int2ObjectMap<ChunkMap.TrackedEntity> entityMap = new me.samsuik.sakura.utils.collections.TrackedEntityChunkMap(); // Sakura - optimised tracked entity map + public final Int2ObjectMap<ChunkMap.TrackedEntity> entityMap = new me.samsuik.sakura.utils.collections.TrackedEntityChunkMap(); // Sakura - optimised tracked entity map
private final Long2ByteMap chunkTypeCache = new Long2ByteOpenHashMap(); private final Long2ByteMap chunkTypeCache = new Long2ByteOpenHashMap();
// Paper - rewrite chunk system private final Long2LongMap nextChunkSaveTime = new Long2LongOpenHashMap();
public int serverViewDistance; private final LongSet chunksToEagerlySave = new LongLinkedOpenHashSet();
@@ -1217,7 +_,10 @@ @@ -1420,7 +_,10 @@
double vec3_dz = player.getZ() - this.entity.getZ(); double vec3_dz = player.getZ() - this.entity.getZ();
// Paper end - remove allocation of Vec3D here // Paper end - remove allocation of Vec3D here
int playerViewDistance = ChunkMap.this.getPlayerViewDistance(player); int playerViewDistance = ChunkMap.this.getPlayerViewDistance(player);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/ServerLevel.java --- a/net/minecraft/server/level/ServerLevel.java
+++ b/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 org.bukkit.generator.BiomeProvider biomeProvider // CraftBukkit
) { ) {
// CraftBukkit start // 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 + 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.pvpMode = server.isPvpAllowed();
this.levelStorageAccess = levelStorageAccess; 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());

View File

@@ -1,9 +1,9 @@
--- a/net/minecraft/server/level/ServerPlayer.java --- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java +++ b/net/minecraft/server/level/ServerPlayer.java
@@ -430,6 +_,7 @@ @@ -422,6 +_,7 @@
return this.viewDistanceHolder; public @Nullable com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent
} public @Nullable String clientBrandName = null; // Paper - Brand support
// Paper end - rewrite chunk system 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 double trackingRangeModifier = 1.0; // Sakura - entity tracking range modifier
public ServerPlayer(MinecraftServer server, ServerLevel level, GameProfile gameProfile, ClientInformation clientInformation) { public ServerPlayer(MinecraftServer server, ServerLevel level, GameProfile gameProfile, ClientInformation clientInformation) {

View File

@@ -1,14 +1,14 @@
--- a/net/minecraft/world/entity/Entity.java --- a/net/minecraft/world/entity/Entity.java
+++ b/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 boolean pushedByFluid = true; // Sakura - entity pushed by fluid api
public Entity(EntityType<?> entityType, Level level) { public Entity(EntityType<?> entityType, Level level) {
this.type = entityType; this.type = entityType;
@@ -4022,7 +_,7 @@ @@ -3749,7 +_,7 @@
} }
public boolean isPushedByFluid() { public boolean isPushedByFluid() {

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/LivingEntity.java --- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java
@@ -307,6 +_,43 @@ @@ -274,6 +_,43 @@
return this.getYHeadRot(); 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 // CraftBukkit end
+ // Sakura start - legacy combat mechanics + // Sakura start - legacy combat mechanics
+ private static final ResourceLocation LEGACY_COMBAT_MODIFIER_ID = ResourceLocation.fromNamespaceAndPath("sakura", "legacy_combat"); + private static final ResourceLocation LEGACY_COMBAT_MODIFIER_ID = ResourceLocation.fromNamespaceAndPath("sakura", "legacy_combat");
@@ -24,7 +24,7 @@
+ AttributeModifier legacyModifier = null; + AttributeModifier legacyModifier = null;
+ +
+ if (this.level().sakuraConfig().players.combat.legacyCombatMechanics) { + 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); + double attackDifference = me.samsuik.sakura.player.combat.CombatUtil.getLegacyAttackDifference(heldItem);
+ legacyModifier = new AttributeModifier(LEGACY_COMBAT_MODIFIER_ID, attackDifference, AttributeModifier.Operation.ADD_VALUE); + legacyModifier = new AttributeModifier(LEGACY_COMBAT_MODIFIER_ID, attackDifference, AttributeModifier.Operation.ADD_VALUE);
+ } + }
@@ -44,7 +44,7 @@
protected LivingEntity(EntityType<? extends LivingEntity> entityType, Level level) { protected LivingEntity(EntityType<? extends LivingEntity> entityType, Level level) {
super(entityType, level); super(entityType, level);
@@ -1479,7 +_,7 @@ @@ -1481,7 +_,7 @@
} }
// Paper end - Check distance in entity interactions // Paper end - Check distance in entity interactions
@@ -53,16 +53,16 @@
if (!flag) { if (!flag) {
this.indicateDamage(d, d1); this.indicateDamage(d, d1);
} }
@@ -1570,7 +_,7 @@ @@ -1676,7 +_,7 @@
} }
protected void blockedByShield(LivingEntity defender) { protected void blockedByItem(LivingEntity entity) {
- 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 - 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
+ 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 + 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) { private boolean checkTotemDeathProtection(DamageSource damageSource) {
@@ -1747,6 +_,12 @@ @@ -1833,6 +_,12 @@
// Paper start // Paper start
if (this.dead) { // Paper if (this.dead) { // Paper
@@ -75,7 +75,7 @@
this.level().broadcastEntityEvent(this, (byte)3); this.level().broadcastEntityEvent(this, (byte)3);
this.setPose(Pose.DYING); 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 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 if (true || !(strength <= 0.0)) { // CraftBukkit - Call event even when force is 0
// this.hasImpulse = true; // CraftBukkit - Move down // this.hasImpulse = true; // CraftBukkit - Move down
Vec3 deltaMovement = this.getDeltaMovement(); Vec3 deltaMovement = this.getDeltaMovement();
@@ -1931,10 +_,18 @@ @@ -2017,10 +_,18 @@
} }
Vec3 vec3 = new Vec3(x, 0.0, z).normalize().scale(strength); Vec3 vec3 = new Vec3(x, 0.0, z).normalize().scale(strength);
@@ -104,7 +104,23 @@
deltaMovement.z / 2.0 - vec3.z deltaMovement.z / 2.0 - vec3.z
); );
Vec3 diff = finalVelocity.subtract(deltaMovement); 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) { protected float getDamageAfterArmorAbsorb(DamageSource damageSource, float damageAmount) {
if (!damageSource.is(DamageTypeTags.BYPASSES_ARMOR)) { if (!damageSource.is(DamageTypeTags.BYPASSES_ARMOR)) {
// this.hurtArmor(damageSource, damageAmount); // CraftBukkit - actuallyHurt(DamageSource, float, EntityDamageEvent) for damage handling // this.hurtArmor(damageSource, damageAmount); // CraftBukkit - actuallyHurt(DamageSource, float, EntityDamageEvent) for damage handling
@@ -126,21 +142,22 @@
} }
return damageAmount; return damageAmount;
@@ -2252,6 +_,11 @@ @@ -2312,6 +_,12 @@
com.google.common.base.Function<Double, Double> blocking = new com.google.common.base.Function<Double, Double>() { amount += hardHatModifier;
@Override
public Double apply(Double f) { com.google.common.base.Function<Double, Double> blocking = mod -> {
+ // Sakura start - shield damage reduction & allow blocking with swords + // Sakura start - shield damage reduction & allow blocking with swords
+ if (LivingEntity.this.isBlockingWithSword() || LivingEntity.this.level().sakuraConfig().players.combat.shieldDamageReduction && !(damagesource.getDirectEntity() instanceof AbstractArrow)) { + // todo: 1.21.5 update
+ return -(LivingEntity.this.isBlocking() ? f * 0.5 : 0.0); + 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 + }
return -((LivingEntity.this.isDamageSourceBlocked(damagesource)) ? f : 0.0); + // Sakura end - shield damage reduction & allow blocking with swords
if (!LivingEntity.this.canBlockAttack(damagesource, mod.floatValue())) {
return 0D;
} }
}; @@ -2406,6 +_,12 @@
@@ -2351,6 +_,12 @@
armorDamage += (float) event.getDamage(DamageModifier.INVULNERABILITY_REDUCTION);
armorDamage += (float) event.getDamage(DamageModifier.BLOCKING); armorDamage += (float) event.getDamage(DamageModifier.BLOCKING);
armorDamage += (float) event.getDamage(DamageModifier.FREEZING);
armorDamage += (float) event.getDamage(DamageModifier.HARD_HAT); armorDamage += (float) event.getDamage(DamageModifier.HARD_HAT);
+ // Sakura start - add max armour durability damage + // Sakura start - add max armour durability damage
+ final int maxArmourDamage = this.level().sakuraConfig().players.combat.maxArmourDamage.or(-1); + final int maxArmourDamage = this.level().sakuraConfig().players.combat.maxArmourDamage.or(-1);
@@ -151,7 +168,7 @@
this.hurtArmor(damageSource, armorDamage); this.hurtArmor(damageSource, armorDamage);
} }
@@ -3292,6 +_,11 @@ @@ -3332,6 +_,11 @@
if (this.level() instanceof ServerLevel serverLevel) { if (this.level() instanceof ServerLevel serverLevel) {
EnchantmentHelper.runLocationChangedEffects(serverLevel, itemBySlot, this, equipmentSlot1); EnchantmentHelper.runLocationChangedEffects(serverLevel, itemBySlot, this, equipmentSlot1);
} }
@@ -163,16 +180,16 @@
} }
} }
@@ -3517,7 +_,7 @@ @@ -3532,7 +_,7 @@
} }
} }
// Paper end - Add EntityMoveEvent // Paper end - Add EntityMoveEvent
- if (this.level() instanceof ServerLevel serverLevel && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) { - if (this.level() instanceof ServerLevel serverLevel && this.isSensitiveToWater() && this.isInWaterOrRain()) {
+ 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.level().sakuraConfig().entity.waterSensitivity && this.isSensitiveToWater() && this.isInWaterOrRain()) { // Sakura - configure entity water sensitivity
this.hurtServer(serverLevel, this.damageSources().drown(), 1.0F); this.hurtServer(serverLevel, this.damageSources().drown(), 1.0F);
} }
} }
@@ -4072,8 +_,16 @@ @@ -4099,8 +_,16 @@
} }
public boolean isBlocking() { public boolean isBlocking() {

View File

@@ -1,11 +1,11 @@
--- a/net/minecraft/world/entity/Mob.java --- a/net/minecraft/world/entity/Mob.java
+++ b/net/minecraft/world/entity/Mob.java +++ b/net/minecraft/world/entity/Mob.java
@@ -846,7 +_,7 @@ @@ -716,7 +_,7 @@
protected final void serverAiStep() { protected final void serverAiStep() {
this.noActionTime++; this.noActionTime++;
// Paper start - Allow nerfed mobs to jump and float // Paper start - Allow nerfed mobs to jump and float
- if (!this.aware) { - if (!this.aware) {
+ if (!this.aware || this.level().sakuraConfig().entity.disableMobAi) { // Sakura - add option to disable entity ai + if (!this.aware || this.level().sakuraConfig().entity.disableMobAi) { // Sakura - add option to disable entity ai
if (goalFloat != null) { if (this.goalFloat != null) {
if (goalFloat.canUse()) goalFloat.tick(); if (this.goalFloat.canUse()) this.goalFloat.tick();
this.getJumpControl().tick(); this.getJumpControl().tick();

View File

@@ -1,19 +1,13 @@
--- a/net/minecraft/world/entity/animal/IronGolem.java --- a/net/minecraft/world/entity/animal/IronGolem.java
+++ b/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 + // Sakura start - configure iron golems taking fall damage
+ @Override + @Override
+ protected int calculateFallDamage(float fallDistance, float damageMultiplier) { + protected final boolean isFallDamageImmune() {
+ if (!this.level().sakuraConfig().entity.ironGolemsTakeFalldamage) { + return !this.level().sakuraConfig().entity.ironGolemsTakeFalldamage && this.isFallDamageImmune();
+ 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));
+ }
+ } + }
+ // Sakura end - configure iron golems taking fall damage + // Sakura end - configure iron golems taking fall damage
+ +

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/item/FallingBlockEntity.java --- a/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -68,9 +_,11 @@ @@ -70,9 +_,11 @@
public boolean forceTickAfterTeleportToDuplicate; public boolean forceTickAfterTeleportToDuplicate;
protected static final EntityDataAccessor<BlockPos> DATA_START_POS = SynchedEntityData.defineId(FallingBlockEntity.class, EntityDataSerializers.BLOCK_POS); protected static final EntityDataAccessor<BlockPos> DATA_START_POS = SynchedEntityData.defineId(FallingBlockEntity.class, EntityDataSerializers.BLOCK_POS);
public boolean autoExpire = true; // Paper - Expand FallingBlock API public boolean autoExpire = true; // Paper - Expand FallingBlock API
@@ -12,7 +12,7 @@
} }
public FallingBlockEntity(Level level, double x, double y, double z, BlockState state) { public FallingBlockEntity(Level level, double x, double y, double z, BlockState state) {
@@ -85,6 +_,27 @@ @@ -87,6 +_,27 @@
this.setStartPos(this.blockPosition()); this.setStartPos(this.blockPosition());
} }
@@ -66,15 +66,15 @@
+ if (canBeReplaced && flag3 && isFallingBlockInBounds(this.level(), blockPos)) { // Sakura - falling block stacking restrictions + if (canBeReplaced && flag3 && isFallingBlockInBounds(this.level(), blockPos)) { // Sakura - falling block stacking restrictions
if (this.blockState.hasProperty(BlockStateProperties.WATERLOGGED) if (this.blockState.hasProperty(BlockStateProperties.WATERLOGGED)
&& this.level().getFluidState(blockPos).getType() == Fluids.WATER) { && this.level().getFluidState(blockPos).getType() == Fluids.WATER) {
this.blockState = this.blockState.setValue(BlockStateProperties.WATERLOGGED, Boolean.valueOf(true)); this.blockState = this.blockState.setValue(BlockStateProperties.WATERLOGGED, true);
@@ -243,6 +_,10 @@ @@ -240,6 +_,10 @@
this.discard(EntityRemoveEvent.Cause.DROP); // CraftBukkit - add Bukkit remove cause this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DROP); // CraftBukkit - add Bukkit remove cause
this.callOnBrokenAfterFall(block, blockPos); this.callOnBrokenAfterFall(block, blockPos);
this.spawnAtLocation(serverLevel, block); this.spawnAtLocation(serverLevel, block);
+ // Sakura start - fix falling blocks staying alive when entity drops are disabled + // Sakura start - fix falling blocks staying alive when entity drops are disabled
+ } else { + } 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 + // Sakura end - fix falling blocks staying alive when entity drops are disabled
} }
} else { } 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

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/item/ItemEntity.java --- a/net/minecraft/world/entity/item/ItemEntity.java
+++ b/net/minecraft/world/entity/item/ItemEntity.java +++ b/net/minecraft/world/entity/item/ItemEntity.java
@@ -363,6 +_,11 @@ @@ -370,6 +_,11 @@
@Override @Override
public boolean ignoreExplosion(Explosion explosion) { public boolean ignoreExplosion(Explosion explosion) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/item/PrimedTnt.java --- a/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/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.yo = y;
this.zo = z; this.zo = z;
this.owner = owner; this.owner = owner;
@@ -30,7 +30,7 @@
@Override @Override
protected void defineSynchedData(SynchedEntityData.Builder builder) { protected void defineSynchedData(SynchedEntityData.Builder builder) {
@@ -98,7 +_,7 @@ @@ -101,7 +_,7 @@
@Override @Override
public void tick() { public void tick() {
@@ -39,7 +39,7 @@
this.handlePortal(); this.handlePortal();
this.applyGravity(); this.applyGravity();
this.move(MoverType.SELF, this.getDeltaMovement()); 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); 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 // Paper start - Option to prevent TNT from moving in water
if (!this.isRemoved() && this.wasTouchingWater && this.level().paperConfig().fixes.preventTntFromMovingInWater) { 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 // Paper start - Option to prevent TNT from moving in water
@Override @Override
public boolean isPushedByFluid() { public boolean isPushedByFluid() {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/Creeper.java --- a/net/minecraft/world/entity/monster/Creeper.java
+++ b/net/minecraft/world/entity/monster/Creeper.java +++ b/net/minecraft/world/entity/monster/Creeper.java
@@ -250,7 +_,12 @@ @@ -246,7 +_,12 @@
if (!event.isCancelled()) { if (!event.isCancelled()) {
// CraftBukkit end // CraftBukkit end
this.dead = true; this.dead = true;

View File

@@ -1,14 +1,14 @@
--- a/net/minecraft/world/entity/player/Player.java --- a/net/minecraft/world/entity/player/Player.java
+++ b/net/minecraft/world/entity/player/Player.java +++ b/net/minecraft/world/entity/player/Player.java
@@ -200,6 +_,7 @@ @@ -210,6 +_,7 @@
private int currentImpulseContextResetGraceTime; private int currentImpulseContextResetGraceTime = 0;
public boolean affectsSpawning = true; // Paper - Affects Spawning API 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 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 + private long lastSprintKnockback = -1; // Sakura - configure entity knockback
// CraftBukkit start // CraftBukkit start
public boolean fauxSleeping; public boolean fauxSleeping;
@@ -895,6 +_,10 @@ @@ -857,6 +_,10 @@
public boolean isInvulnerableTo(ServerLevel level, DamageSource damageSource) { public boolean isInvulnerableTo(ServerLevel level, DamageSource damageSource) {
if (super.isInvulnerableTo(level, damageSource)) { if (super.isInvulnerableTo(level, damageSource)) {
return true; return true;
@@ -19,7 +19,7 @@
} else if (damageSource.is(DamageTypeTags.IS_DROWNING)) { } else if (damageSource.is(DamageTypeTags.IS_DROWNING)) {
return !level.getGameRules().getBoolean(GameRules.RULE_DROWNING_DAMAGE); return !level.getGameRules().getBoolean(GameRules.RULE_DROWNING_DAMAGE);
} else if (damageSource.is(DamageTypeTags.IS_FALL)) { } else if (damageSource.is(DamageTypeTags.IS_FALL)) {
@@ -1225,13 +_,19 @@ @@ -1170,13 +_,19 @@
if (playerAttackEntityEvent.callEvent() && willAttack) { // Logic moved to willAttack local variable. if (playerAttackEntityEvent.callEvent() && willAttack) { // Logic moved to willAttack local variable.
{ {
// Paper end - PlayerAttackEntityEvent // Paper end - PlayerAttackEntityEvent
@@ -40,7 +40,7 @@
// this.resetAttackStrengthTicker(); // CraftBukkit - Moved to EntityLiving to reset the cooldown after the damage is dealt // this.resetAttackStrengthTicker(); // CraftBukkit - Moved to EntityLiving to reset the cooldown after the damage is dealt
if (target.getType().is(EntityTypeTags.REDIRECTABLE_PROJECTILE) if (target.getType().is(EntityTypeTags.REDIRECTABLE_PROJECTILE)
&& target instanceof Projectile projectile) { && target instanceof Projectile projectile) {
@@ -1249,7 +_,7 @@ @@ -1194,7 +_,7 @@
if (f > 0.0F || f1 > 0.0F) { if (f > 0.0F || f1 > 0.0F) {
boolean flag = attackStrengthScale > 0.9F; boolean flag = attackStrengthScale > 0.9F;
boolean flag1; 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 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; flag1 = true;
} else { } else {
@@ -1265,7 +_,7 @@ @@ -1210,7 +_,7 @@
&& !this.hasEffect(MobEffects.BLINDNESS) && !this.hasEffect(MobEffects.BLINDNESS)
&& !this.isPassenger() && !this.isPassenger()
&& target instanceof LivingEntity && target instanceof LivingEntity
@@ -58,7 +58,7 @@
flag2 = flag2 && !this.level().paperConfig().entities.behavior.disablePlayerCrits; // Paper - Toggleable player crits flag2 = flag2 && !this.level().paperConfig().entities.behavior.disablePlayerCrits; // Paper - Toggleable player crits
if (flag2) { if (flag2) {
damageSource = damageSource.critical(); // Paper - critical damage API damageSource = damageSource.critical(); // Paper - critical damage API
@@ -1292,7 +_,21 @@ @@ -1237,7 +_,21 @@
if (flag4) { if (flag4) {
float f4 = this.getKnockback(target, damageSource) + (flag1 ? 1.0F : 0.0F); float f4 = this.getKnockback(target, damageSource) + (flag1 ? 1.0F : 0.0F);
if (f4 > 0.0F) { if (f4 > 0.0F) {
@@ -81,7 +81,7 @@
livingEntity1.knockback( livingEntity1.knockback(
f4 * 0.5F, Mth.sin(this.getYRot() * (float) (Math.PI / 180.0)), -Mth.cos(this.getYRot() * (float) (Math.PI / 180.0)) 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 , 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 // Paper end - Configurable sprint interruption on attack
} }
@@ -90,16 +90,16 @@
float f5 = 1.0F + (float)this.getAttributeValue(Attributes.SWEEPING_DAMAGE_RATIO) * f; float f5 = 1.0F + (float)this.getAttributeValue(Attributes.SWEEPING_DAMAGE_RATIO) * f;
for (LivingEntity livingEntity2 : this.level() for (LivingEntity livingEntity2 : this.level()
@@ -1333,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) {
// CraftBukkit end // Paper end - Only apply knockback if the event is not cancelled
livingEntity2.knockback( livingEntity2.knockback(
- 0.4F, Mth.sin(this.getYRot() * (float) (Math.PI / 180.0)), -Mth.cos(this.getYRot() * (float) (Math.PI / 180.0)) - 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 + (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 , this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.SWEEP_ATTACK // Paper - knockback events
); );
// CraftBukkit - moved up EnchantmentHelper.doPostAttackEffects(serverLevel, livingEntity2, damageSource);
@@ -1423,7 +_,7 @@ @@ -1363,7 +_,7 @@
if (target instanceof LivingEntity) { if (target instanceof LivingEntity) {
float f7 = f3 - ((LivingEntity)target).getHealth(); float f7 = f3 - ((LivingEntity)target).getHealth();
this.awardStat(Stats.DAMAGE_DEALT, Math.round(f7 * 10.0F)); this.awardStat(Stats.DAMAGE_DEALT, Math.round(f7 * 10.0F));
@@ -108,7 +108,7 @@
int i = (int)(f7 * 0.5); int i = (int)(f7 * 0.5);
((ServerLevel)this.level()) ((ServerLevel)this.level())
.sendParticles(ParticleTypes.DAMAGE_INDICATOR, target.getX(), target.getY(0.5), target.getZ(), i, 0.1, 0.0, 0.1, 0.2); .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 // 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) { 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 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) { 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())); 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 @Override
public EntityDimensions getDefaultDimensions(Pose pose) { public EntityDimensions getDefaultDimensions(Pose pose) {

View File

@@ -1,10 +1,9 @@
--- a/net/minecraft/world/entity/projectile/ThrownPotion.java --- a/net/minecraft/world/entity/projectile/AbstractThrownPotion.java
+++ b/net/minecraft/world/entity/projectile/ThrownPotion.java +++ b/net/minecraft/world/entity/projectile/AbstractThrownPotion.java
@@ -48,6 +_,25 @@ @@ -42,6 +_,25 @@
public ThrownPotion(Level level, double x, double y, double z, ItemStack item) { super(entityType, x, y, z, level, item);
super(EntityType.POTION, x, y, z, level, item);
} }
+
+ // Sakura start - configure potion mechanics + // Sakura start - configure potion mechanics
+ @Override + @Override
+ public void shoot(double x, double y, double z, float speed, float divergence) { + 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; + return super.checkLeftOwner() || this.level().sakuraConfig().entity.thrownPotion.allowBreakingInsideEntities && this.tickCount >= 5;
+ } + }
+ // Sakura end - configure potion mechanics + // Sakura end - configure potion mechanics
+
@Override @Override
protected Item getDefaultItem() { protected double getDefaultGravity() {
return 0.05;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/FishingHook.java --- a/net/minecraft/world/entity/projectile/FishingHook.java
+++ b/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) { if (!this.level().isClientSide) {
this.setHookedEntity(result.getEntity()); this.setHookedEntity(result.getEntity());
} }
@@ -13,7 +13,7 @@
} }
@Override @Override
@@ -603,7 +_,7 @@ @@ -585,7 +_,7 @@
public void pullEntity(Entity entity) { public void pullEntity(Entity entity) {
Entity owner = this.getOwner(); Entity owner = this.getOwner();

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/ThrowableProjectile.java --- a/net/minecraft/world/entity/projectile/ThrowableProjectile.java
+++ b/net/minecraft/world/entity/projectile/ThrowableProjectile.java +++ b/net/minecraft/world/entity/projectile/ThrowableProjectile.java
@@ -41,12 +_,18 @@ @@ -42,12 +_,18 @@
return true; return true;
} }

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/ThrownEnderpearl.java --- a/net/minecraft/world/entity/projectile/ThrownEnderpearl.java
+++ b/net/minecraft/world/entity/projectile/ThrownEnderpearl.java +++ b/net/minecraft/world/entity/projectile/ThrownEnderpearl.java
@@ -186,6 +_,13 @@ @@ -182,6 +_,13 @@
} }
} }

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/food/FoodData.java --- a/net/minecraft/world/food/FoodData.java
+++ b/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); boolean _boolean = serverLevel.getGameRules().getBoolean(GameRules.RULE_NATURAL_REGENERATION);

View File

@@ -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
}
}

View File

@@ -3,7 +3,7 @@
@@ -147,7 +_,7 @@ @@ -147,7 +_,7 @@
// CraftBukkit end // CraftBukkit end
if (!flag) { 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.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 + } else if (!level.sakuraConfig().environment.allowWaterInTheNether && level.dimensionType().ultraWarm() && this.content.is(FluidTags.WATER)) { // Sakura - allow water in the nether
int x = pos.getX(); int x = pos.getX();

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/Item.java --- a/net/minecraft/world/item/Item.java
+++ b/net/minecraft/world/item/Item.java +++ b/net/minecraft/world/item/Item.java
@@ -121,6 +_,11 @@ @@ -136,6 +_,11 @@
return this.builtInRegistryHolder; return this.builtInRegistryHolder;
} }

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/ItemStack.java --- a/net/minecraft/world/item/ItemStack.java
+++ b/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); return this.getItem().interactLivingEntity(this, player, entity, usedHand);
} }
@@ -14,5 +14,5 @@
+ // Sakura end - modify components sent to the client + // Sakura end - modify components sent to the client
+ +
public ItemStack copy() { public ItemStack copy() {
// Paper start - Perf: Optimize Hoppers if (this.isEmpty()) {
return this.copy(false); return EMPTY;

View File

@@ -1,39 +1,45 @@
--- a/net/minecraft/world/item/Items.java --- a/net/minecraft/world/item/Items.java
+++ b/net/minecraft/world/item/Items.java +++ b/net/minecraft/world/item/Items.java
@@ -1083,27 +_,27 @@ @@ -1107,32 +_,32 @@
public static final Item GOLD_INGOT = registerItem("gold_ingot"); 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()); 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 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", 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(ToolMaterial.WOOD, 3.0F, -2.4F, properties)); // Sakura - allow blocking with swords + 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_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_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 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", 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(ToolMaterial.STONE, 3.0F, -2.4F, properties)); // Sakura - allow blocking with swords + 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_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_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 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", 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(ToolMaterial.GOLD, 3.0F, -2.4F, properties)); // Sakura - allow blocking with swords + 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_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_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 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", 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(ToolMaterial.IRON, 3.0F, -2.4F, properties)); // Sakura - allow blocking with swords + 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_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_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 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", 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(ToolMaterial.DIAMOND, 3.0F, -2.4F, properties)); // Sakura - allow blocking with swords + 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_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)); 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 GOLDEN_APPLE = registerItem("golden_apple", new Item.Properties().food(Foods.GOLDEN_APPLE, Consumables.GOLDEN_APPLE));
public static final Item ENCHANTED_GOLDEN_APPLE = registerItem( public static final Item ENCHANTED_GOLDEN_APPLE = registerItem(
"enchanted_golden_apple", "enchanted_golden_apple",
@@ -41,7 +47,7 @@
new Item.Properties() new Item.Properties()
.rarity(Rarity.RARE) .rarity(Rarity.RARE)
.food(Foods.ENCHANTED_GOLDEN_APPLE, Consumables.ENCHANTED_GOLDEN_APPLE) .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), (block, properties) -> new HangingSignItem(block, Blocks.WARPED_WALL_HANGING_SIGN, properties),
new Item.Properties().stacksTo(16) new Item.Properties().stacksTo(16)
); );
@@ -57,7 +63,7 @@
); );
public static final Item POWDER_SNOW_BUCKET = registerItem( public static final Item POWDER_SNOW_BUCKET = registerItem(
"powder_snow_bucket", "powder_snow_bucket",
@@ -1311,6 +_,7 @@ @@ -1327,6 +_,7 @@
public static final Item LEATHER = registerItem("leather"); public static final Item LEATHER = registerItem("leather");
public static final Item MILK_BUCKET = registerItem( public static final Item MILK_BUCKET = registerItem(
"milk_bucket", "milk_bucket",

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/BaseSpawner.java --- a/net/minecraft/world/level/BaseSpawner.java
+++ b/net/minecraft/world/level/BaseSpawner.java +++ b/net/minecraft/world/level/BaseSpawner.java
@@ -46,12 +_,24 @@ @@ -48,12 +_,24 @@
public int spawnRange = 4; public int spawnRange = 4;
private int tickDelay = 0; // Paper - Configurable mob spawner tick rate 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) { 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.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) { 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 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)) { if (!customSpawnRules.isValidPosition(blockPos, serverLevel)) {
continue; continue;
} }
@@ -34,22 +34,22 @@
continue; continue;
} }
@@ -145,12 +_,19 @@ @@ -150,12 +_,19 @@
return; return;
} }
- int size1 = serverLevel.getEntities( - int size = serverLevel.getEntities(
- EntityTypeTest.forExactClass(entity.getClass()), - EntityTypeTest.forExactClass(entity.getClass()),
- new AABB(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1).inflate(this.spawnRange), - new AABB(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1).inflate(this.spawnRange),
- EntitySelector.NO_SPECTATORS - EntitySelector.NO_SPECTATORS
- ) - )
- .size(); - .size();
+ // Sakura start - configure mob spawner behaviour + // Sakura start - configure mob spawner behaviour
+ final int size1; + final int size;
+ if (serverLevel.sakuraConfig().environment.mobSpawner.ignoreEntityLimit) { + if (serverLevel.sakuraConfig().environment.mobSpawner.ignoreEntityLimit) {
+ size1 = 0; + size = 0;
+ } else { + } else {
+ size1 = serverLevel.getEntities( + size = serverLevel.getEntities(
+ EntityTypeTest.forExactClass(entity.getClass()), + EntityTypeTest.forExactClass(entity.getClass()),
+ new AABB(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1).inflate(this.spawnRange), + new AABB(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1).inflate(this.spawnRange),
+ EntitySelector.NO_SPECTATORS + EntitySelector.NO_SPECTATORS
@@ -57,12 +57,12 @@
+ .size(); + .size();
+ } + }
+ // Sakura end - configure mob spawner behaviour + // Sakura end - configure mob spawner behaviour
if (size1 >= this.maxNearbyEntities) { if (size >= this.maxNearbyEntities) {
this.delay(serverLevel, pos); this.delay(serverLevel, pos);
return; 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.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 (entity instanceof Mob mob) {
- if (nextSpawnData.getCustomSpawnRules().isEmpty() && !mob.checkSpawnRules(serverLevel, EntitySpawnReason.SPAWNER) - if (nextSpawnData.getCustomSpawnRules().isEmpty() && !mob.checkSpawnRules(serverLevel, EntitySpawnReason.SPAWNER)
- || !mob.checkSpawnObstruction(serverLevel)) { - || !mob.checkSpawnObstruction(serverLevel)) {

View File

@@ -1,7 +1,7 @@
--- a/net/minecraft/world/level/Level.java --- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java
@@ -118,7 +_,7 @@ @@ -108,7 +_,7 @@
public final List<TickingBlockEntity> blockEntityTickers = Lists.newArrayList(); // Paper - public public final List<TickingBlockEntity> blockEntityTickers = Lists.newArrayList();
public final NeighborUpdater neighborUpdater; public final NeighborUpdater neighborUpdater;
private final List<TickingBlockEntity> pendingBlockEntityTickers = Lists.newArrayList(); private final List<TickingBlockEntity> pendingBlockEntityTickers = Lists.newArrayList();
- private boolean tickingBlockEntities; - private boolean tickingBlockEntities;
@@ -9,7 +9,7 @@
public final Thread thread; public final Thread thread;
private final boolean isDebug; private final boolean isDebug;
private int skyDarken; private int skyDarken;
@@ -168,6 +_,18 @@ @@ -158,6 +_,18 @@
return this.paperConfig; return this.paperConfig;
} }
// Paper end - add paper world config // Paper end - add paper world config
@@ -26,18 +26,15 @@
+ } + }
+ // Sakura end - local config and property storage + // Sakura end - local config and property storage
public final io.papermc.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray public static @Nullable BlockPos lastPhysicsProblem; // Spigot
public static BlockPos lastPhysicsProblem; // Spigot private int tileTickPosition;
@@ -840,6 +_,7 @@ @@ -203,10 +_,12 @@
org.bukkit.World.Environment env, // CraftBukkit org.bukkit.World.Environment env, // CraftBukkit
java.util.function.Function<org.spigotmc.SpigotWorldConfig, // Spigot - create per world config java.util.function.Function<org.spigotmc.SpigotWorldConfig, // Spigot - create per world config
io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, // Paper - create paper world config io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, // Paper - create paper world config
+ java.util.function.Supplier<me.samsuik.sakura.configuration.WorldConfiguration> sakuraWorldConfigCreator, // Sakura - sakura configuration files + java.util.function.Supplier<me.samsuik.sakura.configuration.WorldConfiguration> sakuraWorldConfigCreator, // Sakura - sakura configuration files
java.util.concurrent.Executor executor // Paper - Anti-Xray 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.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.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config
+ this.sakuraConfig = sakuraWorldConfigCreator.get(); // Sakura - sakura configuration files + this.sakuraConfig = sakuraWorldConfigCreator.get(); // Sakura - sakura configuration files

View File

@@ -1,14 +1,14 @@
--- a/net/minecraft/world/level/ServerExplosion.java --- a/net/minecraft/world/level/ServerExplosion.java
+++ b/net/minecraft/world/level/ServerExplosion.java +++ b/net/minecraft/world/level/ServerExplosion.java
@@ -306,6 +_,7 @@ @@ -60,6 +_,7 @@
return (float)missedRays / (float)totalRays; public float yield;
} // CraftBukkit end
// Paper end - collisions optimisations public boolean excludeSourceFromDamage = true; // Paper - Allow explosions to damage source
+ private final boolean consistentRadius; // Sakura - consistent explosion radius + private final boolean consistentRadius; // Sakura - consistent explosion radius
public ServerExplosion( public ServerExplosion(
ServerLevel level, ServerLevel level,
@@ -326,6 +_,7 @@ @@ -80,6 +_,7 @@
this.damageSource = damageSource == null ? level.damageSources().explosion(this) : damageSource; this.damageSource = damageSource == null ? level.damageSources().explosion(this) : damageSource;
this.damageCalculator = damageCalculator == null ? this.makeDamageCalculator(source) : damageCalculator; this.damageCalculator = damageCalculator == null ? this.makeDamageCalculator(source) : damageCalculator;
this.yield = this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F; // CraftBukkit 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) { private ExplosionDamageCalculator makeDamageCalculator(@Nullable Entity entity) {
@@ -415,7 +_,7 @@ @@ -145,7 +_,7 @@
d /= squareRoot;
ray += 3; d1 /= squareRoot;
d2 /= squareRoot;
- float power = this.radius * (0.7F + this.level.random.nextFloat() * 0.6F); - float f = 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 + 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;
do { double d4 = this.center.y;
final int blockX = Mth.floor(currX); double d5 = this.center.z;
@@ -629,6 +_,12 @@ @@ -336,6 +_,12 @@
.getBlockState(blockPos) .getBlockState(blockPos)
.onExplosionHit(this.level, blockPos, this, (itemStack, blockPos1) -> addOrAppendStack(list, itemStack, blockPos1)); .onExplosionHit(this.level, blockPos, this, (itemStack, blockPos1) -> addOrAppendStack(list, itemStack, blockPos1));
} }

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/level/block/BubbleColumnBlock.java --- a/net/minecraft/world/level/block/BubbleColumnBlock.java
+++ b/net/minecraft/world/level/block/BubbleColumnBlock.java +++ b/net/minecraft/world/level/block/BubbleColumnBlock.java
@@ -49,6 +_,13 @@ @@ -50,6 +_,13 @@
@Override @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 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 + // Sakura start - configure bubble columns affecting cannon entities
+ if (!level.sakuraConfig().cannons.tntAndSandAffectedByBubbleColumns && ( + if (!level.sakuraConfig().cannons.tntAndSandAffectedByBubbleColumns && (
@@ -12,5 +12,5 @@
+ } + }
+ // Sakura end - configure bubble columns affecting cannon entities + // Sakura end - configure bubble columns affecting cannon entities
BlockState blockState = level.getBlockState(pos.above()); BlockState blockState = level.getBlockState(pos.above());
if (blockState.isAir()) { boolean flag = blockState.getCollisionShape(level, pos).isEmpty() && blockState.getFluidState().isEmpty();
entity.onAboveBubbleCol(state.getValue(DRAG_DOWN)); if (flag) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/CactusBlock.java --- a/net/minecraft/world/level/block/CactusBlock.java
+++ b/net/minecraft/world/level/block/CactusBlock.java +++ b/net/minecraft/world/level/block/CactusBlock.java
@@ -48,6 +_,19 @@ @@ -52,6 +_,19 @@
@Override @Override
protected void randomTick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) { protected void randomTick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) {
@@ -20,15 +20,16 @@
BlockPos blockPos = pos.above(); BlockPos blockPos = pos.above();
if (level.isEmptyBlock(blockPos)) { if (level.isEmptyBlock(blockPos)) {
int i = 1; int i = 1;
@@ -63,6 +_,11 @@ @@ -75,6 +_,12 @@
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 // Paper end
BlockState blockState = state.setValue(AGE, Integer.valueOf(0)); BlockState blockState = state.setValue(AGE, 0);
+ // Sakura start - use random chance for crop growth; fix cactus growing next to a block and not breaking + // Sakura start - use random chance for crop growth; fix cactus growing next to a block and not breaking
+ if (level.sakuraConfig().environment.crops.useRandomChanceToGrow) { + // todo: 1.21.5 update
+ level.neighborShapeChanged(Direction.UP, blockPos, pos, state, 4, 1); + /*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); + // Sakura end - use random chance for crop growth; fix cactus growing next to a block and not breaking
level.neighborChanged(blockState, blockPos, this, null, false); level.setBlock(pos, blockState, 260);
} else if (modifier == 100 || random.nextFloat() < (modifier / (100.0f * 16))) { // Spigot - SPIGOT-7159: Better modifier resolution level.neighborChanged(blockState, blockPos, this, null, false);
}

View File

@@ -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<CarpetBlock> 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<? extends CarpetBlock> 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

View File

@@ -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<LadderBlock> 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
}
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/SugarCaneBlock.java --- a/net/minecraft/world/level/block/SugarCaneBlock.java
+++ b/net/minecraft/world/level/block/SugarCaneBlock.java +++ b/net/minecraft/world/level/block/SugarCaneBlock.java
@@ -49,6 +_,19 @@ @@ -48,6 +_,19 @@
@Override @Override
protected void randomTick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) { protected void randomTick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) {
@@ -20,11 +20,11 @@
if (level.isEmptyBlock(pos.above())) { if (level.isEmptyBlock(pos.above())) {
int i = 1; int i = 1;
@@ -62,6 +_,7 @@ @@ -61,6 +_,7 @@
if (ageValue >= 15 || (modifier != 100 && random.nextFloat() < (modifier / (100.0f * 16)))) { // Spigot - SPIGOT-7159: Better modifier resolution 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 org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(level, pos.above(), this.defaultBlockState(), 3); // CraftBukkit
level.setBlock(pos, state.setValue(AGE, Integer.valueOf(0)), 4); level.setBlock(pos, state.setValue(AGE, 0), 260);
+ // Sakura - use random chance for crop growth; conflict on change + // 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 } 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); level.setBlock(pos, state.setValue(AGE, ageValue + 1), 260);
} }

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/DispenserBlockEntity.java --- a/net/minecraft/world/level/block/entity/DispenserBlockEntity.java
+++ b/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 i = -1;
int i1 = 1; int i1 = 1;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/piston/PistonBaseBlock.java --- a/net/minecraft/world/level/block/piston/PistonBaseBlock.java
+++ b/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--) { for (int i1 = toPush.size() - 1; i1 >= 0; i1--) {
// Paper start - fix a variety of piston desync dupes // Paper start - fix a variety of piston desync dupes
boolean allowDesync = io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowPistonDuplication; boolean allowDesync = io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowPistonDuplication;

View File

@@ -1,7 +1,7 @@
--- a/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java --- a/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
+++ b/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java +++ b/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
@@ -43,6 +_,11 @@ @@ -47,6 +_,11 @@
private float progressO; private float progressO = 0.0F;
private long lastTicked; private long lastTicked;
private int deathTicks; private int deathTicks;
+ // Sakura start - cache moving block entity collision shape + // Sakura start - cache moving block entity collision shape
@@ -12,7 +12,7 @@
public PistonMovingBlockEntity(BlockPos pos, BlockState blockState) { public PistonMovingBlockEntity(BlockPos pos, BlockState blockState) {
super(BlockEntityType.PISTON, pos, blockState); super(BlockEntityType.PISTON, pos, blockState);
@@ -351,6 +_,18 @@ @@ -363,6 +_,18 @@
} }
public VoxelShape getCollisionShape(BlockGetter level, BlockPos pos) { public VoxelShape getCollisionShape(BlockGetter level, BlockPos pos) {
@@ -30,4 +30,4 @@
+ // Sakura end - cache moving block entity collision shape + // Sakura end - cache moving block entity collision shape
VoxelShape collisionShape; VoxelShape collisionShape;
if (!this.extending && this.isSourcePiston && this.movedState.getBlock() instanceof PistonBaseBlock) { 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);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/chunk/LevelChunkSection.java --- a/net/minecraft/world/level/chunk/LevelChunkSection.java
+++ b/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) { public void fillBiomesFromNoise(BiomeResolver biomeResolver, Climate.Sampler climateSampler, int x, int y, int z) {
PalettedContainer<Holder<Biome>> palettedContainer = this.biomes.recreate(); PalettedContainer<Holder<Biome>> palettedContainer = this.biomes.recreate();

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/material/FlowingFluid.java --- a/net/minecraft/world/level/material/FlowingFluid.java
+++ b/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) { protected void spread(ServerLevel level, BlockPos pos, BlockState blockState, FluidState fluidState) {
@@ -15,7 +15,7 @@
Fluid type = newLiquid.getType(); Fluid type = newLiquid.getType();
if (fluidState1.canBeReplacedWith(level, blockPos, type, Direction.DOWN) && canHoldSpecificFluid(level, blockPos, blockState1, type)) { if (fluidState1.canBeReplacedWith(level, blockPos, type, Direction.DOWN) && canHoldSpecificFluid(level, blockPos, blockState1, type)) {
// CraftBukkit start // CraftBukkit start
@@ -199,6 +_,11 @@ @@ -157,6 +_,11 @@
BlockPos blockPos = pos.relative(direction); BlockPos blockPos = pos.relative(direction);
final BlockState blockStateIfLoaded = level.getBlockStateIfLoaded(blockPos); // Paper - Prevent chunk loading from fluid flowing final BlockState blockStateIfLoaded = level.getBlockStateIfLoaded(blockPos); // Paper - Prevent chunk loading from fluid flowing
if (blockStateIfLoaded == null) continue; // Paper - Prevent chunk loading from fluid flowing if (blockStateIfLoaded == null) continue; // Paper - Prevent chunk loading from fluid flowing
@@ -27,7 +27,7 @@
// CraftBukkit start // CraftBukkit start
org.bukkit.block.Block source = org.bukkit.craftbukkit.block.CraftBlock.at(level, pos); 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)); 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()) { if (fluidState.isSource()) {
i1++; i1++;
} }
@@ -236,19 +_,11 @@ @@ -194,19 +_,11 @@
BlockState blockState1 = level.getBlockState(mutableBlockPos.setWithOffset(pos, Direction.DOWN)); BlockState blockState1 = level.getBlockState(mutableBlockPos.setWithOffset(pos, Direction.DOWN));
FluidState fluidState1 = blockState1.getFluidState(); FluidState fluidState1 = blockState1.getFluidState();
if (blockState1.isSolid() || this.isSourceBlockOfThisType(fluidState1)) { if (blockState1.isSolid() || this.isSourceBlockOfThisType(fluidState1)) {
@@ -122,8 +122,8 @@
+ return i; // Sakura - optimise new liquid level + return i; // Sakura - optimise new liquid level
} }
// Paper start - fluid method optimisations private static boolean canPassThroughWall(
@@ -413,7 +_,7 @@ @@ -362,7 +_,7 @@
if (blockState == null) continue; // Paper - Prevent chunk loading from fluid flowing if (blockState == null) continue; // Paper - Prevent chunk loading from fluid flowing
FluidState fluidState = blockState.getFluidState(); FluidState fluidState = blockState.getFluidState();
if (this.canMaybePassThrough(level, pos, state, direction, blockPos, blockState, fluidState)) { if (this.canMaybePassThrough(level, pos, state, direction, blockPos, blockState, fluidState)) {
@@ -132,7 +132,7 @@
if (canHoldSpecificFluid(level, blockPos, blockState, newLiquid.getType())) { if (canHoldSpecificFluid(level, blockPos, blockState, newLiquid.getType())) {
if (spreadContext == null) { if (spreadContext == null) {
spreadContext = new FlowingFluid.SpreadContext(level, pos); spreadContext = new FlowingFluid.SpreadContext(level, pos);
@@ -464,6 +_,11 @@ @@ -413,6 +_,11 @@
} }
private static boolean canHoldSpecificFluid(BlockGetter level, BlockPos pos, BlockState state, Fluid fluid) { 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); return !(state.getBlock() instanceof LiquidBlockContainer liquidBlockContainer) || liquidBlockContainer.canPlaceLiquid(null, level, pos, state, fluid);
} }
@@ -476,7 +_,7 @@ @@ -425,7 +_,7 @@
@Override @Override
public void tick(ServerLevel level, BlockPos pos, BlockState blockState, FluidState fluidState) { public void tick(ServerLevel level, BlockPos pos, BlockState blockState, FluidState fluidState) {
if (!fluidState.isSource()) { if (!fluidState.isSource()) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/material/Fluid.java --- a/net/minecraft/world/level/material/Fluid.java
+++ b/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); protected abstract boolean canBeReplacedWith(FluidState state, BlockGetter level, BlockPos pos, Fluid fluid, Direction direction);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/material/LavaFluid.java --- a/net/minecraft/world/level/material/LavaFluid.java
+++ b/net/minecraft/world/level/material/LavaFluid.java +++ b/net/minecraft/world/level/material/LavaFluid.java
@@ -177,12 +_,20 @@ @@ -189,12 +_,20 @@
@Override @Override
public int getTickDelay(LevelReader level) { public int getTickDelay(LevelReader level) {

View File

@@ -1,10 +1,10 @@
--- a/net/minecraft/world/level/redstone/ExperimentalRedstoneUtils.java --- a/net/minecraft/world/level/redstone/ExperimentalRedstoneUtils.java
+++ b/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); 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);
}

View File

@@ -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;

View File

@@ -1,6 +1,5 @@
--- a/net/minecraft/world/level/block/RedStoneWireBlock.java ++++ REJECTED HUNK: 1
+++ b/net/minecraft/world/level/block/RedStoneWireBlock.java @@ -300,7 +300,7 @@
@@ -300,7 +_,7 @@
* Note: Added 'source' argument so as to help determine direction of information flow * 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) { 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 // 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 // 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 // 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) { protected void onPlace(BlockState state, Level level, BlockPos pos, BlockState oldState, boolean isMoving) {
if (!oldState.is(state.getBlock()) && !level.isClientSide) { if (!oldState.is(state.getBlock()) && !level.isClientSide) {
// Paper start - optimize redstone - replace call to updatePowerStrength // Paper start - optimize redstone - replace call to updatePowerStrength
@@ -18,7 +20,10 @@
level.getWireHandler().onWireAdded(pos, state); // Alternate Current level.getWireHandler().onWireAdded(pos, state); // Alternate Current
} else { } else {
this.updateSurroundingRedstone(level, pos, state, null, true); // Vanilla/Eigencraft 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 // Paper start - optimize redstone - replace call to updatePowerStrength
@@ -27,7 +32,10 @@
level.getWireHandler().onWireRemoved(pos, state); // Alternate Current level.getWireHandler().onWireRemoved(pos, state); // Alternate Current
} else { } else {
this.updateSurroundingRedstone(level, pos, state, null, false); // Vanilla/Eigencraft this.updateSurroundingRedstone(level, pos, state, null, false); // Vanilla/Eigencraft
@@ -429,7 +_,7 @@ ++++ END HUNK
++++ REJECTED HUNK: 4
@@ -429,7 +429,7 @@
if (!level.isClientSide) { if (!level.isClientSide) {
// Paper start - optimize redstone (Alternate Current) // Paper start - optimize redstone (Alternate Current)
// Alternate Current handles breaking of redstone wires in the WireHandler. // Alternate Current handles breaking of redstone wires in the WireHandler.
@@ -36,3 +44,4 @@
level.getWireHandler().onWireUpdated(pos, state, orientation); level.getWireHandler().onWireUpdated(pos, state, orientation);
} else } else
// Paper end - optimize redstone (Alternate Current) // Paper end - optimize redstone (Alternate Current)
++++ END HUNK

View File

@@ -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

View File

@@ -1,6 +1,6 @@
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/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 org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot
this.console.paperConfigurations.reloadConfigs(this.console); this.console.paperConfigurations.reloadConfigs(this.console);
@@ -8,7 +8,7 @@
for (ServerLevel world : this.console.getAllLevels()) { for (ServerLevel world : this.console.getAllLevels()) {
// world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty // 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)) 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(); this.reloadData();
org.spigotmc.SpigotConfig.registerCommands(); // Spigot org.spigotmc.SpigotConfig.registerCommands(); // Spigot
io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper

View File

@@ -1,6 +1,6 @@
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -282,6 +_,12 @@ @@ -283,6 +_,12 @@
).isValid(); ).isValid();
} }
// Paper end // Paper end

View File

@@ -1,8 +1,8 @@
--- a/src/main/java/org/bukkit/craftbukkit/Main.java --- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/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"); .describedAs("Jar file");
// Paper end
+ // Sakura start - sakura configuration files + // Sakura start - sakura configuration files
+ acceptsAll(asList("sakura-dir", "sakura-settings-directory"), "Directory for Sakura settings") + acceptsAll(asList("sakura-dir", "sakura-settings-directory"), "Directory for Sakura settings")
@@ -12,6 +12,6 @@
+ .describedAs("Config directory"); + .describedAs("Config directory");
+ // Sakura end - sakura configuration files + // Sakura end - sakura configuration files
+ +
// Paper start
acceptsAll(asList("server-name"), "Name of the server") acceptsAll(asList("server-name"), "Name of the server")
.withRequiredArg() .withRequiredArg()
.ofType(String.class)

View File

@@ -1,6 +1,6 @@
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/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()); this.entityType = CraftEntityType.minecraftToBukkit(entity.getType());
} }

View File

@@ -1,6 +1,6 @@
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/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(); this.firstPlayed = System.currentTimeMillis();
} }

View File

@@ -10,7 +10,7 @@ import org.jspecify.annotations.NullMarked;
import java.util.Optional; import java.util.Optional;
@NullMarked @NullMarked
public record EntityState(Vec3 position, Vec3 momentum, AABB bb, Vec3 stuckSpeed, Optional<BlockPos> supportingPos, boolean onGround, float fallDistance) { public record EntityState(Vec3 position, Vec3 momentum, AABB bb, Vec3 stuckSpeed, Optional<BlockPos> supportingPos, boolean onGround, double fallDistance) {
public static EntityState of(Entity entity) { public static EntityState of(Entity entity) {
return new EntityState( return new EntityState(
entity.position(), entity.getDeltaMovement(), entity.getBoundingBox(), entity.position(), entity.getDeltaMovement(), entity.getBoundingBox(),

View File

@@ -15,7 +15,7 @@ import net.minecraft.world.level.Level;
import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.NullMarked;
@NullMarked @NullMarked
public final class BlockableSwordItem extends SwordItem { public final class BlockableSwordItem extends Item {
private static final Consumable BLOCKING_ANIMATION = Consumable.builder() private static final Consumable BLOCKING_ANIMATION = Consumable.builder()
.consumeSeconds(720000) .consumeSeconds(720000)
.animation(ItemUseAnimation.BLOCK) .animation(ItemUseAnimation.BLOCK)
@@ -23,8 +23,8 @@ public final class BlockableSwordItem extends SwordItem {
.hasConsumeParticles(false) .hasConsumeParticles(false)
.build(); .build();
public BlockableSwordItem(ToolMaterial material, float attackDamage, float attackSpeed, Properties properties) { public BlockableSwordItem(Properties properties) {
super(material, attackDamage, attackSpeed, properties); super(properties);
} }
@Override @Override

View File

@@ -44,16 +44,11 @@ public final class PlayerVisibilitySettings implements VisibilitySettings {
} }
public void loadData(@NonNull CompoundTag tag) { public void loadData(@NonNull CompoundTag tag) {
if (!tag.contains(SETTINGS_COMPOUND_TAG, CompoundTag.TAG_COMPOUND)) { CompoundTag settingsTag = tag.getCompoundOrEmpty(SETTINGS_COMPOUND_TAG);
return;
}
CompoundTag settingsTag = tag.getCompound(SETTINGS_COMPOUND_TAG);
for (VisibilityType type : VisibilityTypes.types()) { for (VisibilityType type : VisibilityTypes.types()) {
if (settingsTag.contains(type.key(), CompoundTag.TAG_STRING)) { String typeKey = type.key();
VisibilityState state = VisibilityState.valueOf(settingsTag.getString(type.key())); String stateName = settingsTag.getStringOr(typeKey, type.getDefault().name());
this.visibilityStates.put(type, state); this.set(type, VisibilityState.valueOf(stateName));
}
} }
} }

View File

@@ -26,7 +26,8 @@ public final class TickInformationCollector {
int entities = 0; int entities = 0;
for (ServerLevel level : levels) { for (ServerLevel level : levels) {
chunks += level.chunkSource.getFullChunksCount(); chunks += level.chunkSource.getFullChunksCount();
entities += level.entityTickList.entities.size(); // todo 1.21.5 update
//entities += level.entityTickList.entities.size();
} }
double averageTick = this.tickSamples.longStream() double averageTick = this.tickSamples.longStream()