-
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0fa0521
commit 8623381
Showing
7 changed files
with
250 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: violetc <[email protected]> | ||
Date: Thu, 20 Jul 2023 20:22:47 +0800 | ||
Subject: [PATCH] Optimized CubePointRange | ||
|
||
This patch is Powered by Gale(https://github.com/GaleMC/Gale) | ||
|
||
diff --git a/src/main/java/net/minecraft/world/phys/shapes/CubePointRange.java b/src/main/java/net/minecraft/world/phys/shapes/CubePointRange.java | ||
index a544db042c8d2ecec8d323770552c4f10ca758a6..81d18ce2ee4342b466c6623bcad7840c929eb79d 100644 | ||
--- a/src/main/java/net/minecraft/world/phys/shapes/CubePointRange.java | ||
+++ b/src/main/java/net/minecraft/world/phys/shapes/CubePointRange.java | ||
@@ -3,21 +3,31 @@ package net.minecraft.world.phys.shapes; | ||
import it.unimi.dsi.fastutil.doubles.AbstractDoubleList; | ||
|
||
public class CubePointRange extends AbstractDoubleList { | ||
+ private final int size; // Leaves - replace parts by size in CubePointRange | ||
private final int parts; | ||
+ private final double scale; // Leaves - replace division by multiplication in CubePointRange | ||
|
||
CubePointRange(int sectionCount) { | ||
if (sectionCount <= 0) { | ||
throw new IllegalArgumentException("Need at least 1 part"); | ||
} else { | ||
this.parts = sectionCount; | ||
+ this.size = sectionCount + 1; | ||
} | ||
+ this.scale = 1.0D / sectionCount; // Leaves - replace division by multiplication in CubePointRange | ||
} | ||
|
||
public double getDouble(int i) { | ||
- return (double)i / (double)this.parts; | ||
+ // Leaves start - replace division by multiplication in CubePointRange | ||
+ if (!top.leavesmc.leaves.LeavesConfig.optimizedCubePointRange) { | ||
+ return (double)i / (double)this.parts; | ||
+ } else { | ||
+ return i * this.scale; | ||
+ } | ||
+ // Leaves start - replace division by multiplication in CubePointRange | ||
} | ||
|
||
public int size() { | ||
- return this.parts + 1; | ||
+ return !top.leavesmc.leaves.LeavesConfig.optimizedCubePointRange ? this.parts + 1 : size; // Leaves - replace parts by size in CubePointRange | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
patches/server/0105-Check-frozen-ticks-before-landing-block.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: violetc <[email protected]> | ||
Date: Thu, 20 Jul 2023 20:33:52 +0800 | ||
Subject: [PATCH] Check frozen ticks before landing block | ||
|
||
This patch is Powered by Gale(https://github.com/GaleMC/Gale) | ||
|
||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java | ||
index 94179dafe22403b4aaa6adcff879b459a073ad09..a930062bd4a43df7f74d92ab8a178f13528204d8 100644 | ||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java | ||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java | ||
@@ -583,11 +583,11 @@ public abstract class LivingEntity extends Entity implements Attackable { | ||
} | ||
|
||
protected void tryAddFrost() { | ||
- if (!this.getBlockStateOnLegacy().isAir()) { | ||
+ if (top.leavesmc.leaves.LeavesConfig.checkFrozenTicksBeforeLandingBlock || !this.getBlockStateOnLegacy().isAir()) { // Leaves - check frozen ticks before landing block | ||
int i = this.getTicksFrozen(); | ||
|
||
if (i > 0) { | ||
- AttributeInstance attributemodifiable = this.getAttribute(Attributes.MOVEMENT_SPEED); | ||
+ AttributeInstance attributemodifiable = !top.leavesmc.leaves.LeavesConfig.checkFrozenTicksBeforeLandingBlock || !this.getBlockStateOnLegacy().isAir() ? this.getAttribute(Attributes.MOVEMENT_SPEED) : null; // Leaves - check frozen ticks before landing block | ||
|
||
if (attributemodifiable == null) { | ||
return; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: violetc <[email protected]> | ||
Date: Thu, 20 Jul 2023 21:02:10 +0800 | ||
Subject: [PATCH] Cache ominous banner item | ||
|
||
This patch is Powered by Gale(https://github.com/GaleMC/Gale) | ||
|
||
diff --git a/src/main/java/net/minecraft/advancements/critereon/EntityEquipmentPredicate.java b/src/main/java/net/minecraft/advancements/critereon/EntityEquipmentPredicate.java | ||
index b8ef0f9c815799d54edcdb26dc0b4c1c281fc03e..85ccff2938dc138e5d309448cd631fe534effd42 100644 | ||
--- a/src/main/java/net/minecraft/advancements/critereon/EntityEquipmentPredicate.java | ||
+++ b/src/main/java/net/minecraft/advancements/critereon/EntityEquipmentPredicate.java | ||
@@ -13,7 +13,7 @@ import net.minecraft.world.item.Items; | ||
|
||
public class EntityEquipmentPredicate { | ||
public static final EntityEquipmentPredicate ANY = new EntityEquipmentPredicate(ItemPredicate.ANY, ItemPredicate.ANY, ItemPredicate.ANY, ItemPredicate.ANY, ItemPredicate.ANY, ItemPredicate.ANY); | ||
- public static final EntityEquipmentPredicate CAPTAIN = new EntityEquipmentPredicate(ItemPredicate.Builder.item().of(Items.WHITE_BANNER).hasNbt(Raid.getLeaderBannerInstance().getTag()).build(), ItemPredicate.ANY, ItemPredicate.ANY, ItemPredicate.ANY, ItemPredicate.ANY, ItemPredicate.ANY); | ||
+ public static final EntityEquipmentPredicate CAPTAIN = new EntityEquipmentPredicate(ItemPredicate.Builder.item().of(Items.WHITE_BANNER).hasNbt(top.leavesmc.leaves.LeavesConfig.cacheOminousBannerItem ? Raid.LEADER_BANNER.getTag() : Raid.getLeaderBannerInstance().getTag()).build(), ItemPredicate.ANY, ItemPredicate.ANY, ItemPredicate.ANY, ItemPredicate.ANY, ItemPredicate.ANY); // Leaves - cache ominous banner item | ||
private final ItemPredicate head; | ||
private final ItemPredicate chest; | ||
private final ItemPredicate legs; | ||
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 f7399737548483905f3b5c08a03876b0da54b714..dc3aed4130b78e91382a6e973ae83ea4a0524f41 100644 | ||
--- a/src/main/java/net/minecraft/world/entity/raid/Raid.java | ||
+++ b/src/main/java/net/minecraft/world/entity/raid/Raid.java | ||
@@ -689,7 +689,14 @@ public class Raid { | ||
this.level.getRaids().setDirty(); | ||
} | ||
|
||
+ // Leaves start - cache ominous banner item | ||
+ public static final ItemStack LEADER_BANNER = createLeaderBanner(); | ||
public static ItemStack getLeaderBannerInstance() { | ||
+ return top.leavesmc.leaves.LeavesConfig.cacheOminousBannerItem ? LEADER_BANNER.copy() : createLeaderBanner(); | ||
+ } | ||
+ // Leaves end - cache ominous banner item | ||
+ | ||
+ public static ItemStack createLeaderBanner() { // Leaves - cache ominous banner item | ||
ItemStack itemstack = new ItemStack(Items.WHITE_BANNER); | ||
CompoundTag nbttagcompound = new CompoundTag(); | ||
ListTag nbttaglist = (new BannerPattern.Builder()).addPattern(BannerPatterns.RHOMBUS_MIDDLE, DyeColor.CYAN).addPattern(BannerPatterns.STRIPE_BOTTOM, DyeColor.LIGHT_GRAY).addPattern(BannerPatterns.STRIPE_CENTER, DyeColor.GRAY).addPattern(BannerPatterns.BORDER, DyeColor.LIGHT_GRAY).addPattern(BannerPatterns.STRIPE_MIDDLE, DyeColor.BLACK).addPattern(BannerPatterns.HALF_HORIZONTAL, DyeColor.LIGHT_GRAY).addPattern(BannerPatterns.CIRCLE_MIDDLE, DyeColor.LIGHT_GRAY).addPattern(BannerPatterns.BORDER, DyeColor.BLACK).toListTag(); | ||
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 1b8e141e50dd2a156eda2455988ea45a390692ae..f3029db1e2a16619def35f1bf7807dd1052d3036 100644 | ||
--- a/src/main/java/net/minecraft/world/entity/raid/Raider.java | ||
+++ b/src/main/java/net/minecraft/world/entity/raid/Raider.java | ||
@@ -47,7 +47,7 @@ public abstract class Raider extends PatrollingMonster { | ||
|
||
protected static final EntityDataAccessor<Boolean> IS_CELEBRATING = SynchedEntityData.defineId(Raider.class, EntityDataSerializers.BOOLEAN); | ||
static final Predicate<ItemEntity> ALLOWED_ITEMS = (entityitem) -> { | ||
- return !entityitem.hasPickUpDelay() && entityitem.isAlive() && ItemStack.matches(entityitem.getItem(), Raid.getLeaderBannerInstance()); | ||
+ return !entityitem.hasPickUpDelay() && entityitem.isAlive() && ItemStack.matches(entityitem.getItem(), top.leavesmc.leaves.LeavesConfig.cacheOminousBannerItem ? Raid.LEADER_BANNER : Raid.getLeaderBannerInstance()); // Leaves - cache ominous banner item | ||
}; | ||
@Nullable | ||
protected Raid raid; | ||
@@ -149,7 +149,7 @@ public abstract class Raider extends PatrollingMonster { | ||
} | ||
} | ||
|
||
- if (!itemstack.isEmpty() && ItemStack.matches(itemstack, Raid.getLeaderBannerInstance()) && entityhuman != null) { | ||
+ if (!itemstack.isEmpty() && ItemStack.matches(itemstack, top.leavesmc.leaves.LeavesConfig.cacheOminousBannerItem ? Raid.LEADER_BANNER : Raid.getLeaderBannerInstance()) && entityhuman != null) { // Leaves - cache ominous banner item | ||
MobEffectInstance mobeffect = entityhuman.getEffect(MobEffects.BAD_OMEN); | ||
byte b0 = 1; | ||
int i; | ||
@@ -244,7 +244,7 @@ public abstract class Raider extends PatrollingMonster { | ||
ItemStack itemstack = item.getItem(); | ||
boolean flag = this.hasActiveRaid() && this.getCurrentRaid().getLeader(this.getWave()) != null; | ||
|
||
- if (this.hasActiveRaid() && !flag && ItemStack.matches(itemstack, Raid.getLeaderBannerInstance())) { | ||
+ if (this.hasActiveRaid() && !flag && ItemStack.matches(itemstack, top.leavesmc.leaves.LeavesConfig.cacheOminousBannerItem ? Raid.LEADER_BANNER : Raid.getLeaderBannerInstance())) { // Leaves - cache ominous banner item | ||
// Paper start | ||
if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(this, item, 0, false).isCancelled()) { | ||
return; | ||
@@ -322,7 +322,7 @@ public abstract class Raider extends PatrollingMonster { | ||
if (!this.mob.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) || !this.mob.canPickUpLoot()) return false; // Paper - respect game and entity rules for picking up items | ||
Raid raid = this.mob.getCurrentRaid(); | ||
|
||
- if (this.mob.hasActiveRaid() && !this.mob.getCurrentRaid().isOver() && this.mob.canBeLeader() && !ItemStack.matches(this.mob.getItemBySlot(EquipmentSlot.HEAD), Raid.getLeaderBannerInstance())) { | ||
+ if (this.mob.hasActiveRaid() && !this.mob.getCurrentRaid().isOver() && this.mob.canBeLeader() && !ItemStack.matches(this.mob.getItemBySlot(EquipmentSlot.HEAD), top.leavesmc.leaves.LeavesConfig.cacheOminousBannerItem ? Raid.LEADER_BANNER : Raid.getLeaderBannerInstance())) { // Leaves - cache ominous banner item | ||
Raider entityraider = raid.getLeader(this.mob.getWave()); | ||
|
||
if (entityraider == null || !entityraider.isAlive()) { |
41 changes: 41 additions & 0 deletions
41
patches/server/0107-Skip-entity-move-if-movement-is-zero.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: violetc <[email protected]> | ||
Date: Thu, 20 Jul 2023 21:13:28 +0800 | ||
Subject: [PATCH] Skip entity move if movement is zero | ||
|
||
This patch is Powered by Gale(https://github.com/GaleMC/Gale) | ||
|
||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java | ||
index 40f3d47eb085663c979719bd648ac593abf0e786..501208a0407829c72204625964fac40a11384563 100644 | ||
--- a/src/main/java/net/minecraft/world/entity/Entity.java | ||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java | ||
@@ -314,6 +314,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { | ||
public float yRotO; | ||
public float xRotO; | ||
private AABB bb; | ||
+ private boolean boundingBoxChanged = false; // Leaves - skip entity move if movement is zero | ||
public boolean onGround; | ||
public boolean horizontalCollision; | ||
public boolean verticalCollision; | ||
@@ -1067,6 +1068,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { | ||
// Paper end - detailed watchdog information | ||
|
||
public void move(MoverType movementType, Vec3 movement) { | ||
+ // Leaves start - skip entity move if movement is zero | ||
+ if (top.leavesmc.leaves.LeavesConfig.skipEntityMoveIfMovementIsZero) { | ||
+ if (!this.boundingBoxChanged && movement.equals(Vec3.ZERO)) { | ||
+ return; | ||
+ } | ||
+ } | ||
+ // Leaves end - skip entity move if movement is zero | ||
// Paper start - detailed watchdog information | ||
io.papermc.paper.util.TickThread.ensureTickThread("Cannot move an entity off-main"); | ||
synchronized (this.posLock) { | ||
@@ -3988,6 +3996,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { | ||
} | ||
|
||
public final void setBoundingBox(AABB boundingBox) { | ||
+ if (!this.bb.equals(boundingBox)) this.boundingBoxChanged = true; // Leaves - skip entity move if movement is zero | ||
// CraftBukkit start - block invalid bounding boxes | ||
double minX = boundingBox.minX, | ||
minY = boundingBox.minY, |
20 changes: 20 additions & 0 deletions
20
patches/server/0108-Skip-cloning-advancement-criteria.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: violetc <[email protected]> | ||
Date: Thu, 20 Jul 2023 21:30:17 +0800 | ||
Subject: [PATCH] Skip cloning advancement criteria | ||
|
||
This patch is Powered by Gale(https://github.com/GaleMC/Gale) | ||
|
||
diff --git a/src/main/java/net/minecraft/advancements/Advancement.java b/src/main/java/net/minecraft/advancements/Advancement.java | ||
index 81359be381fc9bcb56a9cc83e70a6afa6e838c6a..23f930775d8d684da915ca72ca1c4b27572fb056 100644 | ||
--- a/src/main/java/net/minecraft/advancements/Advancement.java | ||
+++ b/src/main/java/net/minecraft/advancements/Advancement.java | ||
@@ -46,7 +46,7 @@ public class Advancement { | ||
public Advancement(ResourceLocation id, @Nullable Advancement parent, @Nullable DisplayInfo display, AdvancementRewards rewards, Map<String, Criterion> criteria, String[][] requirements, boolean sendsTelemetryEvent) { | ||
this.id = id; | ||
this.display = display; | ||
- this.criteria = ImmutableMap.copyOf(criteria); | ||
+ this.criteria = !top.leavesmc.leaves.LeavesConfig.skipCloningAdvancementCriteria ? ImmutableMap.copyOf(criteria) : criteria; // Leaves - skip cloning advancement criteria | ||
this.parent = parent; | ||
this.rewards = rewards; | ||
this.requirements = requirements; |