diff --git a/divinemc-server/minecraft-patches/features/0002-DivineMC-Configuration.patch b/divinemc-server/minecraft-patches/features/0002-DivineMC-Configuration.patch index 8e6e71b..897cd69 100644 --- a/divinemc-server/minecraft-patches/features/0002-DivineMC-Configuration.patch +++ b/divinemc-server/minecraft-patches/features/0002-DivineMC-Configuration.patch @@ -5,7 +5,7 @@ Subject: [PATCH] DivineMC Configuration diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java -index c02a7375d356ccdb23c24c784584029eab51fae1..88c699c16718e27b1c44db8f4460f2efcf04e492 100644 +index 3d91240015ad8f464283da03bd45beba90cf2b89..d24e988a87d6defe5ac3d5483b54704225ebb7f0 100644 --- a/net/minecraft/server/dedicated/DedicatedServer.java +++ b/net/minecraft/server/dedicated/DedicatedServer.java @@ -217,6 +217,17 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -27,7 +27,7 @@ index c02a7375d356ccdb23c24c784584029eab51fae1..88c699c16718e27b1c44db8f4460f2ef this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess()); this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess()); diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java -index 9eccdbc2ea91d434328db9fee2c270ce2ebb290c..c443ae6a3dd8289a74837087e7b563b94aed1b90 100644 +index bcb2cfaa9780028fc5ada3a10139a5732e0e992c..58a1eb9be11bbea91196809328f41e10065e02d1 100644 --- a/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java @@ -171,6 +171,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl @@ -36,9 +36,9 @@ index 9eccdbc2ea91d434328db9fee2c270ce2ebb290c..c443ae6a3dd8289a74837087e7b563b9 public final org.purpurmc.purpur.PurpurWorldConfig purpurConfig; // Purpur - Purpur config files + public final space.bxteam.divinemc.configuration.DivineWorldConfig divinemcConfig; // DivineMC - DivineMC Configuration public static BlockPos lastPhysicsProblem; // Spigot - private org.spigotmc.TickLimiter entityLimiter; - private org.spigotmc.TickLimiter tileLimiter; -@@ -898,6 +899,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + private int tileTickPosition; + public final Map explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions +@@ -896,6 +897,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl 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.purpurConfig = new org.purpurmc.purpur.PurpurWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) levelData).getLevelName(), env); // Purpur - Purpur config files diff --git a/divinemc-server/minecraft-patches/features/0004-Add-missing-purpur-config-options.patch b/divinemc-server/minecraft-patches/features/0003-Add-missing-purpur-config-options.patch similarity index 100% rename from divinemc-server/minecraft-patches/features/0004-Add-missing-purpur-config-options.patch rename to divinemc-server/minecraft-patches/features/0003-Add-missing-purpur-config-options.patch diff --git a/divinemc-server/minecraft-patches/features/0004-Make-entity-goals-public.patch b/divinemc-server/minecraft-patches/features/0004-Make-entity-goals-public.patch new file mode 100644 index 0000000..e2b7cd0 --- /dev/null +++ b/divinemc-server/minecraft-patches/features/0004-Make-entity-goals-public.patch @@ -0,0 +1,139 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> +Date: Sun, 12 Jan 2025 02:05:38 +0300 +Subject: [PATCH] Make entity goals public + + +diff --git a/net/minecraft/world/entity/animal/Bee.java b/net/minecraft/world/entity/animal/Bee.java +index 5c8b88e8dca604d053c59106e64bfcf32491ec4f..9c235c20744c637ffad780dfa962de2970971a54 100644 +--- a/net/minecraft/world/entity/animal/Bee.java ++++ b/net/minecraft/world/entity/animal/Bee.java +@@ -778,7 +778,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { + && (!state.is(Blocks.SUNFLOWER) || state.getValue(DoublePlantBlock.HALF) == DoubleBlockHalf.UPPER); + } + +- abstract class BaseBeeGoal extends Goal { ++ public abstract class BaseBeeGoal extends Goal { // DivineMC - make public + public abstract boolean canBeeUse(); + + public abstract boolean canBeeContinueToUse(); +@@ -810,7 +810,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { + } + } + +- static class BeeBecomeAngryTargetGoal extends NearestAttackableTargetGoal { ++ public static class BeeBecomeAngryTargetGoal extends NearestAttackableTargetGoal { // DivineMC - make public + BeeBecomeAngryTargetGoal(Bee mob) { + super(mob, Player.class, 10, true, false, mob::isAngryAt); + } +@@ -837,7 +837,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { + } + } + +- class BeeEnterHiveGoal extends Bee.BaseBeeGoal { ++ public class BeeEnterHiveGoal extends Bee.BaseBeeGoal { // DivineMC - make public + @Override + public boolean canBeeUse() { + if (Bee.this.hivePos != null && Bee.this.wantsToEnterHive() && Bee.this.hivePos.closerToCenterThan(Bee.this.position(), 2.0)) { +@@ -1040,7 +1040,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { + } + } + +- class BeeGrowCropGoal extends Bee.BaseBeeGoal { ++ public class BeeGrowCropGoal extends Bee.BaseBeeGoal { // DivineMC - make public + static final int GROW_CHANCE = 30; + + @Override +@@ -1096,7 +1096,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { + } + } + +- class BeeHurtByOtherGoal extends HurtByTargetGoal { ++ public class BeeHurtByOtherGoal extends HurtByTargetGoal { // DivineMC - make public + BeeHurtByOtherGoal(final Bee mob) { + super(mob); + } +@@ -1114,7 +1114,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { + } + } + +- class BeeLocateHiveGoal extends Bee.BaseBeeGoal { ++ public class BeeLocateHiveGoal extends Bee.BaseBeeGoal { // DivineMC - make public + @Override + public boolean canBeeUse() { + return Bee.this.remainingCooldownBeforeLocatingNewHive == 0 && !Bee.this.hasHive() && Bee.this.wantsToEnterHive(); +@@ -1153,7 +1153,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { + } + } + +- class BeeLookControl extends org.purpurmc.purpur.controller.LookControllerWASD { // Purpur - Ridables ++ public class BeeLookControl extends org.purpurmc.purpur.controller.LookControllerWASD { // Purpur - Ridables // DivineMC - make public + BeeLookControl(final Mob mob) { + super(mob); + } +@@ -1171,7 +1171,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { + } + } + +- class BeePollinateGoal extends Bee.BaseBeeGoal { ++ public class BeePollinateGoal extends Bee.BaseBeeGoal { // DivineMC - make public + private static final int MIN_POLLINATION_TICKS = 400; + private static final double ARRIVAL_THRESHOLD = 0.1; + private static final int POSITION_CHANGE_CHANCE = 25; +@@ -1340,7 +1340,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { + } + } + +- class BeeWanderGoal extends Goal { ++ public class BeeWanderGoal extends Goal { // DivineMC - make public + BeeWanderGoal() { + this.setFlags(EnumSet.of(Goal.Flag.MOVE)); + } +diff --git a/net/minecraft/world/entity/animal/Cat.java b/net/minecraft/world/entity/animal/Cat.java +index b41ca04043e65f107edaebc49d398650898e35fb..1827c63fd06faca2f16988a71fd0d5091f99d2d5 100644 +--- a/net/minecraft/world/entity/animal/Cat.java ++++ b/net/minecraft/world/entity/animal/Cat.java +@@ -510,7 +510,7 @@ public class Cat extends TamableAnimal implements VariantHolder extends AvoidEntityGoal { ++ public static class CatAvoidEntityGoal extends AvoidEntityGoal { // DivineMC - make public + private final Cat cat; + + public CatAvoidEntityGoal(Cat cat, Class entityClassToAvoid, float maxDist, double walkSpeedModifier, double sprintSpeedModifier) { +@@ -529,7 +529,7 @@ public class Cat extends TamableAnimal implements VariantHolder(this, Creaking.class, 8.0F, 1.0, 1.2)); + this.goalSelector.addGoal(2, new Vindicator.VindicatorBreakDoorGoal(this)); + this.goalSelector.addGoal(3, new AbstractIllager.RaiderOpenDoorGoal(this)); +- this.goalSelector.addGoal(4, new Raider.HoldGroundAttackGoal(this, 10.0F)); ++ this.goalSelector.addGoal(4, new HoldGroundAttackGoal(this, 10.0F)); // DivineMC - Remove Raider reference + this.goalSelector.addGoal(5, new MeleeAttackGoal(this, 1.0, false)); + this.targetSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur - Ridables + this.targetSelector.addGoal(1, new HurtByTargetGoal(this, Raider.class).setAlertOthers()); +diff --git a/net/minecraft/world/entity/raid/Raider.java b/net/minecraft/world/entity/raid/Raider.java +index c06b589e669b055a26f662df60070d5908256220..458e76317f4cd10f881ae2fdf990c392d68f5241 100644 +--- a/net/minecraft/world/entity/raid/Raider.java ++++ b/net/minecraft/world/entity/raid/Raider.java +@@ -475,7 +475,7 @@ public abstract class Raider extends PatrollingMonster { + } + } + +- static class RaiderMoveThroughVillageGoal extends Goal { ++ public class RaiderMoveThroughVillageGoal extends Goal { // DivineMC - package-private static -> public non-static + private final Raider raider; + private final double speedModifier; + private BlockPos poiPos; diff --git a/divinemc-server/minecraft-patches/features/0003-Proxy-offline-warning.patch b/divinemc-server/minecraft-patches/sources/net/minecraft/server/dedicated/DedicatedServer.java.patch similarity index 64% rename from divinemc-server/minecraft-patches/features/0003-Proxy-offline-warning.patch rename to divinemc-server/minecraft-patches/sources/net/minecraft/server/dedicated/DedicatedServer.java.patch index 5c9f193..1356932 100644 --- a/divinemc-server/minecraft-patches/features/0003-Proxy-offline-warning.patch +++ b/divinemc-server/minecraft-patches/sources/net/minecraft/server/dedicated/DedicatedServer.java.patch @@ -1,14 +1,6 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> -Date: Sat, 11 Jan 2025 23:20:56 +0300 -Subject: [PATCH] Proxy offline warning - - -diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java -index 88c699c16718e27b1c44db8f4460f2efcf04e492..d24e988a87d6defe5ac3d5483b54704225ebb7f0 100644 --- a/net/minecraft/server/dedicated/DedicatedServer.java +++ b/net/minecraft/server/dedicated/DedicatedServer.java -@@ -312,7 +312,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -301,7 +_,7 @@ String proxyFlavor = (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) ? "Velocity" : "BungeeCord"; String proxyLink = (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) ? "https://docs.papermc.io/velocity/security" : "http://www.spigotmc.org/wiki/firewall-guide/"; // Paper end - Add Velocity IP Forwarding Support diff --git a/divinemc-server/minecraft-patches/sources/net/minecraft/server/level/ChunkMap.java.patch b/divinemc-server/minecraft-patches/sources/net/minecraft/server/level/ChunkMap.java.patch new file mode 100644 index 0000000..9c3b8e0 --- /dev/null +++ b/divinemc-server/minecraft-patches/sources/net/minecraft/server/level/ChunkMap.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/server/level/ChunkMap.java ++++ b/net/minecraft/server/level/ChunkMap.java +@@ -129,7 +_,7 @@ + public final AtomicInteger tickingGenerated = new AtomicInteger(); // Paper - public + private final String storageName; + private final PlayerMap playerMap = new PlayerMap(); +- public final Int2ObjectMap entityMap = new Int2ObjectOpenHashMap<>(); ++ public final Int2ObjectMap entityMap = new it.unimi.dsi.fastutil.ints.Int2ObjectLinkedOpenHashMap<>(); // DivineMC - vmp: use linked map for entity trackers for faster iteration + private final Long2ByteMap chunkTypeCache = new Long2ByteOpenHashMap(); + // Paper - rewrite chunk system + public int serverViewDistance; diff --git a/divinemc-server/minecraft-patches/sources/net/minecraft/server/rcon/RconConsoleSource.java.patch b/divinemc-server/minecraft-patches/sources/net/minecraft/server/rcon/RconConsoleSource.java.patch new file mode 100644 index 0000000..8711080 --- /dev/null +++ b/divinemc-server/minecraft-patches/sources/net/minecraft/server/rcon/RconConsoleSource.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/server/rcon/RconConsoleSource.java ++++ b/net/minecraft/server/rcon/RconConsoleSource.java +@@ -51,7 +_,7 @@ + + @Override + public void sendSystemMessage(Component component) { +- this.buffer.append(component.getString()); ++ this.buffer.append(component.getString()).append(System.lineSeparator()); // DivineMC - Fix MC-7569 + } + + @Override diff --git a/divinemc-server/minecraft-patches/sources/net/minecraft/util/ClassInstanceMultiMap.java.patch b/divinemc-server/minecraft-patches/sources/net/minecraft/util/ClassInstanceMultiMap.java.patch new file mode 100644 index 0000000..ddce835 --- /dev/null +++ b/divinemc-server/minecraft-patches/sources/net/minecraft/util/ClassInstanceMultiMap.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/util/ClassInstanceMultiMap.java ++++ b/net/minecraft/util/ClassInstanceMultiMap.java +@@ -14,7 +_,7 @@ + import net.minecraft.Util; + + public class ClassInstanceMultiMap extends AbstractCollection { +- private final Map, List> byClass = Maps.newHashMap(); ++ private final Map, List> byClass = new it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap<>(); // DivineMC - lithium: collections.entity_by_type + private final Class baseClass; + private final List allInstances = Lists.newArrayList(); + diff --git a/divinemc-server/minecraft-patches/sources/net/minecraft/util/Mth.java.patch b/divinemc-server/minecraft-patches/sources/net/minecraft/util/Mth.java.patch new file mode 100644 index 0000000..2c4477a --- /dev/null +++ b/divinemc-server/minecraft-patches/sources/net/minecraft/util/Mth.java.patch @@ -0,0 +1,25 @@ +--- a/net/minecraft/util/Mth.java ++++ b/net/minecraft/util/Mth.java +@@ -29,7 +_,7 @@ + public static final Vector3f Y_AXIS = new Vector3f(0.0F, 1.0F, 0.0F); + public static final Vector3f X_AXIS = new Vector3f(1.0F, 0.0F, 0.0F); + public static final Vector3f Z_AXIS = new Vector3f(0.0F, 0.0F, 1.0F); +- private static final float[] SIN = Util.make(new float[65536], floats -> { ++ public static final float[] SIN = Util.make(new float[65536], floats -> { // DivineMC - lithium: math.sine_lut + for (int i1 = 0; i1 < floats.length; i1++) { + floats[i1] = (float)Math.sin(i1 * Math.PI * 2.0 / 65536.0); + } +@@ -46,11 +_,11 @@ + private static final double[] COS_TAB = new double[257]; + + public static float sin(float value) { +- return SIN[(int)(value * 10430.378F) & 65535]; ++ return space.bxteam.divinemc.util.lithium.CompactSineLUT.sin(value); // DivineMC - lithium: math.sine_lut + } + + public static float cos(float value) { +- return SIN[(int)(value * 10430.378F + 16384.0F) & 65535]; ++ return space.bxteam.divinemc.util.lithium.CompactSineLUT.cos(value); // DivineMC - lithium: math.sine_lut + } + + public static float sqrt(float value) { diff --git a/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/Entity.java.patch b/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/Entity.java.patch new file mode 100644 index 0000000..601e4bb --- /dev/null +++ b/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/Entity.java.patch @@ -0,0 +1,31 @@ +--- a/net/minecraft/world/entity/Entity.java ++++ b/net/minecraft/world/entity/Entity.java +@@ -235,6 +_,7 @@ + public float yRotO; + public float xRotO; + private AABB bb = INITIAL_AABB; ++ private boolean boundingBoxChanged = false; // DivineMC - vmp: skip entity move if movement is zero + public boolean onGround; + public boolean horizontalCollision; + public boolean verticalCollision; +@@ -1095,6 +_,12 @@ + // Paper end - detailed watchdog information + + public void move(MoverType type, Vec3 movement) { ++ // DivineMC start - vmp: skip entity move if movement is zero ++ if (!boundingBoxChanged && movement.equals(Vec3.ZERO)) { ++ boundingBoxChanged = false; ++ return; ++ } ++ // DivineMC end - vmp: skip entity move if movement is zero + final Vec3 originalMovement = movement; // Paper - Expose pre-collision velocity + // Paper start - detailed watchdog information + ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread("Cannot move an entity off-main"); +@@ -4214,6 +_,7 @@ + } + + public final void setBoundingBox(AABB bb) { ++ if (!this.bb.equals(bb)) boundingBoxChanged = true; // DivineMC - vmp: skip entity move if movement is zero + // CraftBukkit start - block invalid bounding boxes + double minX = bb.minX, + minY = bb.minY, diff --git a/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/LivingEntity.java.patch b/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/LivingEntity.java.patch new file mode 100644 index 0000000..980367b --- /dev/null +++ b/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/LivingEntity.java.patch @@ -0,0 +1,42 @@ +--- a/net/minecraft/world/entity/LivingEntity.java ++++ b/net/minecraft/world/entity/LivingEntity.java +@@ -1358,7 +_,7 @@ + player.setRealHealth(health); + } + +- player.updateScaledHealth(false); ++ this.entityData.set(LivingEntity.DATA_HEALTH_ID, player.getScaledHealth()); // DivineMC - Fix sprint glitch + return; + } + // CraftBukkit end +@@ -2637,6 +_,7 @@ + } + + protected void updateSwingTime() { ++ if (!this.swinging && this.swingTime == 0) return; // DivineMC - lithium: entity.fast_hand_swing + int currentSwingDuration = this.getCurrentSwingDuration(); + if (this.swinging) { + this.swingTime++; +@@ -3120,7 +_,13 @@ + } + + protected float getFlyingSpeed() { +- return this.getControllingPassenger() instanceof net.minecraft.world.entity.player.Player ? this.getSpeed() * 0.1F : 0.02F; ++ // DivineMC start - Fix MC-172801 ++ float flyingSpeed = 0.02F; ++ if (this.getAttributes().hasAttribute(Attributes.FLYING_SPEED)) { ++ flyingSpeed = (float) (this.getAttribute(Attributes.FLYING_SPEED).getValue() * 0.049999999254942D); ++ } ++ return this.getControllingPassenger() instanceof net.minecraft.world.entity.player.Player ? this.getSpeed() * 0.1F : flyingSpeed; ++ // DivineMC end - Fix MC-172801 + } + + public float getSpeed() { +@@ -3561,6 +_,7 @@ + protected void updateFallFlying() { + this.checkSlowFallDistance(); + if (!this.level().isClientSide) { ++ if (!this.isFallFlying() && this.fallFlyTicks == 0) return; // DivineMC - lithium: entity.fast_elytra_check + if (!this.canGlide()) { + if (this.getSharedFlag(7) != false && !CraftEventFactory.callToggleGlideEvent(this, false).isCancelled()) // CraftBukkit + this.setSharedFlag(7, false); diff --git a/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java.patch b/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java.patch new file mode 100644 index 0000000..494bacd --- /dev/null +++ b/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java ++++ b/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java +@@ -114,6 +_,7 @@ + } + + protected void alertOther(Mob mob, LivingEntity target) { ++ if (mob == target) return; // DivineMC - Fix MC-110386 + mob.setTarget(target, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_NEARBY_ENTITY, true); // CraftBukkit - reason + } + } diff --git a/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/animal/Animal.java.patch b/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/animal/Animal.java.patch new file mode 100644 index 0000000..bb1eb0d --- /dev/null +++ b/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/animal/Animal.java.patch @@ -0,0 +1,23 @@ +--- a/net/minecraft/world/entity/animal/Animal.java ++++ b/net/minecraft/world/entity/animal/Animal.java +@@ -41,6 +_,7 @@ + public UUID loveCause; + public ItemStack breedItem; // CraftBukkit - Add breedItem variable + public abstract int getPurpurBreedTime(); // Purpur - Make entity breeding times configurable ++ private Object level; // DivineMC - Add level variable + + protected Animal(EntityType entityType, Level level) { + super(entityType, level); +@@ -74,7 +_,11 @@ + double d = this.random.nextGaussian() * 0.02; + double d1 = this.random.nextGaussian() * 0.02; + double d2 = this.random.nextGaussian() * 0.02; +- this.level().addParticle(ParticleTypes.HEART, this.getRandomX(1.0), this.getRandomY() + 0.5, this.getRandomZ(1.0), d, d1, d2); ++ // DivineMC start - Fix MC-93826 ++ if (this.level instanceof ServerLevel serverLevel) { ++ serverLevel.sendParticles(ParticleTypes.HEART, this.getRandomX(1.0D), this.getRandomY() + 0.5D, this.getRandomZ(1.0D), 1, d, d1, d2, 0); ++ } ++ // DivineMC end - Fix MC-93826 + } + } + } diff --git a/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/player/Player.java.patch b/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/player/Player.java.patch new file mode 100644 index 0000000..c2e6d82 --- /dev/null +++ b/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/player/Player.java.patch @@ -0,0 +1,14 @@ +--- a/net/minecraft/world/entity/player/Player.java ++++ b/net/minecraft/world/entity/player/Player.java +@@ -1864,6 +_,11 @@ + } + + public void causeFoodExhaustion(float exhaustion, org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason reason) { ++ // DivineMC start - Fix MC-31819 ++ if (this.level().getDifficulty() == Difficulty.PEACEFUL) { ++ return; ++ } ++ // DivineMC end - Fix MC-31819 + // CraftBukkit end + if (!this.abilities.invulnerable) { + if (!this.level().isClientSide) { diff --git a/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/FireworkRocketEntity.java.patch b/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/FireworkRocketEntity.java.patch new file mode 100644 index 0000000..707c8b7 --- /dev/null +++ b/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/FireworkRocketEntity.java.patch @@ -0,0 +1,16 @@ +--- a/net/minecraft/world/entity/projectile/FireworkRocketEntity.java ++++ b/net/minecraft/world/entity/projectile/FireworkRocketEntity.java +@@ -354,6 +_,13 @@ + return false; + } + ++ // DivineMC start - Don't save Fireworks ++ @Override ++ public boolean shouldBeSaved() { ++ return this.level().divinemcConfig.saveFireworks; ++ } ++ // DivineMC end - Don't save Fireworks ++ + public static ItemStack getDefaultItem() { + return new ItemStack(Items.FIREWORK_ROCKET); + } diff --git a/patches/server/0014-lithium-ai.raid.patch b/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/raid/Raid.java.patch similarity index 51% rename from patches/server/0014-lithium-ai.raid.patch rename to divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/raid/Raid.java.patch index 7a17ebb..93d2ae9 100644 --- a/patches/server/0014-lithium-ai.raid.patch +++ b/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/raid/Raid.java.patch @@ -1,27 +1,14 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> -Date: Sat, 8 Apr 2023 23:45:11 +0300 -Subject: [PATCH] lithium: ai.raid - -This patch is based on the following mixin: -"me/jellysquid/mods/lithium/mixin/ai/raid/RaidMixin.java" -By: Angeline -As part of: Lithium (https://github.com/CaffeineMC/lithium-fabric) -Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html) - -diff --git a/src/main/java/net/minecraft/world/entity/raid/Raid.java b/src/main/java/net/minecraft/world/entity/raid/Raid.java -index 11cf2d9def087b0898c828eaa21eb5f7b8811d5f..c834c29683b586cc347006f8f1298df366d8ca1b 100644 ---- a/src/main/java/net/minecraft/world/entity/raid/Raid.java -+++ b/src/main/java/net/minecraft/world/entity/raid/Raid.java -@@ -107,6 +107,7 @@ public class Raid { +--- a/net/minecraft/world/entity/raid/Raid.java ++++ b/net/minecraft/world/entity/raid/Raid.java +@@ -104,6 +_,7 @@ private Raid.RaidStatus status; private int celebrationTicks; - private Optional waveSpawnPos; + private Optional waveSpawnPos = Optional.empty(); + private boolean isBarDirty; // DivineMC - lithium: ai.raid // Paper start private static final String PDC_NBT_KEY = "BukkitValues"; private static final org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry PDC_TYPE_REGISTRY = new org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry(); -@@ -292,6 +293,12 @@ public class Raid { +@@ -264,6 +_,12 @@ public void tick() { if (!this.isStopped()) { @@ -30,12 +17,12 @@ index 11cf2d9def087b0898c828eaa21eb5f7b8811d5f..c834c29683b586cc347006f8f1298df3 + this.updateBossbarInternal(); + this.isBarDirty = false; + } -+ // DivineMC end ++ // DivineMC end - lithium: ai.raid if (this.status == Raid.RaidStatus.ONGOING) { boolean flag = this.active; - -@@ -651,9 +658,15 @@ public class Raid { - + this.active = this.level.hasChunkAt(this.center); +@@ -587,9 +_,15 @@ + } } + // DivineMC start - lithium: ai.raid @@ -46,7 +33,7 @@ index 11cf2d9def087b0898c828eaa21eb5f7b8811d5f..c834c29683b586cc347006f8f1298df3 + private void updateBossbarInternal() { this.raidEvent.setProgress(Mth.clamp(this.getHealthOfLivingRaiders() / this.totalHealth, 0.0F, 1.0F)); } -+ // DivineMC end ++ // DivineMC end - lithium: ai.raid public float getHealthOfLivingRaiders() { float f = 0.0F; diff --git a/divinemc-server/minecraft-patches/sources/net/minecraft/world/level/GameRules.java.patch b/divinemc-server/minecraft-patches/sources/net/minecraft/world/level/GameRules.java.patch new file mode 100644 index 0000000..56a0ade --- /dev/null +++ b/divinemc-server/minecraft-patches/sources/net/minecraft/world/level/GameRules.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/level/GameRules.java ++++ b/net/minecraft/world/level/GameRules.java +@@ -249,7 +_,7 @@ + } + + private GameRules(Map, GameRules.Value> rules, FeatureFlagSet enabledFeatures) { +- this.rules = rules; ++ this.rules = new it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<>(rules); // DivineMC - lithium: collections.gamerules + this.enabledFeatures = enabledFeatures; + + // Paper start - Perf: Use array for gamerule storage diff --git a/divinemc-server/minecraft-patches/sources/net/minecraft/world/level/Level.java.patch b/divinemc-server/minecraft-patches/sources/net/minecraft/world/level/Level.java.patch new file mode 100644 index 0000000..6ad3b76 --- /dev/null +++ b/divinemc-server/minecraft-patches/sources/net/minecraft/world/level/Level.java.patch @@ -0,0 +1,20 @@ +--- a/net/minecraft/world/level/Level.java ++++ b/net/minecraft/world/level/Level.java +@@ -172,8 +_,6 @@ + public final io.papermc.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray + public final org.purpurmc.purpur.PurpurWorldConfig purpurConfig; // Purpur - Purpur config files + public static BlockPos lastPhysicsProblem; // Spigot +- private org.spigotmc.TickLimiter entityLimiter; +- private org.spigotmc.TickLimiter tileLimiter; + private int tileTickPosition; + public final Map explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions + public java.util.ArrayDeque redstoneUpdateInfos; // Paper - Faster redstone torch rapid clock removal; Move from Map in BlockRedstoneTorch to here +@@ -974,8 +_,6 @@ + public void onBorderSetDamageSafeZOne(WorldBorder border, double safeZoneRadius) {} + }); + // CraftBukkit end +- this.entityLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.entityMaxTickTime); +- this.tileLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.tileMaxTickTime); + this.chunkPacketBlockController = this.paperConfig().anticheat.antiXray.enabled ? new io.papermc.paper.antixray.ChunkPacketBlockControllerAntiXray(this, executor) : io.papermc.paper.antixray.ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray + this.entityLookup = new ca.spottedleaf.moonrise.patches.chunk_system.level.entity.dfl.DefaultEntityLookup(this); // Paper - rewrite chunk system + } diff --git a/divinemc-server/minecraft-patches/sources/net/minecraft/world/level/LocalMobCapCalculator.java.patch b/divinemc-server/minecraft-patches/sources/net/minecraft/world/level/LocalMobCapCalculator.java.patch new file mode 100644 index 0000000..ddedc73 --- /dev/null +++ b/divinemc-server/minecraft-patches/sources/net/minecraft/world/level/LocalMobCapCalculator.java.patch @@ -0,0 +1,20 @@ +--- a/net/minecraft/world/level/LocalMobCapCalculator.java ++++ b/net/minecraft/world/level/LocalMobCapCalculator.java +@@ -42,14 +_,14 @@ + } + + static class MobCounts { +- private final Object2IntMap counts = new Object2IntOpenHashMap<>(MobCategory.values().length); ++ private final int[] spawnGroupDensities = new int[MobCategory.values().length]; // DivineMC - vmp: spawn_density_cap + + public void add(MobCategory category) { +- this.counts.computeInt(category, (key, value) -> value == null ? 1 : value + 1); ++ this.spawnGroupDensities[category.ordinal()]++; // DivineMC - vmp: spawn_density_cap + } + + public boolean canSpawn(MobCategory category) { +- return this.counts.getOrDefault(category, 0) < category.getMaxInstancesPerChunk(); ++ return this.spawnGroupDensities[category.ordinal()] < category.getMaxInstancesPerChunk(); // DivineMC - vmp: spawn_density_cap + } + } + } diff --git a/divinemc-server/paper-patches/features/0004-Remove-Spigot-tick-limiter.patch b/divinemc-server/paper-patches/features/0004-Remove-Spigot-tick-limiter.patch new file mode 100644 index 0000000..f1c0c6a --- /dev/null +++ b/divinemc-server/paper-patches/features/0004-Remove-Spigot-tick-limiter.patch @@ -0,0 +1,52 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> +Date: Sun, 12 Jan 2025 01:47:27 +0300 +Subject: [PATCH] Remove Spigot tick limiter + + +diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java +index 5b305092a808c2b9b339b9072bf7f7bfc00f0b8a..c9ff04efcdf063326119b9f65630979d38dc7abf 100644 +--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java ++++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java +@@ -418,6 +418,7 @@ public class SpigotWorldConfig { + this.hangingTickFrequency = this.getInt("hanging-tick-frequency", 200); // DivineMC - Optimize default values for configs + } + ++ /* DivineMC - remove tick limiter + public int tileMaxTickTime; + public int entityMaxTickTime; + private void maxTickTimes() { +@@ -425,6 +426,7 @@ public class SpigotWorldConfig { + this.entityMaxTickTime = this.getInt("max-tick-time.entity", 50); + this.log("Tile Max Tick Time: " + this.tileMaxTickTime + "ms Entity max Tick Time: " + this.entityMaxTickTime + "ms"); + } ++ */ + + public int thunderChance; + private void thunderChance() { +diff --git a/src/main/java/org/spigotmc/TickLimiter.java b/src/main/java/org/spigotmc/TickLimiter.java +deleted file mode 100644 +index 961489499e220d71339771dcabf151edeaf6d231..0000000000000000000000000000000000000000 +--- a/src/main/java/org/spigotmc/TickLimiter.java ++++ /dev/null +@@ -1,20 +0,0 @@ +-package org.spigotmc; +- +-public class TickLimiter { +- +- private final int maxTime; +- private long startTime; +- +- public TickLimiter(int maxTime) { +- this.maxTime = maxTime; +- } +- +- public void initTick() { +- this.startTime = System.currentTimeMillis(); +- } +- +- public boolean shouldContinue() { +- long remaining = System.currentTimeMillis() - this.startTime; +- return remaining < this.maxTime; +- } +-} diff --git a/divinemc-server/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java b/divinemc-server/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java index 6712a46..714479b 100644 --- a/divinemc-server/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java +++ b/divinemc-server/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java @@ -76,4 +76,9 @@ public class DivineWorldConfig { final Map value = DivineConfig.getMap("world-settings." + worldName + "." + path, null); return value.isEmpty() ? fallback : value; } + + public boolean saveFireworks = false; + private void saveFireworks() { + saveFireworks = getBoolean("gameplay-mechanics.should-save-fireworks", saveFireworks); + } } diff --git a/divinemc-server/src/main/java/space/bxteam/divinemc/util/lithium/CompactSineLUT.java b/divinemc-server/src/main/java/space/bxteam/divinemc/util/lithium/CompactSineLUT.java new file mode 100644 index 0000000..76225e1 --- /dev/null +++ b/divinemc-server/src/main/java/space/bxteam/divinemc/util/lithium/CompactSineLUT.java @@ -0,0 +1,88 @@ +package space.bxteam.divinemc.util.lithium; + +import net.minecraft.util.Mth; + +/** + * A replacement for the sine angle lookup table used in {@link Mth}, both reducing the size of LUT and improving + * the access patterns for common paired sin/cos operations. + *

+ * sin(-x) = -sin(x) + * ... to eliminate negative angles from the LUT. + *

+ * sin(x) = sin(pi/2 - x) + * ... to eliminate supplementary angles from the LUT. + *

+ * Using these identities allows us to reduce the LUT from 64K entries (256 KB) to just 16K entries (64 KB), enabling + * it to better fit into the CPU's caches at the expense of some cycles on the fast path. The implementation has been + * tightly optimized to avoid branching where possible and to use very quick integer operations. + *

+ * Generally speaking, reducing the size of a lookup table is always a good optimization, but since we need to spend + * extra CPU cycles trying to maintain parity with vanilla, there is the potential risk that this implementation ends + * up being slower than vanilla when the lookup table is able to be kept in cache memory. + *

+ * Unlike other "fast math" implementations, the values returned by this class are *bit-for-bit identical* with those + * from {@link Mth}. Validation is performed during runtime to ensure that the table is correct. + * + * @author coderbot16 Author of the original (and very clever) implementation in Rust + * @author jellysquid3 Additional optimizations, port to Java + */ +public class CompactSineLUT { + private static final int[] SIN_INT = new int[16384 + 1]; + private static final float SIN_MIDPOINT; + + static { + // Copy the sine table, covering to raw int bits + for (int i = 0; i < SIN_INT.length; i++) { + SIN_INT[i] = Float.floatToRawIntBits(Mth.SIN[i]); + } + + SIN_MIDPOINT = Mth.SIN[Mth.SIN.length / 2]; + + // Test that the lookup table is correct during runtime + for (int i = 0; i < Mth.SIN.length; i++) { + float expected = Mth.SIN[i]; + float value = lookup(i); + + if (expected != value) { + throw new IllegalArgumentException(String.format("LUT error at index %d (expected: %s, found: %s)", i, expected, value)); + } + } + } + + // [VanillaCopy] Mth#sin(float) + public static float sin(float f) { + return lookup((int) (f * 10430.378f) & 0xFFFF); + } + + // [VanillaCopy] Mth#cos(float) + public static float cos(float f) { + return lookup((int) (f * 10430.378f + 16384.0f) & 0xFFFF); + } + + private static float lookup(int index) { + // A special case... Is there some way to eliminate this? + if (index == 32768) { + return SIN_MIDPOINT; + } + + // Trigonometric identity: sin(-x) = -sin(x) + // Given a domain of 0 <= x <= 2*pi, just negate the value if x > pi. + // This allows the sin table size to be halved. + int neg = (index & 0x8000) << 16; + + // All bits set if (pi/2 <= x), none set otherwise + // Extracts the 15th bit from 'half' + int mask = (index << 17) >> 31; + + // Trigonometric identity: sin(x) = sin(pi/2 - x) + int pos = (0x8001 & mask) + (index ^ mask); + + // Wrap the position in the table. Moving this down to immediately before the array access + // seems to help the Hotspot compiler optimize the bit math better. + pos &= 0x7fff; + + // Fetch the corresponding value from the LUT and invert the sign bit as needed + // This directly manipulate the sign bit on the float bits to simplify logic + return Float.intBitsToFloat(SIN_INT[pos] ^ neg); + } +} diff --git a/patches/server/0009-Fix-MC-2025.patch b/patches/removed/1.21/server/0009-Fix-MC-2025.patch similarity index 100% rename from patches/server/0009-Fix-MC-2025.patch rename to patches/removed/1.21/server/0009-Fix-MC-2025.patch diff --git a/patches/server/0011-Fix-MC-93018.patch b/patches/removed/1.21/server/0011-Fix-MC-93018.patch similarity index 100% rename from patches/server/0011-Fix-MC-93018.patch rename to patches/removed/1.21/server/0011-Fix-MC-93018.patch diff --git a/patches/server/0005-Fix-MC-93826.patch b/patches/server/0005-Fix-MC-93826.patch deleted file mode 100644 index 0382740..0000000 --- a/patches/server/0005-Fix-MC-93826.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> -Date: Sat, 10 Jun 2023 12:44:58 +0300 -Subject: [PATCH] Fix MC-93826 - - -diff --git a/src/main/java/net/minecraft/world/entity/animal/Animal.java b/src/main/java/net/minecraft/world/entity/animal/Animal.java -index 8df1682dca61b0f771a1c08f5bcd797506badf19..389950c97eb94fbbc730fbff51fedcc3217be22a 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/Animal.java -+++ b/src/main/java/net/minecraft/world/entity/animal/Animal.java -@@ -51,6 +51,8 @@ public abstract class Animal extends AgeableMob { - public ItemStack breedItem; // CraftBukkit - Add breedItem variable - public abstract int getPurpurBreedTime(); // Purpur - Make entity breeding times configurable - -+ private Object level; -+ - protected Animal(EntityType type, Level world) { - super(type, world); - this.setPathfindingMalus(PathType.DANGER_FIRE, 16.0F); -@@ -84,7 +86,11 @@ public abstract class Animal extends AgeableMob { - double d1 = this.random.nextGaussian() * 0.02D; - double d2 = this.random.nextGaussian() * 0.02D; - -- this.level().addParticle(ParticleTypes.HEART, this.getRandomX(1.0D), this.getRandomY() + 0.5D, this.getRandomZ(1.0D), d0, d1, d2); -+ // DivineMC start - Fix MC-93826 -+ if (this.level instanceof ServerLevel serverLevel) { -+ serverLevel.sendParticles(ParticleTypes.HEART, this.getRandomX(1.0D), this.getRandomY() + 0.5D, this.getRandomZ(1.0D), 1, d0, d1, d2, 0); -+ } -+ // DivineMC end - } - } - diff --git a/patches/server/0006-Fix-MC-110386.patch b/patches/server/0006-Fix-MC-110386.patch deleted file mode 100644 index 71168ed..0000000 --- a/patches/server/0006-Fix-MC-110386.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> -Date: Sat, 1 Apr 2023 00:41:04 +0300 -Subject: [PATCH] Fix MC-110386 - -See https://bugs.mojang.com/browse/MC-110386 - -diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java -index edfc77ba9c5c7dc4cfe997faff7a34e9b9e9365e..f1dc334ce16f92b1f4c165b931bb322e88646bf9 100644 ---- a/src/main/java/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java -+++ b/src/main/java/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java -@@ -114,6 +114,7 @@ public class HurtByTargetGoal extends TargetGoal { - } - - protected void alertOther(Mob mob, LivingEntity target) { -+ if (mob == target) return; // DivineMC - Fix MC-110386 - mob.setTarget(target, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_NEARBY_ENTITY, true); // CraftBukkit - reason - } - } diff --git a/patches/server/0007-Fix-MC-31819.patch b/patches/server/0007-Fix-MC-31819.patch deleted file mode 100644 index 7539969..0000000 --- a/patches/server/0007-Fix-MC-31819.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> -Date: Sat, 10 Jun 2023 13:17:01 +0300 -Subject: [PATCH] Fix MC-31819 - - -diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index d19b1e127a1018a798eed181d8060a781b589f90..a861e84b959e6f07a51c72b25ea4df0b5df7fd34 100644 ---- a/src/main/java/net/minecraft/world/entity/player/Player.java -+++ b/src/main/java/net/minecraft/world/entity/player/Player.java -@@ -1896,6 +1896,11 @@ public abstract class Player extends LivingEntity { - } - - public void causeFoodExhaustion(float f, EntityExhaustionEvent.ExhaustionReason reason) { -+ // DivineMC start - Fix MC-31819 -+ if (this.level().getDifficulty() == Difficulty.PEACEFUL) { -+ return; -+ } -+ // DivineMC end - // CraftBukkit end - if (!this.abilities.invulnerable) { - if (!this.level().isClientSide) { diff --git a/patches/server/0008-Fix-MC-172801.patch b/patches/server/0008-Fix-MC-172801.patch deleted file mode 100644 index 9ab3d67..0000000 --- a/patches/server/0008-Fix-MC-172801.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> -Date: Sat, 27 Jan 2024 16:56:27 +0300 -Subject: [PATCH] Fix MC-172801 - -Original post on Mojira: https://bugs.mojang.com/browse/MC-172801 - -diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 33fbe0f7a356dd847e546feffb468b2803c6744b..84ac9ee926a9a4b4d2dcd107cb089162637a2576 100644 ---- a/src/main/java/net/minecraft/world/entity/LivingEntity.java -+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3350,7 +3350,13 @@ public abstract class LivingEntity extends Entity implements Attackable { - } - - protected float getFlyingSpeed() { -- return this.getControllingPassenger() instanceof net.minecraft.world.entity.player.Player ? this.getSpeed() * 0.1F : 0.02F; -+ // DivineMC start - Fix MC-172801 -+ float flyingSpeed = 0.02F; -+ if (this.getAttributes().hasAttribute(Attributes.FLYING_SPEED)) { -+ flyingSpeed = (float) (this.getAttribute(Attributes.FLYING_SPEED).getValue() * 0.049999999254942D); -+ } -+ return this.getControllingPassenger() instanceof net.minecraft.world.entity.player.Player ? this.getSpeed() * 0.1F : flyingSpeed; -+ // DivineMC end - } - - public float getSpeed() { diff --git a/patches/server/0010-Fix-MC-7569.patch b/patches/server/0010-Fix-MC-7569.patch deleted file mode 100644 index 8820936..0000000 --- a/patches/server/0010-Fix-MC-7569.patch +++ /dev/null @@ -1,20 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> -Date: Sun, 16 Jul 2023 12:21:09 +0300 -Subject: [PATCH] Fix MC-7569 - -Original post on Mojira: https://bugs.mojang.com/browse/MC-7569 - -diff --git a/src/main/java/net/minecraft/server/rcon/RconConsoleSource.java b/src/main/java/net/minecraft/server/rcon/RconConsoleSource.java -index a04cf04cb694237ec77b38fc576f0dfc9264a25a..47a00e408d96fd9ade864ec4e278e1eb006722ef 100644 ---- a/src/main/java/net/minecraft/server/rcon/RconConsoleSource.java -+++ b/src/main/java/net/minecraft/server/rcon/RconConsoleSource.java -@@ -55,7 +55,7 @@ public class RconConsoleSource implements CommandSource { - - @Override - public void sendSystemMessage(Component message) { -- this.buffer.append(message.getString()); -+ this.buffer.append(message.getString()).append(System.lineSeparator()); - } - - @Override diff --git a/patches/server/0012-vmp-skip-entity-move-if-movement-is-zero.patch b/patches/server/0012-vmp-skip-entity-move-if-movement-is-zero.patch deleted file mode 100644 index 02c28ad..0000000 --- a/patches/server/0012-vmp-skip-entity-move-if-movement-is-zero.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> -Date: Fri, 26 Jan 2024 17:42:42 +0300 -Subject: [PATCH] vmp: skip entity move if movement is zero - -Original code by RelativityMC, licensed under MIT -You can find the original code on https://github.com/RelativityMC/VMP-fabric (Yarn mappings) - -diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 7fba17c4802159c50a57f23820a153dcd85a2470..5c3c38c6c5d1ac06848f1709a195c28fb7a3d2a2 100644 ---- a/src/main/java/net/minecraft/world/entity/Entity.java -+++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -282,6 +282,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - public float yRotO; - public float xRotO; - private AABB bb; -+ private boolean boundingBoxChanged = false; // DivineMC - vmp: skip entity move if movement is zero - public boolean onGround; - public boolean horizontalCollision; - public boolean verticalCollision; -@@ -1197,6 +1198,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - // Paper end - detailed watchdog information - - public void move(MoverType type, Vec3 movement) { -+ // DivineMC start - vmp: skip entity move if movement is zero -+ if (!boundingBoxChanged && movement.equals(Vec3.ZERO)) { -+ boundingBoxChanged = false; -+ return; -+ } -+ // DivineMC end - final Vec3 originalMovement = movement; // Paper - Expose pre-collision velocity - // Paper start - detailed watchdog information - ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread("Cannot move an entity off-main"); -@@ -4502,6 +4509,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - } - - public final void setBoundingBox(AABB boundingBox) { -+ if (!this.bb.equals(boundingBox)) boundingBoxChanged = true; // DivineMC - vmp: skip entity move if movement is zero - // CraftBukkit start - block invalid bounding boxes - double minX = boundingBox.minX, - minY = boundingBox.minY, diff --git a/patches/server/0013-vmp-use-linked-map-for-entity-trackers-for-faster-it.patch b/patches/server/0013-vmp-use-linked-map-for-entity-trackers-for-faster-it.patch deleted file mode 100644 index 0de152e..0000000 --- a/patches/server/0013-vmp-use-linked-map-for-entity-trackers-for-faster-it.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> -Date: Sun, 14 Jan 2024 14:50:10 +0300 -Subject: [PATCH] vmp: use linked map for entity trackers for faster iteration - -Original code by RelativityMC, licensed under MIT -You can find the original code on https://github.com/RelativityMC/VMP-fabric (Yarn mappings) - -diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 5b3a886c624b36557cbfaccdc3fb05a46a4ba36a..b3f5d66ec02953c7ed8c2c05af6f77bc6bb83d1d 100644 ---- a/src/main/java/net/minecraft/server/level/ChunkMap.java -+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -8,6 +8,7 @@ import com.google.common.collect.Queues; - import com.google.common.collect.Sets; - import com.mojang.datafixers.DataFixer; - import com.mojang.logging.LogUtils; -+import it.unimi.dsi.fastutil.ints.Int2ObjectLinkedOpenHashMap; // DivineMC - vmp: use linked map for entity trackers for faster iteration - import it.unimi.dsi.fastutil.ints.Int2ObjectMap; - import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; - import it.unimi.dsi.fastutil.longs.Long2ByteMap; -@@ -186,7 +187,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - this.toDrop = new LongOpenHashSet(); - this.tickingGenerated = new AtomicInteger(); - this.playerMap = new PlayerMap(); -- this.entityMap = new Int2ObjectOpenHashMap(); -+ this.entityMap = new Int2ObjectLinkedOpenHashMap<>(); // DivineMC - vmp: use linked map for entity trackers for faster iteration - this.chunkTypeCache = new Long2ByteOpenHashMap(); - // Paper - rewrite chunk system - Path path = session.getDimensionPath(world.dimension()); diff --git a/patches/server/0015-lithium-collections.gamerules.patch b/patches/server/0015-lithium-collections.gamerules.patch deleted file mode 100644 index 698e68b..0000000 --- a/patches/server/0015-lithium-collections.gamerules.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> -Date: Sat, 8 Apr 2023 01:28:01 +0300 -Subject: [PATCH] lithium: collections.gamerules - -Original code by CaffeineMC, licensed under LGPL v3 -You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings) - -diff --git a/src/main/java/net/minecraft/world/level/GameRules.java b/src/main/java/net/minecraft/world/level/GameRules.java -index 467696a78791d65a66eb380e97d33123a5a12e61..ea7b3b2ad418e046e7f3fae3b09a0b76c4a6152f 100644 ---- a/src/main/java/net/minecraft/world/level/GameRules.java -+++ b/src/main/java/net/minecraft/world/level/GameRules.java -@@ -33,6 +33,7 @@ import net.minecraft.server.level.ServerPlayer; - import net.minecraft.world.flag.FeatureFlagSet; - import net.minecraft.world.flag.FeatureFlags; - import org.slf4j.Logger; -+import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; - - public class GameRules { - -@@ -168,7 +169,7 @@ public class GameRules { - } - - private GameRules(Map, GameRules.Value> rules, FeatureFlagSet enabledFeatures) { -- this.rules = rules; -+ this.rules = new Object2ObjectOpenHashMap<>(rules); // DivineMC - lithium: collections.gamerules - this.enabledFeatures = enabledFeatures; - - // Paper start - Perf: Use array for gamerule storage diff --git a/patches/server/0016-lithium-collections.entity_by_type.patch b/patches/server/0016-lithium-collections.entity_by_type.patch deleted file mode 100644 index 2888f25..0000000 --- a/patches/server/0016-lithium-collections.entity_by_type.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> -Date: Sat, 13 Jan 2024 20:12:23 +0300 -Subject: [PATCH] lithium: collections.entity_by_type - -Original code by CaffeineMC, licensed under LGPL v3 -You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings) - -diff --git a/src/main/java/net/minecraft/util/ClassInstanceMultiMap.java b/src/main/java/net/minecraft/util/ClassInstanceMultiMap.java -index 038710ba934a9a57815dfe9f414b98223b848385..f631aa8bc724d0fc899783967417c3e01aac3c9c 100644 ---- a/src/main/java/net/minecraft/util/ClassInstanceMultiMap.java -+++ b/src/main/java/net/minecraft/util/ClassInstanceMultiMap.java -@@ -3,7 +3,6 @@ package net.minecraft.util; - import com.google.common.collect.ImmutableList; - import com.google.common.collect.Iterators; - import com.google.common.collect.Lists; --import com.google.common.collect.Maps; - import java.util.AbstractCollection; - import java.util.Collection; - import java.util.Collections; -@@ -12,9 +11,10 @@ import java.util.List; - import java.util.Map; - import java.util.Map.Entry; - import net.minecraft.Util; -+import it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap; // DivineMC - - public class ClassInstanceMultiMap extends AbstractCollection { -- private final Map, List> byClass = Maps.newHashMap(); -+ private final Map, List> byClass = new Reference2ReferenceOpenHashMap<>(); // DivineMC - private final Class baseClass; - private final List allInstances = Lists.newArrayList(); - diff --git a/patches/server/0017-lithium-entity.fast_elytra_check-entity.fast_hand_sw.patch b/patches/server/0017-lithium-entity.fast_elytra_check-entity.fast_hand_sw.patch deleted file mode 100644 index 110e5b9..0000000 --- a/patches/server/0017-lithium-entity.fast_elytra_check-entity.fast_hand_sw.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> -Date: Sat, 13 Jan 2024 20:37:54 +0300 -Subject: [PATCH] lithium: entity.fast_elytra_check + entity.fast_hand_swing - -Original code by CaffeineMC, licensed under LGPL v3 -You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings) - -diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 84ac9ee926a9a4b4d2dcd107cb089162637a2576..012ab9befd112e26d5f593cac1dba8592c0b0021 100644 ---- a/src/main/java/net/minecraft/world/entity/LivingEntity.java -+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -2832,6 +2832,7 @@ public abstract class LivingEntity extends Entity implements Attackable { - } - - protected void updateSwingTime() { -+ if (!this.swinging && this.swingTime == 0) return; // DivineMC - lithium: entity.fast_hand_swing - int i = this.getCurrentSwingDuration(); - - if (this.swinging) { -@@ -3878,6 +3879,7 @@ public abstract class LivingEntity extends Entity implements Attackable { - protected void updateFallFlying() { - this.checkSlowFallDistance(); - if (!this.level().isClientSide) { -+ if (!this.isFallFlying() && this.fallFlyTicks == 0) return; // DivineMC - lithium: entity.fast_elytra_check - if (!this.canGlide()) { - if (this.getSharedFlag(7) != false && !CraftEventFactory.callToggleGlideEvent(this, false).isCancelled()) // CraftBukkit - this.setSharedFlag(7, false); diff --git a/patches/server/0018-vmp-spawn_density_cap.patch b/patches/server/0018-vmp-spawn_density_cap.patch deleted file mode 100644 index d72792b..0000000 --- a/patches/server/0018-vmp-spawn_density_cap.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> -Date: Tue, 16 Jan 2024 20:35:06 +0300 -Subject: [PATCH] vmp: spawn_density_cap - -Original code by RelativityMC, licensed under MIT -You can find the original code on https://github.com/RelativityMC/VMP-fabric (Yarn mappings) - -diff --git a/src/main/java/net/minecraft/world/level/LocalMobCapCalculator.java b/src/main/java/net/minecraft/world/level/LocalMobCapCalculator.java -index 2039b16e5e9bc0797b3f31081d221bb8b34a4dc7..4239fa40788fb92211cc52ed5e06236621195018 100644 ---- a/src/main/java/net/minecraft/world/level/LocalMobCapCalculator.java -+++ b/src/main/java/net/minecraft/world/level/LocalMobCapCalculator.java -@@ -3,8 +3,6 @@ package net.minecraft.world.level; - import com.google.common.collect.Maps; - import it.unimi.dsi.fastutil.longs.Long2ObjectMap; - import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; --import it.unimi.dsi.fastutil.objects.Object2IntMap; --import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; - import java.util.List; - import java.util.Map; - import net.minecraft.server.level.ChunkMap; -@@ -42,14 +40,14 @@ public class LocalMobCapCalculator { - } - - static class MobCounts { -- private final Object2IntMap counts = new Object2IntOpenHashMap<>(MobCategory.values().length); -+ private final int[] spawnGroupDensities = new int[MobCategory.values().length]; // DivineMC - vmp: spawn_density_cap - - public void add(MobCategory spawnGroup) { -- this.counts.computeInt(spawnGroup, (group, density) -> density == null ? 1 : density + 1); -+ this.spawnGroupDensities[spawnGroup.ordinal()]++; // DivineMC - vmp: spawn_density_cap - } - - public boolean canSpawn(MobCategory spawnGroup) { -- return this.counts.getOrDefault(spawnGroup, 0) < spawnGroup.getMaxInstancesPerChunk(); -+ return this.spawnGroupDensities[spawnGroup.ordinal()] < spawnGroup.getMaxInstancesPerChunk(); // DivineMC - vmp: spawn_density_cap - } - } - } diff --git a/patches/server/0019-lithium-math.sine_lut.patch b/patches/server/0019-lithium-math.sine_lut.patch deleted file mode 100644 index ccaa794..0000000 --- a/patches/server/0019-lithium-math.sine_lut.patch +++ /dev/null @@ -1,127 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> -Date: Sat, 25 May 2024 18:39:17 +0300 -Subject: [PATCH] lithium: math.sine_lut - - -diff --git a/src/main/java/net/minecraft/util/Mth.java b/src/main/java/net/minecraft/util/Mth.java -index ef93fc37759e0b54387c8a59adc2b19258cfeb7d..f6fd9804c6d8e3c492d3d7ebef2e15538820decc 100644 ---- a/src/main/java/net/minecraft/util/Mth.java -+++ b/src/main/java/net/minecraft/util/Mth.java -@@ -29,7 +29,7 @@ public class Mth { - public static final Vector3f Y_AXIS = new Vector3f(0.0F, 1.0F, 0.0F); - public static final Vector3f X_AXIS = new Vector3f(1.0F, 0.0F, 0.0F); - public static final Vector3f Z_AXIS = new Vector3f(0.0F, 0.0F, 1.0F); -- private static final float[] SIN = Util.make(new float[65536], sineTable -> { -+ public static final float[] SIN = Util.make(new float[65536], sineTable -> { // DivineMC - lithium: math.sine_lut - for (int ix = 0; ix < sineTable.length; ix++) { - sineTable[ix] = (float)Math.sin((double)ix * Math.PI * 2.0 / 65536.0); - } -@@ -46,11 +46,11 @@ public class Mth { - private static final double[] COS_TAB = new double[257]; - - public static float sin(float value) { -- return SIN[(int)(value * 10430.378F) & 65535]; -+ return space.bxteam.divinemc.util.lithium.CompactSineLUT.sin(value); // DivineMC - lithium: math.sine_lut - } - - public static float cos(float value) { -- return SIN[(int)(value * 10430.378F + 16384.0F) & 65535]; -+ return space.bxteam.divinemc.util.lithium.CompactSineLUT.cos(value); // DivineMC - lithium: math.sine_lut - } - - public static float sqrt(float value) { -diff --git a/src/main/java/space/bxteam/divinemc/util/lithium/CompactSineLUT.java b/src/main/java/space/bxteam/divinemc/util/lithium/CompactSineLUT.java -new file mode 100644 -index 0000000000000000000000000000000000000000..79a49c3e99ab069172f2fd85a942474f0c872fc9 ---- /dev/null -+++ b/src/main/java/space/bxteam/divinemc/util/lithium/CompactSineLUT.java -@@ -0,0 +1,88 @@ -+package space.bxteam.divinemc.util.lithium; -+ -+import net.minecraft.util.Mth; -+ -+/** -+ * A replacement for the sine angle lookup table used in {@link Mth}, both reducing the size of LUT and improving -+ * the access patterns for common paired sin/cos operations. -+ *

-+ * sin(-x) = -sin(x) -+ * ... to eliminate negative angles from the LUT. -+ *

-+ * sin(x) = sin(pi/2 - x) -+ * ... to eliminate supplementary angles from the LUT. -+ *

-+ * Using these identities allows us to reduce the LUT from 64K entries (256 KB) to just 16K entries (64 KB), enabling -+ * it to better fit into the CPU's caches at the expense of some cycles on the fast path. The implementation has been -+ * tightly optimized to avoid branching where possible and to use very quick integer operations. -+ *

-+ * Generally speaking, reducing the size of a lookup table is always a good optimization, but since we need to spend -+ * extra CPU cycles trying to maintain parity with vanilla, there is the potential risk that this implementation ends -+ * up being slower than vanilla when the lookup table is able to be kept in cache memory. -+ *

-+ * Unlike other "fast math" implementations, the values returned by this class are *bit-for-bit identical* with those -+ * from {@link Mth}. Validation is performed during runtime to ensure that the table is correct. -+ * -+ * @author coderbot16 Author of the original (and very clever) implementation in Rust -+ * @author jellysquid3 Additional optimizations, port to Java -+ */ -+public class CompactSineLUT { -+ private static final int[] SIN_INT = new int[16384 + 1]; -+ private static final float SIN_MIDPOINT; -+ -+ static { -+ // Copy the sine table, covering to raw int bits -+ for (int i = 0; i < SIN_INT.length; i++) { -+ SIN_INT[i] = Float.floatToRawIntBits(Mth.SIN[i]); -+ } -+ -+ SIN_MIDPOINT = Mth.SIN[Mth.SIN.length / 2]; -+ -+ // Test that the lookup table is correct during runtime -+ for (int i = 0; i < Mth.SIN.length; i++) { -+ float expected = Mth.SIN[i]; -+ float value = lookup(i); -+ -+ if (expected != value) { -+ throw new IllegalArgumentException(String.format("LUT error at index %d (expected: %s, found: %s)", i, expected, value)); -+ } -+ } -+ } -+ -+ // [VanillaCopy] Mth#sin(float) -+ public static float sin(float f) { -+ return lookup((int) (f * 10430.378f) & 0xFFFF); -+ } -+ -+ // [VanillaCopy] Mth#cos(float) -+ public static float cos(float f) { -+ return lookup((int) (f * 10430.378f + 16384.0f) & 0xFFFF); -+ } -+ -+ private static float lookup(int index) { -+ // A special case... Is there some way to eliminate this? -+ if (index == 32768) { -+ return SIN_MIDPOINT; -+ } -+ -+ // Trigonometric identity: sin(-x) = -sin(x) -+ // Given a domain of 0 <= x <= 2*pi, just negate the value if x > pi. -+ // This allows the sin table size to be halved. -+ int neg = (index & 0x8000) << 16; -+ -+ // All bits set if (pi/2 <= x), none set otherwise -+ // Extracts the 15th bit from 'half' -+ int mask = (index << 17) >> 31; -+ -+ // Trigonometric identity: sin(x) = sin(pi/2 - x) -+ int pos = (0x8001 & mask) + (index ^ mask); -+ -+ // Wrap the position in the table. Moving this down to immediately before the array access -+ // seems to help the Hotspot compiler optimize the bit math better. -+ pos &= 0x7fff; -+ -+ // Fetch the corresponding value from the LUT and invert the sign bit as needed -+ // This directly manipulate the sign bit on the float bits to simplify logic -+ return Float.intBitsToFloat(SIN_INT[pos] ^ neg); -+ } -+} diff --git a/patches/server/0020-Don-t-save-Fireworks.patch b/patches/server/0020-Don-t-save-Fireworks.patch deleted file mode 100644 index fb9d7ee..0000000 --- a/patches/server/0020-Don-t-save-Fireworks.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> -Date: Fri, 31 Mar 2023 22:47:12 +0300 -Subject: [PATCH] Don't save Fireworks - - -diff --git a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java -index 8a4e7e1c0c4919d2ee34121c14f9665b9ad95273..70c8fe6c225a1e90a144f9b00e6ce2d97d5d82a7 100644 ---- a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java -+++ b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java -@@ -370,6 +370,13 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { - return false; - } - -+ // DivineMC start - Don't save Fireworks -+ @Override -+ public boolean shouldBeSaved() { -+ return this.level().divinemcConfig.saveFireworks; -+ } -+ // DivineMC end -+ - public static ItemStack getDefaultItem() { - return new ItemStack(Items.FIREWORK_ROCKET); - } -diff --git a/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java b/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java -index 3e64e0d2d925f9fca1eb38cc07c20cae785ef39f..243b3d4379f4f6f273222a3611d8a463053d3e70 100644 ---- a/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java -+++ b/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java -@@ -77,4 +77,9 @@ public class DivineWorldConfig { - final Map value = DivineConfig.getMap("world-settings." + worldName + "." + path, null); - return value.isEmpty() ? fallback : value; - } -+ -+ public boolean saveFireworks = false; -+ private void saveFireworks() { -+ saveFireworks = getBoolean("gameplay-mechanics.should-save-fireworks", saveFireworks); -+ } - } diff --git a/patches/server/0021-Remove-Spigot-tick-limiter.patch b/patches/server/0021-Remove-Spigot-tick-limiter.patch deleted file mode 100644 index 9f1eb7e..0000000 --- a/patches/server/0021-Remove-Spigot-tick-limiter.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> -Date: Fri, 31 Mar 2023 23:05:12 +0300 -Subject: [PATCH] Remove Spigot tick limiter - -Original code by Titaniumtown, modified by NONPLAYT -You can find the original code on https://gitlab.com/Titaniumtown/JettPack - -diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index d152815ed2b12334458eba1eb88171d563169e84..4ce5cf4f5e2974e3d87514aee920d296a973938e 100644 ---- a/src/main/java/net/minecraft/world/level/Level.java -+++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -178,8 +178,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl - public final org.purpurmc.purpur.PurpurWorldConfig purpurConfig; // Purpur - Purpur config files - public final space.bxteam.divinemc.configuration.DivineWorldConfig divinemcConfig; // DivineMC - public static BlockPos lastPhysicsProblem; // Spigot -- private org.spigotmc.TickLimiter entityLimiter; -- private org.spigotmc.TickLimiter tileLimiter; - private int tileTickPosition; - public final Map explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions - public java.util.ArrayDeque redstoneUpdateInfos; // Paper - Faster redstone torch rapid clock removal; Move from Map in BlockRedstoneTorch to here -@@ -966,8 +964,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl - public void onBorderSetDamageSafeZOne(WorldBorder border, double safeZoneRadius) {} - }); - // CraftBukkit end -- this.entityLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.entityMaxTickTime); -- this.tileLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.tileMaxTickTime); - this.chunkPacketBlockController = this.paperConfig().anticheat.antiXray.enabled ? new com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray(this, executor) : com.destroystokyo.paper.antixray.ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray - this.entityLookup = new ca.spottedleaf.moonrise.patches.chunk_system.level.entity.dfl.DefaultEntityLookup(this); // Paper - rewrite chunk system - } -diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 0e6b697c6e8503beeed9412abddad2b512246b37..c8c0b7f092886bf50fc9d07df974ec32e95b27e2 100644 ---- a/src/main/java/org/spigotmc/SpigotWorldConfig.java -+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java -@@ -454,6 +454,7 @@ public class SpigotWorldConfig - this.hangingTickFrequency = this.getInt( "hanging-tick-frequency", 200 ); // DivineMC - optimize default values for configs - } - -+ /* DivineMC - remove tick limiter - public int tileMaxTickTime; - public int entityMaxTickTime; - private void maxTickTimes() -@@ -462,6 +463,7 @@ public class SpigotWorldConfig - this.entityMaxTickTime = this.getInt("max-tick-time.entity", 50); - this.log("Tile Max Tick Time: " + this.tileMaxTickTime + "ms Entity max Tick Time: " + this.entityMaxTickTime + "ms"); - } -+ */ - - public int thunderChance; - private void thunderChance() -diff --git a/src/main/java/org/spigotmc/TickLimiter.java b/src/main/java/org/spigotmc/TickLimiter.java -deleted file mode 100644 -index 4074538ea6090bf99d8ab04b1e98c2832a0e9a98..0000000000000000000000000000000000000000 ---- a/src/main/java/org/spigotmc/TickLimiter.java -+++ /dev/null -@@ -1,20 +0,0 @@ --package org.spigotmc; -- --public class TickLimiter { -- -- private final int maxTime; -- private long startTime; -- -- public TickLimiter(int maxtime) { -- this.maxTime = maxtime; -- } -- -- public void initTick() { -- this.startTime = System.currentTimeMillis(); -- } -- -- public boolean shouldContinue() { -- long remaining = System.currentTimeMillis() - this.startTime; -- return remaining < this.maxTime; -- } --} diff --git a/patches/server/0022-Make-entity-goals-public.patch b/patches/server/0022-Make-entity-goals-public.patch deleted file mode 100644 index 006e3d4..0000000 --- a/patches/server/0022-Make-entity-goals-public.patch +++ /dev/null @@ -1,139 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> -Date: Sun, 16 Jul 2023 11:37:32 +0300 -Subject: [PATCH] Make entity goals public - - -diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java -index d2ac2c3a2481ee216a491333b173625da3881737..98ae165bba22390b098f8a96d1e513f72ef71224 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/Bee.java -+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java -@@ -813,7 +813,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { - return state.is(BlockTags.BEE_ATTRACTIVE) ? ((Boolean) state.getValueOrElse(BlockStateProperties.WATERLOGGED, false) ? false : (state.is(Blocks.SUNFLOWER) ? state.getValue(DoublePlantBlock.HALF) == DoubleBlockHalf.UPPER : true)) : false; - } - -- private class BeeLookControl extends org.purpurmc.purpur.controller.LookControllerWASD { // Purpur - Ridables -+ public class BeeLookControl extends org.purpurmc.purpur.controller.LookControllerWASD { // Purpur - Ridables // DivineMC - private -> public - - BeeLookControl(final Mob entity) { - super(entity); -@@ -849,7 +849,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { - } - } - -- private class BeeEnterHiveGoal extends Bee.BaseBeeGoal { -+ public class BeeEnterHiveGoal extends Bee.BaseBeeGoal { // DivineMC - private -> public - - BeeEnterHiveGoal() { - super(); -@@ -954,7 +954,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { - } - } - -- private class BeePollinateGoal extends Bee.BaseBeeGoal { -+ public class BeePollinateGoal extends Bee.BaseBeeGoal { // DivineMC - private -> public - - private static final int MIN_POLLINATION_TICKS = 400; - private static final double ARRIVAL_THRESHOLD = 0.1D; -@@ -1133,7 +1133,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { - } - } - -- private class BeeLocateHiveGoal extends Bee.BaseBeeGoal { -+ public class BeeLocateHiveGoal extends Bee.BaseBeeGoal { // DivineMC - private -> public - - BeeLocateHiveGoal() { - super(); -@@ -1362,7 +1362,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { - } - } - -- private class BeeGrowCropGoal extends Bee.BaseBeeGoal { -+ public class BeeGrowCropGoal extends Bee.BaseBeeGoal { // DivineMC - private -> public - - static final int GROW_CHANCE = 30; - -@@ -1431,7 +1431,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { - } - } - -- private class BeeWanderGoal extends Goal { -+ public class BeeWanderGoal extends Goal { // DivineMC - private -> public - - BeeWanderGoal() { - this.setFlags(EnumSet.of(Goal.Flag.MOVE)); -@@ -1482,7 +1482,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { - } - } - -- private class BeeHurtByOtherGoal extends HurtByTargetGoal { -+ public class BeeHurtByOtherGoal extends HurtByTargetGoal { // DivineMC - private -> public - - BeeHurtByOtherGoal(final Bee entitybee) { - super(entitybee); -@@ -1502,7 +1502,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { - } - } - -- private static class BeeBecomeAngryTargetGoal extends NearestAttackableTargetGoal { -+ public static class BeeBecomeAngryTargetGoal extends NearestAttackableTargetGoal { // DivineMC - private -> public - - BeeBecomeAngryTargetGoal(Bee bee) { - // Objects.requireNonNull(entitybee); // CraftBukkit - decompile error -@@ -1533,7 +1533,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { - } - } - -- private abstract class BaseBeeGoal extends Goal { -+ public abstract class BaseBeeGoal extends Goal { // DivineMC - private -> public - - BaseBeeGoal() {} - -diff --git a/src/main/java/net/minecraft/world/entity/animal/Cat.java b/src/main/java/net/minecraft/world/entity/animal/Cat.java -index 5a3348ca39b86cfea941fdfb98ca90a7a0ef908d..e70adf4228d6be6f10d9cfea3762f292a2bc31ce 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/Cat.java -+++ b/src/main/java/net/minecraft/world/entity/animal/Cat.java -@@ -578,7 +578,7 @@ public class Cat extends TamableAnimal implements VariantHolder public - - private final Cat cat; - @Nullable -@@ -716,7 +716,7 @@ public class Cat extends TamableAnimal implements VariantHolder extends AvoidEntityGoal { -+ public static class CatAvoidEntityGoal extends AvoidEntityGoal { // DivineMC - private -> public - - private final Cat cat; - -diff --git a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java -index 3d1cb875edfe6bf5c9e3f4b7dade7868b7dbfa93..05326f8618626e953c2799089a69803e73b11da7 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java -+++ b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java -@@ -99,7 +99,7 @@ public class Vindicator extends AbstractIllager { - this.goalSelector.addGoal(1, new AvoidEntityGoal<>(this, Creaking.class, 8.0F, 1.0, 1.2)); - this.goalSelector.addGoal(2, new Vindicator.VindicatorBreakDoorGoal(this)); - this.goalSelector.addGoal(3, new AbstractIllager.RaiderOpenDoorGoal(this)); -- this.goalSelector.addGoal(4, new Raider.HoldGroundAttackGoal(this, 10.0F)); -+ this.goalSelector.addGoal(4, new HoldGroundAttackGoal(this, 10.0F)); - this.goalSelector.addGoal(5, new MeleeAttackGoal(this, 1.0, false)); - this.targetSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur - Ridables - this.targetSelector.addGoal(1, new HurtByTargetGoal(this, Raider.class).setAlertOthers()); -diff --git a/src/main/java/net/minecraft/world/entity/raid/Raider.java b/src/main/java/net/minecraft/world/entity/raid/Raider.java -index 65206bc0c3276fda449936cae88cc819a346e299..2121ef972ce586b627c8adbfbcac0393a76b11cb 100644 ---- a/src/main/java/net/minecraft/world/entity/raid/Raider.java -+++ b/src/main/java/net/minecraft/world/entity/raid/Raider.java -@@ -381,7 +381,7 @@ public abstract class Raider extends PatrollingMonster { - } - } - -- private static class RaiderMoveThroughVillageGoal extends Goal { -+ public class RaiderMoveThroughVillageGoal extends Goal { // DivineMC - private -> public - - private final Raider raider; - private final double speedModifier; diff --git a/patches/server/0023-Fix-sprint-glitch.patch b/patches/server/0023-Fix-sprint-glitch.patch deleted file mode 100644 index dd3ec96..0000000 --- a/patches/server/0023-Fix-sprint-glitch.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> -Date: Sun, 12 May 2024 21:26:38 +0300 -Subject: [PATCH] Fix sprint glitch - - -diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index a850484f2c6f37a39a4cf8cc61683fed4f6f273e..8096e094381062f26172eb1758ee18fda61ca961 100644 ---- a/src/main/java/net/minecraft/world/entity/LivingEntity.java -+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -1474,7 +1474,7 @@ public abstract class LivingEntity extends Entity implements Attackable { - player.setRealHealth(health); - } - -- player.updateScaledHealth(false); -+ this.entityData.set(LivingEntity.DATA_HEALTH_ID, player.getScaledHealth()); // DivineMC - Fix sprint glitch - return; - } - // CraftBukkit end