9
0
mirror of https://github.com/Samsuik/Sakura.git synced 2026-01-04 15:31:43 +00:00

It actually starts now

This commit is contained in:
Samsuik
2025-03-14 19:16:30 +00:00
parent 9ec82c34ea
commit 27617c7266
12 changed files with 75 additions and 90 deletions

View File

@@ -23,12 +23,12 @@ subprojects {
apply(plugin = "java")
java {
toolchain { languageVersion = JavaLanguageVersion.of(17) }
toolchain { languageVersion.set(JavaLanguageVersion.of(17)) }
}
tasks.withType<JavaCompile>().configureEach {
options.encoding = "UTF-8"
options.release = 17
options.release.set(17)
}
repositories {
@@ -44,19 +44,19 @@ subprojects {
}
paperweight {
serverProject = project(":sakura-server")
serverProject.set(project(":sakura-server"))
remapRepo = "https://maven.fabricmc.net/"
decompileRepo = "https://files.minecraftforge.net/maven/"
remapRepo.set("https://maven.fabricmc.net/")
decompileRepo.set("https://files.minecraftforge.net/maven/")
usePaperUpstream(providers.gradleProperty("paperRef")) {
url = github("PaperMC", "Paper-archive") // hard fork
url.set(github("PaperMC", "Paper-archive")) // hard fork
withPaperPatcher {
apiPatchDir = layout.projectDirectory.dir("patches/api")
apiOutputDir = layout.projectDirectory.dir("sakura-api")
apiPatchDir.set(layout.projectDirectory.dir("patches/api"))
apiOutputDir.set(layout.projectDirectory.dir("sakura-api"))
serverPatchDir = layout.projectDirectory.dir("patches/server")
serverOutputDir = layout.projectDirectory.dir("sakura-server")
serverPatchDir.set(layout.projectDirectory.dir("patches/server"))
serverOutputDir.set(layout.projectDirectory.dir("sakura-server"))
}
}
}

View File

@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME

View File

@@ -242,10 +242,10 @@ index 0000000000000000000000000000000000000000..93c0f22cdf0c3b7ce4db55171ea397f5
+}
diff --git a/src/main/java/me/samsuik/sakura/configuration/SakuraGlobalConfig.java b/src/main/java/me/samsuik/sakura/configuration/SakuraGlobalConfig.java
new file mode 100644
index 0000000000000000000000000000000000000000..7000fa68886057fb742cf4f655a739b0ee3f62e1
index 0000000000000000000000000000000000000000..2d8060afc05002a6246e7a9155f1968e391c5ed6
--- /dev/null
+++ b/src/main/java/me/samsuik/sakura/configuration/SakuraGlobalConfig.java
@@ -0,0 +1,92 @@
@@ -0,0 +1,99 @@
+package me.samsuik.sakura.configuration;
+
+import org.bukkit.configuration.file.YamlConfiguration;
@@ -268,19 +268,26 @@ index 0000000000000000000000000000000000000000..7000fa68886057fb742cf4f655a739b0
+ }
+
+ private YamlConfiguration config;
+ private File configFile;
+ private int version;
+
+ public void setup(File configFile) {
+ this.config = YamlConfigHelper.loadConfig(configFile, HEADER, config -> {
+ this.version = this.getInt("config-version", 0);
+ this.set("config-version", 0);
+ });
+ this.config = YamlConfigHelper.loadConfig(configFile, HEADER);
+ this.configFile = configFile;
+ this.version = this.getInt("config-version", 0);
+ this.set("config-version", 0);
+ YamlConfigHelper.readConfig(SakuraGlobalConfig.class, this);
+ YamlConfigHelper.saveConfig(this.config, configFile);
+ }
+
+ public YamlConfiguration getYamlConfig() {
+ return this.config;
+ }
+
+ public File getConfigFile() {
+ return this.configFile;
+ }
+
+ private void set(String path, Object val) {
+ this.config.set(path, val);
+ }
@@ -340,12 +347,13 @@ index 0000000000000000000000000000000000000000..7000fa68886057fb742cf4f655a739b0
+}
diff --git a/src/main/java/me/samsuik/sakura/configuration/SakuraWorldConfig.java b/src/main/java/me/samsuik/sakura/configuration/SakuraWorldConfig.java
new file mode 100644
index 0000000000000000000000000000000000000000..34c4d0db007753f37cc4ca96c21175ce0f0d56e1
index 0000000000000000000000000000000000000000..65de1ea93d384e429c02be7cb6500d44ea9686c0
--- /dev/null
+++ b/src/main/java/me/samsuik/sakura/configuration/SakuraWorldConfig.java
@@ -0,0 +1,325 @@
@@ -0,0 +1,328 @@
+package me.samsuik.sakura.configuration;
+
+import it.unimi.dsi.fastutil.objects.ObjectArrayList;
+import it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap;
+import me.samsuik.sakura.configuration.serializer.*;
+import me.samsuik.sakura.entity.TntSpread;
@@ -375,6 +383,8 @@ index 0000000000000000000000000000000000000000..34c4d0db007753f37cc4ca96c21175ce
+
+ public void init() {
+ this.config = SakuraGlobalConfig.get().getYamlConfig(); // grab updated reference
+ YamlConfigHelper.readConfig(SakuraWorldConfig.class, this);
+ YamlConfigHelper.saveConfig(this.config, SakuraGlobalConfig.get().getConfigFile());
+ }
+
+ private String worldPath(String path) {
@@ -441,7 +451,7 @@ index 0000000000000000000000000000000000000000..34c4d0db007753f37cc4ca96c21175ce
+ def.clear();
+ for (String serializedKey : section.getKeys(false)) {
+ K key = serializer.deserializeKey(serializedKey);
+ V value = serializer.deserializeValue((C) this.config.get(serializedKey));
+ V value = serializer.deserializeValue((C) section.get(serializedKey));
+ def.put(key, value);
+ }
+ }
@@ -618,7 +628,7 @@ index 0000000000000000000000000000000000000000..34c4d0db007753f37cc4ca96c21175ce
+ map.put(EntityType.ENDER_PEARL, 8);
+ });
+ public boolean projectilesLoadChunksForCollisions = false;
+ public List<Item> explosionResistantItems = List.of();
+ public List<Item> explosionResistantItems = new ObjectArrayList<>();
+ private void Entity() {
+ this.disableMobAi = this.getBoolean("entity.disable-mob-ai", this.disableMobAi);
+ this.waterSensitivity = this.getBoolean("entity.water-sensitivity", this.waterSensitivity);
@@ -671,10 +681,10 @@ index 0000000000000000000000000000000000000000..34c4d0db007753f37cc4ca96c21175ce
+}
diff --git a/src/main/java/me/samsuik/sakura/configuration/YamlConfigHelper.java b/src/main/java/me/samsuik/sakura/configuration/YamlConfigHelper.java
new file mode 100644
index 0000000000000000000000000000000000000000..9340a0696d2a1bf4d91d67627df49191a40682b6
index 0000000000000000000000000000000000000000..a21b8dcce2d16eaa537ef8a559e1a0306a6a79c3
--- /dev/null
+++ b/src/main/java/me/samsuik/sakura/configuration/YamlConfigHelper.java
@@ -0,0 +1,60 @@
@@ -0,0 +1,55 @@
+package me.samsuik.sakura.configuration;
+
+import com.google.common.base.Throwables;
@@ -687,11 +697,10 @@ index 0000000000000000000000000000000000000000..9340a0696d2a1bf4d91d67627df49191
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.function.Consumer;
+import java.util.logging.Level;
+
+public final class YamlConfigHelper {
+ public static YamlConfiguration loadConfig(File configFile, String header, Consumer<YamlConfiguration> afterLoad) {
+ public static YamlConfiguration loadConfig(File configFile, String header) {
+ YamlConfiguration config = new YamlConfiguration();
+ try {
+ config.load(configFile);
@@ -703,20 +712,16 @@ index 0000000000000000000000000000000000000000..9340a0696d2a1bf4d91d67627df49191
+
+ config.options().header(header);
+ config.options().copyDefaults(true);
+ afterLoad.accept(config);
+
+ readConfig(SakuraGlobalConfig.class, null);
+ saveConfig(config, configFile);
+ return config;
+ }
+
+ public static void readConfig(Class<?> clazz, Object instance) {
+ public static void readConfig(Class<?> clazz, Object ref) {
+ for (Method method : clazz.getDeclaredMethods()) {
+ if (Modifier.isPrivate(method.getModifiers())) {
+ if (method.getParameterTypes().length == 0 && method.getReturnType() == Void.TYPE) {
+ try {
+ method.setAccessible(true);
+ method.invoke(instance);
+ method.invoke(ref);
+ } catch (InvocationTargetException ex) {
+ throw Throwables.propagate(ex.getCause());
+ } catch (Exception ex) {
@@ -895,15 +900,12 @@ index 0000000000000000000000000000000000000000..83275db7686a656f8d932d03e092cc6d
+}
diff --git a/src/main/java/me/samsuik/sakura/explosion/durable/DurableMaterial.java b/src/main/java/me/samsuik/sakura/explosion/durable/DurableMaterial.java
new file mode 100644
index 0000000000000000000000000000000000000000..4024f9738e039ffffd560a07a2210f758879d3c0
index 0000000000000000000000000000000000000000..7092580f4bb16db2612ac99aa29cd2565801d236
--- /dev/null
+++ b/src/main/java/me/samsuik/sakura/explosion/durable/DurableMaterial.java
@@ -0,0 +1,7 @@
@@ -0,0 +1,4 @@
+package me.samsuik.sakura.explosion.durable;
+
+import org.spongepowered.configurate.objectmapping.ConfigSerializable;
+
+@ConfigSerializable
+public record DurableMaterial(int durability, float resistance) {
+}
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java

View File

@@ -317,7 +317,7 @@ index 98209532ad3e692d7e459640123f78bbd9a65889..ffa6c8ec5a23f25f58ba88300196b9f1
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index a6edf5117d4ae03d8294e7bb74dd2d77048895a5..8aea11619f256bcfd91cf9af968bee4daf0f3381 100644
index a6edf5117d4ae03d8294e7bb74dd2d77048895a5..af9bf3811d50f722fdeb9a9517bee4c37f721b8d 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -235,6 +235,7 @@ public class ServerPlayer extends Player {
@@ -328,10 +328,10 @@ index a6edf5117d4ae03d8294e7bb74dd2d77048895a5..8aea11619f256bcfd91cf9af968bee4d
// CraftBukkit start
public String displayName;
@@ -426,6 +427,15 @@ public class ServerPlayer extends Player {
this.setPos(this.getX(), this.getY() + 1.0D, this.getZ());
@@ -473,6 +474,15 @@ public class ServerPlayer extends Player {
}
}
+ // Sakura start - visibility api
+ CompoundTag tag = nbt.getCompound("Sakura.Visuals");
+
@@ -341,9 +341,9 @@ index a6edf5117d4ae03d8294e7bb74dd2d77048895a5..8aea11619f256bcfd91cf9af968bee4d
+ }
+ }
+ // Sakura end
}
@Override
@@ -532,6 +542,13 @@ public class ServerPlayer extends Player {
});
}

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Optimise paper explosions
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
index 22ceea2deb22bc8bd082a5ad94de9a9ca02a4ec7..2301773137d004b1fbfa030caea6a4f436d1beae 100644
index 22ceea2deb22bc8bd082a5ad94de9a9ca02a4ec7..d6952fc65bbff3b615452b8f27aae4cb48f44a4b 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -104,7 +104,196 @@ public class Explosion {
@@ -175,7 +175,7 @@ index 22ceea2deb22bc8bd082a5ad94de9a9ca02a4ec7..2301773137d004b1fbfa030caea6a4f4
+ int minChunkZ = Mth.floor(this.z - f2) >> 4;
+ int maxChunkZ = Mth.floor(this.z + f2) >> 4;
+
+ io.papermc.paper.world.EntitySliceManager entityLookup = ((ServerLevel) this.level.getEntities()).entitySliceManager;
+ io.papermc.paper.world.EntitySliceManager entityLookup = this.level.entitySliceManager;
+ for (int chunkX = minChunkX; chunkX <= maxChunkX; ++chunkX) {
+ for (int chunkZ = minChunkZ; chunkZ <= maxChunkZ; ++chunkZ) {
+ io.papermc.paper.world.ChunkEntitySlices chunk = entityLookup.getChunk(chunkX, chunkZ);

View File

@@ -207,7 +207,7 @@ index 894d920305302127b5cf9ee2bfba239475e76144..b7407df002b7addf854a321f62c26003
public abstract ResourceKey<LevelStem> getTypeKey();
diff --git a/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java b/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java
index f44d79ed9f3b93712ce8b40c020955d19ec8fb9d..4c5dbc6a6a03c9504ca7de35462d369305b08edd 100644
index f44d79ed9f3b93712ce8b40c020955d19ec8fb9d..01f89327d2eb9c498bdf132095546220de3cf2d5 100644
--- a/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java
@@ -99,6 +99,11 @@ public abstract class BasePressurePlateBlock extends Block {
@@ -215,7 +215,7 @@ index f44d79ed9f3b93712ce8b40c020955d19ec8fb9d..4c5dbc6a6a03c9504ca7de35462d3693
BlockState iblockdata1 = this.setSignalForState(state, j);
+ // Sakura start - explosion density cache
+ if (!world.paperConfig().environment.optimizeExplosions) {
+ if (!world.paperConfig.optimizeExplosions) {
+ world.densityCache.clear(-1);
+ }
+ // Sakura end - explosion density cache
@@ -223,7 +223,7 @@ index f44d79ed9f3b93712ce8b40c020955d19ec8fb9d..4c5dbc6a6a03c9504ca7de35462d3693
this.updateNeighbours(world, pos);
world.setBlocksDirty(pos, state, iblockdata1);
diff --git a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
index 5e973eb53b240615e70b7d46ef4dc17b907ecaf9..5655aa0f5c91bb9c65a00d2f8a6fb6426d2a1c5d 100644
index 5e973eb53b240615e70b7d46ef4dc17b907ecaf9..224d666e4f5ba002aa3d78d5496c654c22be85c4 100644
--- a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
@@ -163,6 +163,11 @@ public class TripWireHookBlock extends Block {
@@ -231,7 +231,7 @@ index 5e973eb53b240615e70b7d46ef4dc17b907ecaf9..5655aa0f5c91bb9c65a00d2f8a6fb642
Direction enumdirection1 = enumdirection.getOpposite();
+ // Sakura start - explosion density cache
+ if (!world.paperConfig().environment.optimizeExplosions) {
+ if (!world.paperConfig.optimizeExplosions) {
+ world.densityCache.clear(-1);
+ }
+ // Sakura end - explosion density cache

View File

@@ -23,7 +23,7 @@ index 0fd814f1d65c111266a2b20f86561839a4cef755..932f7a0d030d2d4932e6e6d4a5805e9b
if (index >= 0) {
diff --git a/src/main/java/me/samsuik/sakura/explosion/special/SpecialisedExplosion.java b/src/main/java/me/samsuik/sakura/explosion/special/SpecialisedExplosion.java
new file mode 100644
index 0000000000000000000000000000000000000000..e654f48386e21e049facb6d90b356117af2bace6
index 0000000000000000000000000000000000000000..50696b0ca4476d832ad51a8a94fae934e04fdd1b
--- /dev/null
+++ b/src/main/java/me/samsuik/sakura/explosion/special/SpecialisedExplosion.java
@@ -0,0 +1,176 @@
@@ -94,7 +94,7 @@ index 0000000000000000000000000000000000000000..e654f48386e21e049facb6d90b356117
+ super.finalizeExplosion(false);
+ boolean destroyedBlocks = !this.getToBlow().isEmpty();
+
+ if (!this.interactsWithBlocks()) {
+ if (this.blockInteraction != Explosion.BlockInteraction.NONE) {
+ this.getToBlow().clear(); // server sends block changes in the explosion packet
+ }
+
@@ -131,7 +131,7 @@ index 0000000000000000000000000000000000000000..e654f48386e21e049facb6d90b356117
+ int maxChunkY = Mth.clamp(Mth.floor(bb.maxY) >> 4, minSection, maxSection);
+ int maxChunkZ = Mth.floor(bb.maxZ) >> 4;
+
+ io.papermc.paper.chunk.system.entity.EntityLookup entityLookup = this.level.getEntityLookup();
+ io.papermc.paper.world.EntitySliceManager entityLookup = this.level.entityManager.entitySliceManager;
+ for (int chunkX = minChunkX; chunkX <= maxChunkX; ++chunkX) {
+ for (int chunkZ = minChunkZ; chunkZ <= maxChunkZ; ++chunkZ) {
+ io.papermc.paper.world.ChunkEntitySlices chunk = entityLookup.getChunk(chunkX, chunkZ);
@@ -205,10 +205,10 @@ index 0000000000000000000000000000000000000000..e654f48386e21e049facb6d90b356117
+}
diff --git a/src/main/java/me/samsuik/sakura/explosion/special/TntExplosion.java b/src/main/java/me/samsuik/sakura/explosion/special/TntExplosion.java
new file mode 100644
index 0000000000000000000000000000000000000000..2e46df5cda2dc2812a10cd54ff7b128f9c50b361
index 0000000000000000000000000000000000000000..d2b8c4b8d2f8c4f8d31c401449a39f425c736b0d
--- /dev/null
+++ b/src/main/java/me/samsuik/sakura/explosion/special/TntExplosion.java
@@ -0,0 +1,192 @@
@@ -0,0 +1,193 @@
+package me.samsuik.sakura.explosion.special;
+
+import io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet;
@@ -219,6 +219,7 @@ index 0000000000000000000000000000000000000000..2e46df5cda2dc2812a10cd54ff7b128f
+import net.minecraft.world.damagesource.DamageSource;
+import net.minecraft.world.entity.Entity;
+import net.minecraft.world.entity.item.PrimedTnt;
+import net.minecraft.world.level.Explosion;
+import net.minecraft.world.level.ExplosionDamageCalculator;
+import net.minecraft.world.level.Level;
+import net.minecraft.world.level.block.state.BlockState;
@@ -267,7 +268,7 @@ index 0000000000000000000000000000000000000000..2e46df5cda2dc2812a10cd54ff7b128f
+ BlockPos explosionBlockPos = new BlockPos(this.x, this.y, this.z);
+ BlockState blockstate = this.level.getBlockState(explosionBlockPos);
+ float resistance = blockstate.getBlock().getExplosionResistance();
+ if ((resistance + 0.3f) * 0.3f < (this.radius * 1.3f) && this.interactsWithBlocks() && this.isRegionUnprotected()) { // Sakura - optimise protected explosions
+ if ((resistance + 0.3f) * 0.3f < (this.radius * 1.3f) && this.blockInteraction != Explosion.BlockInteraction.NONE && this.isRegionUnprotected()) { // Sakura - optimise protected explosions
+ this.searchForBlocks();
+ }
+ }
@@ -462,11 +463,15 @@ index 0c75fe840119040898a10a931dcb9b3e51c8cdcf..88f83ef060b818e31bbb636a45048b2c
@Override
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
index cf9dd1ffdacdfe1c26ca15ca17a20fe46a81b20d..a10d18a7573f9174708be0bf9dd912b8ce7eb0f5 100644
index 456ab59d726268e0a8a3ebc4fb4afc41389eefe4..608a91ac14570e5f8070c090f860f52e4807cb45 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -59,12 +59,14 @@ public class Explosion {
private final Explosion.BlockInteraction blockInteraction;
@@ -56,15 +56,17 @@ public class Explosion {
private static final ExplosionDamageCalculator EXPLOSION_DAMAGE_CALCULATOR = new ExplosionDamageCalculator();
private static final int MAX_DROPS_PER_COMBINED_STACK = 16;
private final boolean fire;
- private final Explosion.BlockInteraction blockInteraction;
+ protected final Explosion.BlockInteraction blockInteraction; // Sakura
private final Random random;
private final Level level;
- private final double x;

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Option to configure entity water sensitivity
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 5c967f9c77e75a84c4f584f729a00c4177082a8d..94a98385742888544815e24ff39338f604d4ca86 100644
index 5c967f9c77e75a84c4f584f729a00c4177082a8d..4687f54cf8637a5eb9384ea24d8c00398fcdeeb8 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3371,7 +3371,7 @@ public abstract class LivingEntity extends Entity {
@@ -13,7 +13,7 @@ index 5c967f9c77e75a84c4f584f729a00c4177082a8d..94a98385742888544815e24ff39338f6
}
// Paper end
- if (!this.level.isClientSide && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) {
+ if (!this.level.isClientSide && this.level.sakuraConfig().entity.waterSensitivity && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) { // Sakura - configure entity water sensitivity
+ if (!this.level.isClientSide && this.level.sakuraConfig.waterSensitivity && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) { // Sakura - configure entity water sensitivity
this.hurt(DamageSource.DROWN, 1.0F);
}

View File

@@ -36,7 +36,7 @@ index 4db0a1b1270e2ff1ea1a4723b3dd28860f4c2087..93977027caa8c398ca6f0d2bb0890231
if (xSmaller && z != 0.0) {
z = performCollisionsZ(axisalignedbb, z, potentialCollisions);
diff --git a/src/main/java/me/samsuik/sakura/explosion/special/SpecialisedExplosion.java b/src/main/java/me/samsuik/sakura/explosion/special/SpecialisedExplosion.java
index e654f48386e21e049facb6d90b356117af2bace6..a6b4cae3f04cda71629b5da3a08a8c4c7b51b8a7 100644
index b6682656b6e2333e90e9d2efac18296969de5ba9..f86cd82aa5da6d770c2f6a644e6478456fc4198d 100644
--- a/src/main/java/me/samsuik/sakura/explosion/special/SpecialisedExplosion.java
+++ b/src/main/java/me/samsuik/sakura/explosion/special/SpecialisedExplosion.java
@@ -148,9 +148,15 @@ public abstract class SpecialisedExplosion<T extends Entity> extends Explosion {
@@ -57,10 +57,10 @@ index e654f48386e21e049facb6d90b356117af2bace6..a6b4cae3f04cda71629b5da3a08a8c4c
if (distance != 0.0D) {
x /= distance;
diff --git a/src/main/java/me/samsuik/sakura/explosion/special/TntExplosion.java b/src/main/java/me/samsuik/sakura/explosion/special/TntExplosion.java
index 2e46df5cda2dc2812a10cd54ff7b128f9c50b361..901f49d09886edf6afcb814cd5ab8de2e089b896 100644
index d2b8c4b8d2f8c4f8d31c401449a39f425c736b0d..71bc7995e3a4c2b1ade98d2887fa319cf40f4b57 100644
--- a/src/main/java/me/samsuik/sakura/explosion/special/TntExplosion.java
+++ b/src/main/java/me/samsuik/sakura/explosion/special/TntExplosion.java
@@ -34,6 +34,13 @@ public final class TntExplosion extends SpecialisedExplosion<PrimedTnt> {
@@ -35,6 +35,13 @@ public final class TntExplosion extends SpecialisedExplosion<PrimedTnt> {
this.bounds = new AABB(x, y, z, x, y, z);
}
@@ -424,7 +424,7 @@ index e97729f2d8febac1740678840566f8beb4f07cdc..ef637b4491a2fc741925fbc896ff3a81
// Paper end
}
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
index 076d353e59757232bc2bb3a19dcb3d7ed70d5edd..d59f969f599ad7a76c3277f5ad2ead67572b0f3c 100644
index f89545f237aaec896bd80e381c37613c2fa6d48a..9f490efa0f9b045addc834b5714ed32e0c0e8cba 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -73,6 +73,7 @@ public class Explosion {
@@ -720,7 +720,7 @@ index 4f0cadec5c9ffb0ae31b2fb9302bc3822f748e59..0a5f56e06b30945213b6a3904f58efe2
public void tick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
if (isFree(world.getBlockState(pos.below())) && pos.getY() >= world.getMinBuildHeight()) {
diff --git a/src/main/java/net/minecraft/world/level/block/FenceGateBlock.java b/src/main/java/net/minecraft/world/level/block/FenceGateBlock.java
index 1224193a35abb8176b509ca8d8053d29c8cc6690..bdbbb45079dc7ef92f81d413ce099619e2ea23df 100644
index 1224193a35abb8176b509ca8d8053d29c8cc6690..963509c947df7c59351299d02fe9955379100c78 100644
--- a/src/main/java/net/minecraft/world/level/block/FenceGateBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/FenceGateBlock.java
@@ -140,8 +140,13 @@ public class FenceGateBlock extends HorizontalDirectionalBlock {
@@ -732,7 +732,7 @@ index 1224193a35abb8176b509ca8d8053d29c8cc6690..bdbbb45079dc7ef92f81d413ce099619
+ // Sakura start
+ final boolean legacy = world.localConfig().config(pos).physicsVersion.before(1_11_0);
+ final boolean powered = state.getValue(FenceGateBlock.POWERED);
+ if (legacy ? (flag1 || sourceBlock.defaultBlockState().isSignalSource()) : powered != flag1) {
+ if (legacy ? (flag1 || block.defaultBlockState().isSignalSource()) : powered != flag1) {
+ final boolean openGate = legacy && (flag1 == powered || state.getValue(FenceGateBlock.OPEN) != powered) ? state.getValue(OPEN) : flag1;
+ world.setBlock(pos, (BlockState) ((BlockState) state.setValue(FenceGateBlock.POWERED, flag1)).setValue(FenceGateBlock.OPEN, openGate), 2);
+ // Sakura end

View File

@@ -6,14 +6,14 @@ Subject: [PATCH] Legacy player combat mechanics
diff --git a/src/main/java/me/samsuik/sakura/utils/CombatUtil.java b/src/main/java/me/samsuik/sakura/utils/CombatUtil.java
new file mode 100644
index 0000000000000000000000000000000000000000..6cda6ba8e29587fd04b727ef188484760c4ccdbd
index 0000000000000000000000000000000000000000..89c5b4b94048052149dd84c45b6f0c6395b3ae35
--- /dev/null
+++ b/src/main/java/me/samsuik/sakura/utils/CombatUtil.java
@@ -0,0 +1,37 @@
+package me.samsuik.sakura.utils;
+
+import it.unimi.dsi.fastutil.objects.*;
+import net.minecraft.core.registries.BuiltInRegistries;
+import net.minecraft.core.Registry;
+import net.minecraft.world.item.*;
+
+public final class CombatUtil {
@@ -34,7 +34,7 @@ index 0000000000000000000000000000000000000000..6cda6ba8e29587fd04b727ef18848476
+ static {
+ LEGACY_ITEM_DAMAGE_MAP.defaultReturnValue(Float.MIN_VALUE);
+
+ for (Item item : BuiltInRegistries.ITEM) {
+ for (Item item : Registry.ITEM) {
+ if (item instanceof TieredItem tieredItem) {
+ LEGACY_ITEM_DAMAGE_MAP.put(item, baseToolDamage(tieredItem) + tieredItem.getTier().getAttackDamageBonus());
+ }

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Old enchanted golden apples
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 3e5bb455eb8f3591b564a59438671c8fdfba4996..e4cca2f8d39344cbc7987723b09882f591a273d7 100644
index c5b6e5910fbb26f69c9c2a8316691b6034b7934a..c56d216399dc68d927653cc38f45ef29cdf010cd 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -4308,7 +4308,13 @@ public abstract class LivingEntity extends Entity {
@@ -15,7 +15,7 @@ index 3e5bb455eb8f3591b564a59438671c8fdfba4996..e4cca2f8d39344cbc7987723b09882f5
- List<Pair<MobEffectInstance, Float>> list = item.getFoodProperties().getEffects();
+ // Sakura start - old enchanted golden apple
+ FoodProperties food = item.getFoodProperties();
+ if (this.level.sakuraConfig().players.combat.oldEnchantedGoldenApple && item.getFoodProperties() == net.minecraft.world.food.Foods.ENCHANTED_GOLDEN_APPLE) {
+ if (this.level.sakuraConfig.oldEnchantedGoldenApple && item.getFoodProperties() == net.minecraft.world.food.Foods.ENCHANTED_GOLDEN_APPLE) {
+ food = net.minecraft.world.food.Foods.LEGACY_ENCHANTED_GOLDEN_APPLE;
+ }
+ List<Pair<MobEffectInstance, Float>> list = food.getEffects();

View File

@@ -1,22 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samsuik <kfian294ma4@gmail.com>
Date: Fri, 14 Mar 2025 18:37:26 +0000
Subject: [PATCH] temp
diff --git a/build.gradle.kts b/build.gradle.kts
index d1b4eb9088d5780f56d8df2d4542e6d408c61e6c..fb9250a4e904e75604094694e1dc021e678d1389 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -201,7 +201,7 @@ tasks.registerRunTask("runReobf") {
classpath(runtimeClasspathWithoutVanillaServer)
}
-tasks.registerRunTask("runDev") {
- description = "Spin up a non-relocated Mojang-mapped test server"
- classpath(sourceSets.main.map { it.runtimeClasspath })
-}
+//tasks.registerRunTask("runDev") {
+// description = "Spin up a non-relocated Mojang-mapped test server"
+// classpath(sourceSets.main.map { it.runtimeClasspath })
+//}