9
0
mirror of https://github.com/BX-Team/DivineMC.git synced 2025-12-23 16:59:24 +00:00

33/50 patches

This commit is contained in:
NONPLAYT
2024-06-17 16:02:53 +03:00
parent c9f37aacfe
commit 20484be678
10 changed files with 80 additions and 522 deletions

View File

@@ -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 6671796d292fbc922a94271136f5a7a4bbdedaca..768daecf46aa77089ed7e0c4b0f5cfbf479d8d4e 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
@@ -345,6 +345,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<String, Object> 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);
+ }
}

View File

@@ -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 63629a36572cd83977886c016084fd5ebefab65c..0d2cc738559e8b241539b49a35195291e78a54f2 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -176,8 +176,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public final DivineWorldConfig divinemcConfig; // DivineMC
public final co.aikar.timings.WorldTimingsHandler timings; // Paper
public static BlockPos lastPhysicsProblem; // Spigot
- private org.spigotmc.TickLimiter entityLimiter;
- private org.spigotmc.TickLimiter tileLimiter;
private int tileTickPosition;
public final Map<Explosion.CacheKey, Float> explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions
public java.util.ArrayDeque<net.minecraft.world.level.block.RedstoneTorchBlock.Toggle> redstoneUpdateInfos; // Paper - Faster redstone torch rapid clock removal; Move from Map in BlockRedstoneTorch to here
@@ -334,8 +332,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
});
// CraftBukkit end
this.timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings
- 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
// Paper start - optimise collisions
this.minSection = io.papermc.paper.util.WorldUtil.getMinSection(this);
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
index f9ba24d32f4170c641e420991e6c358f6bd91be2..8b6de4295172dfa7eb33a20a822923e7a4954812 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
@@ -452,6 +452,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()
@@ -460,6 +461,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;
- }
-}

View File

@@ -1,76 +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:01:08 +0300
Subject: [PATCH] Boat Settings
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
index 13e1c7594bf304b35ce8dcab2951329c527d7dea..efb2fac41a546ba312f4925f206f0975a0336406 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
@@ -331,7 +331,18 @@ public class Boat extends VehicleEntity implements VariantHolder<Boat.Type> {
}
if (!this.level().isClientSide && this.outOfControlTicks >= 60.0F) {
- this.ejectPassengers();
+ // DivineMC start - Don't eject players
+ if (this.level().divinemcConfig.dontEjectPlayerFromBoatUnderwater) {
+ for (int i = this.passengers.size() - 1; i >= 0; --i) {
+ Entity passenger = this.passengers.get(i);
+ if (!(passenger instanceof Player)) {
+ passenger.stopRiding();
+ }
+ }
+ } else {
+ this.ejectPassengers();
+ }
+ // DivineMC end
}
if (this.getHurtTime() > 0) {
@@ -850,7 +861,13 @@ public class Boat extends VehicleEntity implements VariantHolder<Boat.Type> {
@Override
public InteractionResult interact(Player player, InteractionHand hand) {
- return player.isSecondaryUseActive() ? InteractionResult.PASS : (this.outOfControlTicks < 60.0F ? (!this.level().isClientSide ? (player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS) : InteractionResult.SUCCESS) : InteractionResult.PASS);
+ // DivineMC start - always allow to enter the boat
+ if (this.level().divinemcConfig.alwaysAllowToEnterTheBoat) {
+ return player.isSecondaryUseActive() ? InteractionResult.PASS : (true || this.outOfControlTicks < 60.0F ? (!this.level().isClientSide ? (player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS) : InteractionResult.SUCCESS) : InteractionResult.PASS);
+ } else {
+ return player.isSecondaryUseActive() ? InteractionResult.PASS : (this.outOfControlTicks < 60.0F ? (!this.level().isClientSide ? (player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS) : InteractionResult.SUCCESS) : InteractionResult.PASS);
+ }
+ // DivineMC end
}
@Override
@@ -922,7 +939,13 @@ public class Boat extends VehicleEntity implements VariantHolder<Boat.Type> {
@Override
protected boolean canAddPassenger(Entity passenger) {
- return this.getPassengers().size() < this.getMaxPassengers() && !this.isEyeInFluid(FluidTags.WATER);
+ // DivineMC start - always allow to enter the boat
+ if (this.level().divinemcConfig.alwaysAllowToEnterTheBoat) {
+ return this.getPassengers().size() < this.getMaxPassengers()/* && !this.isEyeInFluid(FluidTags.WATER)*/;
+ } else {
+ return this.getPassengers().size() < this.getMaxPassengers() && !this.isEyeInFluid(FluidTags.WATER);
+ }
+ // DivineMC end
}
protected int getMaxPassengers() {
diff --git a/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java b/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java
index 243b3d4379f4f6f273222a3611d8a463053d3e70..e1274fe3b0ff369d1f6f229026ced2e03ea335ca 100644
--- a/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java
+++ b/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java
@@ -82,4 +82,11 @@ public class DivineWorldConfig {
private void saveFireworks() {
saveFireworks = getBoolean("gameplay-mechanics.should-save-fireworks", saveFireworks);
}
+
+ public boolean dontEjectPlayerFromBoatUnderwater = true;
+ public boolean alwaysAllowToEnterTheBoat = true;
+ private void boatFeatures() {
+ dontEjectPlayerFromBoatUnderwater = getBoolean("gameplay-mechanics.boat.dont-eject-players-from-boat-underwater", dontEjectPlayerFromBoatUnderwater);
+ alwaysAllowToEnterTheBoat = getBoolean("gameplay-mechanics.boat.always-allow-to-enter-the-boat", alwaysAllowToEnterTheBoat);
+ }
}

View File

@@ -1,42 +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:12:59 +0300
Subject: [PATCH] Despawn shulker bullets on owner death
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ShulkerBullet.java b/src/main/java/net/minecraft/world/entity/projectile/ShulkerBullet.java
index 8242d0f292120be6cf3d6dcec2820a35809d83dd..4404b39d0777b314797ef86efdb996464c6200a9 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/ShulkerBullet.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/ShulkerBullet.java
@@ -225,6 +225,17 @@ public class ShulkerBullet extends Projectile {
Vec3 vec3d;
if (!this.level().isClientSide) {
+ // DivineMC start - despawn shulker bullets on owner death
+ if (this.level().divinemcConfig.despawnShulkerBulletsOnOwnerDeath) {
+ if (!isInvulnerable()) {
+ var owner = getOwner();
+ if (owner == null || !owner.isAlive()) {
+ discard();
+ return;
+ }
+ }
+ }
+ // DivineMC end
if (this.finalTarget == null && this.targetId != null) {
this.finalTarget = ((ServerLevel) this.level()).getEntity(this.targetId);
if (this.finalTarget == null) {
diff --git a/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java b/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java
index e1274fe3b0ff369d1f6f229026ced2e03ea335ca..7e62ee9418d5add5b0b4ddb885d3a1745ce799b2 100644
--- a/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java
+++ b/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java
@@ -89,4 +89,9 @@ public class DivineWorldConfig {
dontEjectPlayerFromBoatUnderwater = getBoolean("gameplay-mechanics.boat.dont-eject-players-from-boat-underwater", dontEjectPlayerFromBoatUnderwater);
alwaysAllowToEnterTheBoat = getBoolean("gameplay-mechanics.boat.always-allow-to-enter-the-boat", alwaysAllowToEnterTheBoat);
}
+
+ public boolean despawnShulkerBulletsOnOwnerDeath = true;
+ private void despawnShulkerBulletsOnOwnerDeath() {
+ despawnShulkerBulletsOnOwnerDeath = getBoolean("gameplay-mechanics.mob.shulker.despawn-bullets-on-player-death", despawnShulkerBulletsOnOwnerDeath);
+ }
}

View File

@@ -1,37 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
Date: Sat, 10 Jun 2023 19:43:52 +0300
Subject: [PATCH] Reduce sensor work
Original project: Bloom-host/Petal
Link: https://github.com/Bloom-host/Petal
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 66c353e3dcca3704094ec71c38219bf74e7d7fbb..8b946ed4f252c2ae881e179183559bb9aa98ea79 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1068,20 +1068,19 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
if (entity != null) {
- ItemStack itemstack = this.getItemBySlot(EquipmentSlot.HEAD);
EntityType<?> entitytypes = entity.getType();
// Purpur start
- if (entitytypes == EntityType.SKELETON && itemstack.is(Items.SKELETON_SKULL)) {
+ if (entitytypes == EntityType.SKELETON && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.SKELETON_SKULL)) { // DivineMC - Reduce sensor work
d0 *= entity.level().purpurConfig.skeletonHeadVisibilityPercent;
}
- else if (entitytypes == EntityType.ZOMBIE && itemstack.is(Items.ZOMBIE_HEAD)) {
+ else if (entitytypes == EntityType.ZOMBIE && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.ZOMBIE_HEAD)) { // DivineMC - Reduce sensor work
d0 *= entity.level().purpurConfig.zombieHeadVisibilityPercent;
}
- else if (entitytypes == EntityType.CREEPER && itemstack.is(Items.CREEPER_HEAD)) {
+ else if (entitytypes == EntityType.CREEPER && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.CREEPER_HEAD)) { // DivineMC - Reduce sensor work
d0 *= entity.level().purpurConfig.creeperHeadVisibilityPercent;
}
- else if ((entitytypes == EntityType.PIGLIN || entitytypes == EntityType.PIGLIN_BRUTE) && itemstack.is(Items.PIGLIN_HEAD)) {
+ else if ((entitytypes == EntityType.PIGLIN || entitytypes == EntityType.PIGLIN_BRUTE) && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.PIGLIN_HEAD)) { // DivineMC - Reduce sensor work
d0 *= entity.level().purpurConfig.piglinHeadVisibilityPercent;
}
// Purpur end

View File

@@ -1,41 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
Date: Sun, 25 Jun 2023 13:38:03 +0300
Subject: [PATCH] Optimize Paper Event Manager
Original project: lynxplay/ktp
Link: https://github.com/lynxplay/ktp
Modified by NONPLAYT
diff --git a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
index 7ce9ebba8ce304d1f3f21d4f15ee5f3560d7700b..0e3bed7a75f8f4611f9f44a1f78fd70cc06eaa54 100644
--- a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
+++ b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
@@ -36,14 +36,21 @@ class PaperEventManager {
// SimplePluginManager
public void callEvent(@NotNull Event event) {
- if (event.isAsynchronous() && this.server.isPrimaryThread()) {
- throw new IllegalStateException(event.getEventName() + " may only be triggered asynchronously.");
- } else if (!event.isAsynchronous() && !this.server.isPrimaryThread() && !this.server.isStopping()) {
- throw new IllegalStateException(event.getEventName() + " may only be triggered synchronously.");
- }
-
+ // DivineMC start - Optimize Paper Event Manager
HandlerList handlers = event.getHandlers();
RegisteredListener[] listeners = handlers.getRegisteredListeners();
+ if (listeners.length == 0) return;
+
+ if (event.asynchronous() != net.kyori.adventure.util.TriState.NOT_SET) {
+ final boolean onPrimaryThread = this.server.isPrimaryThread();
+ final boolean isAsync = event.isAsynchronous();
+ if (isAsync && onPrimaryThread) {
+ throw new IllegalStateException(event.getEventName() + " may only be triggered asynchronously.");
+ } else if (!isAsync && !onPrimaryThread && !this.server.isStopping()) {
+ throw new IllegalStateException(event.getEventName() + " may only be triggered synchronously.");
+ }
+ }
+ // DivineMC end
for (RegisteredListener registration : listeners) {
if (!registration.getPlugin().isEnabled()) {

View File

@@ -1,148 +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 539170813921de2dfcd7ef84dd7512d73cd27e68..b5609aae461d7b9353287d99a6ebe517e2b3b82e 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
@@ -757,7 +757,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
this.hivePos = pos;
}
- private class BeePollinateGoal extends Bee.BaseBeeGoal {
+ public class BeePollinateGoal extends Bee.BaseBeeGoal {
private static final int MIN_POLLINATION_TICKS = 400;
private static final int MIN_FIND_FLOWER_RETRY_COOLDOWN = 20;
@@ -946,7 +946,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
}
}
- private class BeeLookControl extends org.purpurmc.purpur.controller.LookControllerWASD { // Purpur
+ public class BeeLookControl extends org.purpurmc.purpur.controller.LookControllerWASD { // Purpur // DivineMC - private -> public
BeeLookControl(final Mob entity) {
super(entity);
@@ -982,7 +982,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();
@@ -1025,7 +1025,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();
@@ -1257,7 +1257,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;
@@ -1321,7 +1321,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
}
}
- private class BeeWanderGoal extends Goal {
+ public class BeeWanderGoal extends Goal { // DivineMC - private -> public
private static final int WANDER_THRESHOLD = 22;
@@ -1368,7 +1368,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);
@@ -1388,7 +1388,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
}
}
- private static class BeeBecomeAngryTargetGoal extends NearestAttackableTargetGoal<Player> {
+ public static class BeeBecomeAngryTargetGoal extends NearestAttackableTargetGoal<Player> { // DivineMC - private -> public
BeeBecomeAngryTargetGoal(Bee bee) {
// Objects.requireNonNull(entitybee); // CraftBukkit - decompile error
@@ -1419,7 +1419,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 3e1345f1c534320e07820d573f5c8dba49746425..26ddab27ac1ca1902f849f98d000ffb801610691 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Cat.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Cat.java
@@ -575,7 +575,7 @@ public class Cat extends TamableAnimal implements VariantHolder<Holder<CatVarian
}
}
- private static class CatRelaxOnOwnerGoal extends Goal {
+ public static class CatRelaxOnOwnerGoal extends Goal { // DivineMC - private -> public
private final Cat cat;
@Nullable
@@ -721,7 +721,7 @@ public class Cat extends TamableAnimal implements VariantHolder<Holder<CatVarian
}
}
- private static class CatAvoidEntityGoal<T extends LivingEntity> extends AvoidEntityGoal<T> {
+ public static class CatAvoidEntityGoal<T extends LivingEntity> extends AvoidEntityGoal<T> { // 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 e7703aa5467e7551bff06fab4c11d76237bda2e0..e5944bd3598bd82b2891f576462013a4692c1609 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
@@ -89,7 +89,7 @@ public class Vindicator extends AbstractIllager {
this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur
this.goalSelector.addGoal(1, new Vindicator.VindicatorBreakDoorGoal(this));
this.goalSelector.addGoal(2, new AbstractIllager.RaiderOpenDoorGoal(this));
- this.goalSelector.addGoal(3, new Raider.HoldGroundAttackGoal(this, 10.0F));
+ this.goalSelector.addGoal(3, new HoldGroundAttackGoal(this, 10.0F));
this.goalSelector.addGoal(4, new MeleeAttackGoal(this, 1.0, false));
this.targetSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur
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 4a8fa7e5844b5cd12ef6b113f988b715c7a3ef64..f6e89565e793d346302498c1108069d3435ab082 100644
--- a/src/main/java/net/minecraft/world/entity/raid/Raider.java
+++ b/src/main/java/net/minecraft/world/entity/raid/Raider.java
@@ -374,7 +374,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;
@@ -522,7 +522,7 @@ public abstract class Raider extends PatrollingMonster {
}
}
- public class HoldGroundAttackGoal extends Goal {
+ public static class HoldGroundAttackGoal extends Goal { // DivineMC - public -> public static
private final Raider mob;
private final float hostileRadiusSqr;

View File

@@ -1,68 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
Date: Wed, 17 Apr 2024 02:02:02 +0300
Subject: [PATCH] Snowball and Egg knockback
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Snowball.java b/src/main/java/net/minecraft/world/entity/projectile/Snowball.java
index 1b9d0e28e518c501b4b93ae385ddd64aeade97d5..373ad51fc22e8ecd362297561184ef9e7c48fc41 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/Snowball.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/Snowball.java
@@ -3,6 +3,7 @@ package net.minecraft.world.entity.projectile;
import net.minecraft.core.particles.ItemParticleOption;
import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.core.particles.ParticleTypes;
+import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
@@ -61,6 +62,13 @@ public class Snowball extends ThrowableItemProjectile {
int i = entity.level().purpurConfig.snowballDamage >= 0 ? entity.level().purpurConfig.snowballDamage : entity instanceof Blaze ? 3 : 0; // Purpur
entity.hurt(this.damageSources().thrown(this, this.getOwner()), (float) i);
+
+ // DivineMC start - Snowball and Egg knockback
+ if (this.level().divinemcConfig.snowballCanKnockback && entity instanceof ServerPlayer) {
+ entity.hurt(this.damageSources().thrown(this, this.getOwner()), 0.0000001F);
+ ((ServerPlayer) entity).knockback(0.4000000059604645D, this.getX() - entity.getX(), this.getZ() - entity.getZ(), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.DAMAGE);
+ }
+ // DivineMC end
}
// Purpur start - borrowed and modified code from ThrownPotion#onHitBlock and ThrownPotion#dowseFire
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java
index 82bb8004635865f5202578d5a6f520048e7269d5..e7a95a87378b9fb785d99dff2fd2d5ddb3fdd5b8 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java
@@ -46,7 +46,15 @@ public class ThrownEgg extends ThrowableItemProjectile {
@Override
protected void onHitEntity(EntityHitResult entityHitResult) {
super.onHitEntity(entityHitResult);
+ Entity entity = entityHitResult.getEntity(); // DivineMC
entityHitResult.getEntity().hurt(this.damageSources().thrown(this, this.getOwner()), 0.0F);
+
+ // DivineMC start - Snowball and Egg knockback
+ if (this.level().divinemcConfig.eggCanKnockback && entity instanceof ServerPlayer) {
+ entity.hurt(this.damageSources().thrown(this, this.getOwner()), 0.0000001F);
+ ((ServerPlayer) entity).knockback(0.4000000059604645D, this.getX() - entity.getX(), this.getZ() - entity.getZ(), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.DAMAGE);
+ }
+ // DivineMC end
}
@Override
diff --git a/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java b/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java
index 7e62ee9418d5add5b0b4ddb885d3a1745ce799b2..242da697c957508c8e75bfd232c44ea34ba3a62a 100644
--- a/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java
+++ b/src/main/java/space/bxteam/divinemc/configuration/DivineWorldConfig.java
@@ -94,4 +94,11 @@ public class DivineWorldConfig {
private void despawnShulkerBulletsOnOwnerDeath() {
despawnShulkerBulletsOnOwnerDeath = getBoolean("gameplay-mechanics.mob.shulker.despawn-bullets-on-player-death", despawnShulkerBulletsOnOwnerDeath);
}
+
+ public boolean snowballCanKnockback = true;
+ public boolean eggCanKnockback = true;
+ private void setSnowballAndEggKnockback() {
+ snowballCanKnockback = getBoolean("gameplay-mechanics.projectiles.snowball.knockback", snowballCanKnockback);
+ eggCanKnockback = getBoolean("gameplay-mechanics.projectiles.egg.knockback", eggCanKnockback);
+ }
}

File diff suppressed because it is too large Load Diff

View File

@@ -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 4a224af1a9063e1617bc6753e063e8e395271ec7..6541fbb1ba6bfb9c2ea207e81049d5062d7d5848 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1452,7 +1452,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