mirror of
https://github.com/BX-Team/DivineMC.git
synced 2026-01-04 15:31:43 +00:00
add some patches
This commit is contained in:
@@ -374,6 +374,34 @@ index ec90ea4e66c6c38d7ad41805a16c63e006e44be4..0204fe68c97d152a7c3201620b6709a8
|
||||
|
||||
private boolean isAcceptableLandingPosition(ServerLevel level, E entity, BlockPos pos) {
|
||||
BlockPos blockPos = entity.blockPosition();
|
||||
diff --git a/net/minecraft/world/entity/ai/sensing/VillagerBabiesSensor.java b/net/minecraft/world/entity/ai/sensing/VillagerBabiesSensor.java
|
||||
index 24d1928445b5571e040a2b12d5c82e77a880d9bd..dac0a23aebf2dea1972c07d5c82079da7c9837ac 100644
|
||||
--- a/net/minecraft/world/entity/ai/sensing/VillagerBabiesSensor.java
|
||||
+++ b/net/minecraft/world/entity/ai/sensing/VillagerBabiesSensor.java
|
||||
@@ -21,9 +21,22 @@ public class VillagerBabiesSensor extends Sensor<LivingEntity> {
|
||||
entity.getBrain().setMemory(MemoryModuleType.VISIBLE_VILLAGER_BABIES, this.getNearestVillagerBabies(entity));
|
||||
}
|
||||
|
||||
+ // DivineMC start - Optimize baby villager sensor
|
||||
private List<LivingEntity> getNearestVillagerBabies(LivingEntity livingEntity) {
|
||||
- return ImmutableList.copyOf(this.getVisibleEntities(livingEntity).findAll(this::isVillagerBaby));
|
||||
+ NearestVisibleLivingEntities visibleEntities = this.getVisibleEntities(livingEntity);
|
||||
+ ImmutableList.Builder<LivingEntity> babies = ImmutableList.builder();
|
||||
+
|
||||
+ for (LivingEntity target : visibleEntities.nearbyEntities) {
|
||||
+ if (target.getType() == EntityType.VILLAGER
|
||||
+ && target.isBaby()
|
||||
+ && visibleEntities.lineOfSightTest.test(target)) {
|
||||
+ babies.add(target);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return babies.build();
|
||||
}
|
||||
+ // DivineMC end - Optimize baby villager sensor
|
||||
|
||||
private boolean isVillagerBaby(LivingEntity livingEntity) {
|
||||
return livingEntity.getType() == EntityType.VILLAGER && livingEntity.isBaby();
|
||||
diff --git a/net/minecraft/world/entity/animal/goat/Goat.java b/net/minecraft/world/entity/animal/goat/Goat.java
|
||||
index 6f106f10466440f8e65e04511f67d48f082d703f..15728d4fbe7a12c7a3b94a9ef88e7141b1225fa3 100644
|
||||
--- a/net/minecraft/world/entity/animal/goat/Goat.java
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 23 Feb 2025 01:03:59 +0300
|
||||
Subject: [PATCH] Configurable MC-67
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index 356a1bfc610214912f58c4126cdd5694ffecfcb8..55bde2487078d0c7dcb3a367d070838770fc0f4e 100644
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -4020,6 +4020,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
}
|
||||
|
||||
public boolean canTeleport(Level fromLevel, Level toLevel) {
|
||||
+ if (!fromLevel.divineConfig.allowEntityPortalWithPassenger && (this.isPassenger() || this.isVehicle())) return false; // DivineMC - Allow entity teleport with passenger
|
||||
if (!this.isAlive() || !this.valid) return false; // Paper - Fix item duplication and teleport issues
|
||||
if (fromLevel.dimension() == Level.END && toLevel.dimension() == Level.OVERWORLD) {
|
||||
for (Entity entity : this.getPassengers()) {
|
||||
@@ -0,0 +1,44 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 23 Feb 2025 01:04:29 +0300
|
||||
Subject: [PATCH] Option to disable saving of snowball and firework
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/projectile/FireworkRocketEntity.java b/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
|
||||
index 774ca9e0b56fd175ae246051de762d0c4256ca58..3a380d038ef1231624a646c38b60a4344694e321 100644
|
||||
--- a/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
|
||||
+++ b/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
|
||||
@@ -364,4 +364,14 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier {
|
||||
double d1 = entity.position().z - this.position().z;
|
||||
return DoubleDoubleImmutablePair.of(d, d1);
|
||||
}
|
||||
+
|
||||
+ // DivineMC start - Option to disable saving firework
|
||||
+ @Override
|
||||
+ public boolean shouldBeSaved() {
|
||||
+ if (this.level().divineConfig.disableFireworkSaving) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ return super.shouldBeSaved();
|
||||
+ }
|
||||
+ // DivineMC end - Option to disable saving firework
|
||||
}
|
||||
diff --git a/net/minecraft/world/entity/projectile/Snowball.java b/net/minecraft/world/entity/projectile/Snowball.java
|
||||
index cad1f8cb68ef9615587e651a3120f68a3c32add0..18298f3ba544e07110ea8d5b15ae753f7e3de65a 100644
|
||||
--- a/net/minecraft/world/entity/projectile/Snowball.java
|
||||
+++ b/net/minecraft/world/entity/projectile/Snowball.java
|
||||
@@ -100,4 +100,14 @@ public class Snowball extends ThrowableItemProjectile {
|
||||
this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause
|
||||
}
|
||||
}
|
||||
+
|
||||
+ // DivineMC start - Option to disable snowball saving
|
||||
+ @Override
|
||||
+ public boolean shouldBeSaved() {
|
||||
+ if (this.level().divineConfig.disableSnowballSaving) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ return super.shouldBeSaved();
|
||||
+ }
|
||||
+ // DivineMC end - Option to disable snowball saving
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 23 Feb 2025 01:14:54 +0300
|
||||
Subject: [PATCH] Catch update suppressors
|
||||
|
||||
|
||||
diff --git a/net/minecraft/network/protocol/PacketUtils.java b/net/minecraft/network/protocol/PacketUtils.java
|
||||
index 4535858701b2bb232b9d2feb2af6551526232ddc..aa4dd7517e8be167aef1eaf7aa907e3ce7cc0e62 100644
|
||||
--- a/net/minecraft/network/protocol/PacketUtils.java
|
||||
+++ b/net/minecraft/network/protocol/PacketUtils.java
|
||||
@@ -27,6 +27,10 @@ public class PacketUtils {
|
||||
if (processor.shouldHandleMessage(packet)) {
|
||||
try {
|
||||
packet.handle(processor);
|
||||
+ // DivineMC start - Catch update suppressors
|
||||
+ } catch (org.bxteam.divinemc.util.exception.UpdateSuppressorException e) {
|
||||
+ LOGGER.info(e.getMessage());
|
||||
+ // DivineMC end - Catch update suppressors
|
||||
} catch (Exception var4) {
|
||||
if (var4 instanceof ReportedException reportedException && reportedException.getCause() instanceof OutOfMemoryError) {
|
||||
throw makeReportedException(var4, packet, processor);
|
||||
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
||||
index b7815831ff1a2fa9aa52e96f1a50a5aa6823ff8a..85f81c83aff81133289a03f12a059729b7d2e00e 100644
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1789,6 +1789,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
serverLevel.tickTimes10s.add(this.tickCount, j);
|
||||
serverLevel.tickTimes60s.add(this.tickCount, j);
|
||||
// DivineMC end - MSPT Tracking for each world
|
||||
+ // DivineMC start - Catch update suppressors
|
||||
+ } catch (org.bxteam.divinemc.util.exception.UpdateSuppressorException e) {
|
||||
+ LOGGER.info(e.getMessage());
|
||||
+ // DivineMC end - Catch update suppressors
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Exception ticking world");
|
||||
|
||||
diff --git a/net/minecraft/world/level/block/ShulkerBoxBlock.java b/net/minecraft/world/level/block/ShulkerBoxBlock.java
|
||||
index cdf835ff107bc1eadde706d69384e687626fce70..c04c66668395fa9167e027131daf75c0e9ee6eff 100644
|
||||
--- a/net/minecraft/world/level/block/ShulkerBoxBlock.java
|
||||
+++ b/net/minecraft/world/level/block/ShulkerBoxBlock.java
|
||||
@@ -234,7 +234,17 @@ public class ShulkerBoxBlock extends BaseEntityBlock {
|
||||
|
||||
@Override
|
||||
protected int getAnalogOutputSignal(BlockState blockState, Level level, BlockPos pos) {
|
||||
- return AbstractContainerMenu.getRedstoneSignalFromBlockEntity(level.getBlockEntity(pos));
|
||||
+ // DivineMC start - Catch update suppressors
|
||||
+ try {
|
||||
+ return AbstractContainerMenu.getRedstoneSignalFromBlockEntity(level.getBlockEntity(pos));
|
||||
+ } catch (ClassCastException ex) {
|
||||
+ if (org.bxteam.divinemc.DivineConfig.updateSuppressionCrashFix) {
|
||||
+ throw new org.bxteam.divinemc.util.exception.UpdateSuppressorException(pos, this);
|
||||
+ } else {
|
||||
+ throw ex;
|
||||
+ }
|
||||
+ }
|
||||
+ // DivineMC end - Catch update suppressors
|
||||
}
|
||||
|
||||
public static Block getBlockByColor(@Nullable DyeColor color) {
|
||||
diff --git a/net/minecraft/world/level/redstone/NeighborUpdater.java b/net/minecraft/world/level/redstone/NeighborUpdater.java
|
||||
index 26c15c60d358273a3b369c286771c81d6f0979dd..94fde31891e9f549ca356955913385cbaad02dca 100644
|
||||
--- a/net/minecraft/world/level/redstone/NeighborUpdater.java
|
||||
+++ b/net/minecraft/world/level/redstone/NeighborUpdater.java
|
||||
@@ -63,9 +63,19 @@ public interface NeighborUpdater {
|
||||
state.handleNeighborChanged(level, pos, neighborBlock, orientation, movedByPiston);
|
||||
// Spigot start
|
||||
} catch (StackOverflowError ex) {
|
||||
+ // DivineMC start - Catch update suppressors
|
||||
+ if (org.bxteam.divinemc.DivineConfig.updateSuppressionCrashFix) {
|
||||
+ throw new org.bxteam.divinemc.util.exception.UpdateSuppressorException(pos, neighborBlock);
|
||||
+ }
|
||||
+ // DivineMC end - Catch update suppressors
|
||||
level.lastPhysicsProblem = new BlockPos(pos);
|
||||
// Spigot end
|
||||
} catch (Throwable var9) {
|
||||
+ // DivineMC start - Catch update suppressors
|
||||
+ if (org.bxteam.divinemc.DivineConfig.updateSuppressionCrashFix) {
|
||||
+ throw new org.bxteam.divinemc.util.exception.UpdateSuppressorException(pos, neighborBlock);
|
||||
+ }
|
||||
+ // DivineMC end - Catch update suppressors
|
||||
CrashReport crashReport = CrashReport.forThrowable(var9, "Exception while updating neighbours");
|
||||
CrashReportCategory crashReportCategory = crashReport.addCategory("Block being updated");
|
||||
crashReportCategory.setDetail(
|
||||
Reference in New Issue
Block a user