Skip to content

Commit

Permalink
Updated Upstream (Gale/Purpur)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreeam-qwq committed Jun 5, 2024
1 parent 235fc52 commit 3f34600
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 50 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ group = cn.dreeam.leaf
mcVersion = 1.20.6
version = 1.20.6-R0.1-SNAPSHOT

galeCommit = 03c35e706163d79daef6b6d24febe85b444b9637
galeCommit = c67ad06166d774550eb1e177857acdae6ac72fb8

org.gradle.caching = true
org.gradle.parallel = true
Expand Down
20 changes: 10 additions & 10 deletions patches/api/0004-Purpur-API-Changes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Subject: [PATCH] Purpur API Changes
Original license: MIT
Original project: https://github.com/PurpurMC/Purpur

Commit: 2842b97ddf051139e4f76b54ec1731e73e0140ba
Commit: 79d199c7f07d4acd9af6a9858cd895722ce16429

Patches below are removed in this patch:
Pufferfish-API-Changes.patch
Expand Down Expand Up @@ -35,7 +35,7 @@ index 957f15a91f6aa1235c12b82079e32bb42449c78d..9fa8d7fac5bf415b40c3a9a38108fa54
/**
* The brand id for Leaf.
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index dec4ad04ac3dc2e869ea78f354cdf37d7a305a55..15274b07fea8e25e8acebbc0e688013cb7498a42 100644
index d8cd53f7e45d3b5276aa360b10ff05ce7275a3a3..8c4619de2a52003a9684cc95f920b12e40944f27 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2980,4 +2980,127 @@ public final class Bukkit {
Expand Down Expand Up @@ -257,7 +257,7 @@ index 918a045165cdcde264bc24082b7afebb407271de..687d11619379aead7f665d4a5f8f8bcc
+ // Purpur end
}
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
index 4f7f91b5e2903ce3b180c637cb463e01a860271e..5b14cea8d246f31c51b09baa731e673f305aea6e 100644
index 7509b61dfdc0a6675256970cb850b08f9e814580..c1986ca90c3adb81daca4f72b62cda65e5465bff 100644
--- a/src/main/java/org/bukkit/Material.java
+++ b/src/main/java/org/bukkit/Material.java
@@ -5733,4 +5733,40 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
Expand Down Expand Up @@ -302,7 +302,7 @@ index 4f7f91b5e2903ce3b180c637cb463e01a860271e..5b14cea8d246f31c51b09baa731e673f
+ // Purpur end
}
diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/bukkit/OfflinePlayer.java
index 30298a629b39bd43ce14b414fc697b2dfcbea89c..ce00af9121de7a910aaea4e0685a06d4cf31b4e3 100644
index 3993fecec5b4c2bbd77e175a168afcad571ce4d1..d0206c9c2f423a9b77237d9a005b9ee139dae70f 100644
--- a/src/main/java/org/bukkit/OfflinePlayer.java
+++ b/src/main/java/org/bukkit/OfflinePlayer.java
@@ -557,4 +557,106 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
Expand Down Expand Up @@ -413,7 +413,7 @@ index 30298a629b39bd43ce14b414fc697b2dfcbea89c..ce00af9121de7a910aaea4e0685a06d4
+ // Purpur end - OfflinePlayer API
}
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 52bd9bab6315a3b962f4cab215a979a802bec182..0d38fe01e2a59eb50fec8597f634adaba672ff2d 100644
index 12dd25921625db145287edba783ae6d7e904ce80..9ed8f4e3e3d33e4bdefc7db85d5f65e39a971041 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2310,6 +2310,18 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
Expand Down Expand Up @@ -541,7 +541,7 @@ index 52bd9bab6315a3b962f4cab215a979a802bec182..0d38fe01e2a59eb50fec8597f634adab
+ // Purpur end
}
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index 97f97ea5c6aa513c439f86a9c82821e0f7d9cd1e..83a5b68c785a88594e6e3824ed282844086f7f1a 100644
index 26622cafbb9811fafe18d5dd9b25f56960154772..7707963157ef98eedbf7143a0dbd9c22580a426d 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -4249,6 +4249,86 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
Expand Down Expand Up @@ -761,10 +761,10 @@ index 138d2530de2410f4a9424dabd3e5ce0cd1c1dcd2..10a8d64ad2da0be2c14f34c3e7d1957c
// Paper start
/**
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index 62e3793903905b94eb1a120345015149abb33713..07b8c0dd049ff783fd2e408be634642479bf8b1e 100644
index 725ef320f929d5e3d141c1ed3246d73a7d741f31..2d12c70b0baa50504619c8e37881a11a56d7df2c 100644
--- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -1155,4 +1155,55 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
@@ -1159,4 +1159,55 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
*/
@NotNull String getScoreboardEntryName();
// Paper end - entity scoreboard name
Expand Down Expand Up @@ -913,7 +913,7 @@ index bcc6ba95bd21c7972865838c636a03f50b6c1f1a..c3fcd8dd7dbb1e1a18e17c014c1e6411
+ // Purpur end
}
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
index b777e530122549455dcce6fac8d4a151c1c0af42..61a046584acf48693489ff551a0dd4c4b16af9ff 100644
index 5c29956c6db53440322330ff723c7087193641f1..544b1d8aa5665fd2567605014adee6222d2cb312 100644
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
@@ -1447,4 +1447,27 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
Expand Down Expand Up @@ -970,7 +970,7 @@ index bc84b892cae5fe7019a3ad481e9da79956efa1fe..48eb5b00c460cccde29d327cef1d63fc
+ // Purpur end
}
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 2d63d61fcfe87c4f07b1d752facbb1bae6f2b0ca..d09618735f42fc3a0f9fd0de15499860f96ce0b3 100644
index dbd6eba668cd20a72ca6df9968c69743bca116ee..7e0aab5a34b45a032b73e566ce94bbb86a14ecf0 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -3816,4 +3816,123 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Subject: [PATCH] Purpur generated-api Changes
Original license: MIT
Original project: https://github.com/PurpurMC/Purpur

Commit: 2842b97ddf051139e4f76b54ec1731e73e0140ba
Commit: 79d199c7f07d4acd9af6a9858cd895722ce16429

diff --git a/com/destroystokyo/paper/entity/ai/VanillaGoal.java b/com/destroystokyo/paper/entity/ai/VanillaGoal.java
index 43f4deacef349502cbb207aafc4f9cb7a75177c5..6b692c24a62e2172116a6b9c371b1c0e2411c27e 100644
Expand Down
79 changes: 41 additions & 38 deletions patches/server/0011-Purpur-Server-Changes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ TODO - Dreeam: Check TODOs in ServerGamePacketListenerImpl & Fix-pufferfish-issu
Original license: MIT
Original project: https://github.com/PurpurMC/Purpur

Commit: 2842b97ddf051139e4f76b54ec1731e73e0140ba
Commit: 79d199c7f07d4acd9af6a9858cd895722ce16429

Patches below are removed in this patch:
Metrics changes in Purpur-config-files.patch
Expand Down Expand Up @@ -550,7 +550,7 @@ index 11d6d060068985884338ab61d2f98d55a202afd8..95c84e0f83d056ee080061cd495c95a3

if (environment.includeIntegrated) {
diff --git a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java b/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java
index 676a1499747b071515479130875157263d3a8352..fc1bba350030c076405711716e9830f8ae7f3953 100644
index d78ad5eccd18d89050a486a0c40090a09683bd16..2a0d54f06de7b959055459349365c85c67c11a3f 100644
--- a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java
+++ b/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java
@@ -200,10 +200,10 @@ public class EntitySelector {
Expand Down Expand Up @@ -2692,7 +2692,7 @@ index 09fdea983772612ef3fff6b2da3cf469a34e4ec0..b69d924fa8034eabbf4aab8d3434f4f4
protected ParticleOptions getInkParticle() {
return ParticleTypes.GLOW_SQUID_INK;
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index c28e31f1c42b2248e51aa2c22f2584eab10afa68..97798b6f2feed1a13900644eca1ad4de3c0950fc 100644
index c28e31f1c42b2248e51aa2c22f2584eab10afa68..c725725689eb57fecf5238c3435e4d80b11963ed 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -228,9 +228,9 @@ public abstract class LivingEntity extends Entity implements Attackable {
Expand Down Expand Up @@ -2804,7 +2804,7 @@ index c28e31f1c42b2248e51aa2c22f2584eab10afa68..97798b6f2feed1a13900644eca1ad4de
+ d0 *= entity.level().purpurConfig.creeperHeadVisibilityPercent;
+ } else if ((entitytypes == EntityType.PIGLIN || entitytypes == EntityType.PIGLIN_BRUTE) && itemstack.is(Items.PIGLIN_HEAD)) {
+ d0 *= entity.level().purpurConfig.piglinHeadVisibilityPercent;
}
+ }
+ // Purpur end
+
+ // Purpur start
Expand All @@ -2815,7 +2815,7 @@ index c28e31f1c42b2248e51aa2c22f2584eab10afa68..97798b6f2feed1a13900644eca1ad4de
+ d0 *= this.level().purpurConfig.mobsBlindnessMultiplier;
+ }
+ }
+ }
}
+ // Purpur end
}

Expand All @@ -2828,7 +2828,32 @@ index c28e31f1c42b2248e51aa2c22f2584eab10afa68..97798b6f2feed1a13900644eca1ad4de
EntityPotionEffectEvent event = CraftEventFactory.callEntityPotionEffectChangeEvent(this, effect, null, cause, EntityPotionEffectEvent.Action.CLEARED);
if (event.isCancelled()) {
continue;
@@ -1533,13 +1565,13 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1452,6 +1484,24 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.stopSleeping();
}

+ // Purpur start
+ if (source.getEntity() instanceof net.minecraft.world.entity.player.Player player && source.getEntity().level().purpurConfig.creativeOnePunch && !source.is(DamageTypeTags.IS_PROJECTILE)) {
+ if (player.isCreative()) {
+ org.apache.commons.lang3.mutable.MutableDouble attackDamage = new org.apache.commons.lang3.mutable.MutableDouble();
+ player.getMainHandItem().forEachModifier(EquipmentSlot.MAINHAND, (attributeHolder, attributeModifier) -> {
+ if (attributeModifier.operation() == AttributeModifier.Operation.ADD_VALUE) {
+ attackDamage.addAndGet(attributeModifier.amount());
+ }
+ });
+
+ if (attackDamage.doubleValue() == 0.0D) {
+ // One punch!
+ amount = 9999F;
+ }
+ }
+ }
+ // Purpur end
+
this.noActionTime = 0;
float f1 = amount;
boolean flag = amount > 0.0F && this.isDamageSourceBlocked(source); // Copied from below
@@ -1533,13 +1583,13 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (entity1 instanceof net.minecraft.world.entity.player.Player) {
net.minecraft.world.entity.player.Player entityhuman = (net.minecraft.world.entity.player.Player) entity1;

Expand All @@ -2844,7 +2869,7 @@ index c28e31f1c42b2248e51aa2c22f2584eab10afa68..97798b6f2feed1a13900644eca1ad4de
LivingEntity entityliving2 = entitywolf.getOwner();

if (entityliving2 instanceof net.minecraft.world.entity.player.Player) {
@@ -1654,6 +1686,18 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1654,6 +1704,18 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
}

Expand All @@ -2863,7 +2888,7 @@ index c28e31f1c42b2248e51aa2c22f2584eab10afa68..97798b6f2feed1a13900644eca1ad4de
org.bukkit.inventory.EquipmentSlot handSlot = (hand != null) ? org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand) : null;
EntityResurrectEvent event = new EntityResurrectEvent((org.bukkit.entity.LivingEntity) this.getBukkitEntity(), handSlot);
event.setCancelled(itemstack == null);
@@ -1820,7 +1864,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1820,7 +1882,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
boolean flag = false;

if (this.dead && adversary instanceof WitherBoss) { // Paper
Expand All @@ -2872,45 +2897,23 @@ index c28e31f1c42b2248e51aa2c22f2584eab10afa68..97798b6f2feed1a13900644eca1ad4de
BlockPos blockposition = this.blockPosition();
BlockState iblockdata = Blocks.WITHER_ROSE.defaultBlockState();

@@ -1866,6 +1910,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1866,6 +1928,7 @@ public abstract class LivingEntity extends Entity implements Attackable {

this.dropEquipment(); // CraftBukkit - from below
if (this.shouldDropLoot() && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
+ if (!(source.is(net.minecraft.world.damagesource.DamageTypes.CRAMMING) && level().purpurConfig.disableDropsOnCrammingDeath)) { // Purpur
this.dropFromLootTable(source, flag);
// Paper start
final boolean prev = this.clearEquipmentSlots;
@@ -1874,6 +1919,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1874,6 +1937,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
// Paper end
this.dropCustomDeathLoot(source, i, flag);
this.clearEquipmentSlots = prev; // Paper
+ } // Purpur
}
// CraftBukkit start - Call death event // Paper start - call advancement triggers with correct entity equipment
org.bukkit.event.entity.EntityDeathEvent deathEvent = CraftEventFactory.callEntityDeathEvent(this, source, this.drops, () -> {
@@ -2397,6 +2443,21 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
}

+ // Purpur start
+ if (damagesource.getEntity() instanceof net.minecraft.world.entity.player.Player player && damagesource.getEntity().level().purpurConfig.creativeOnePunch) {
+ if (player.isCreative()) {
+ double attackDamage;
+ net.minecraft.world.item.component.ItemAttributeModifiers itemattributemodifiers = player.getMainHandItem().getOrDefault(DataComponents.ATTRIBUTE_MODIFIERS, net.minecraft.world.item.component.ItemAttributeModifiers.EMPTY);
+
+ attackDamage = itemattributemodifiers.compute(player.getAttributeBaseValue(Attributes.ATTACK_DAMAGE), EquipmentSlot.MAINHAND);
+
+ if (attackDamage == 1.0D) {
+ this.setHealth(0);
+ }
+ }
+ }
+ // Purpur end
+
if (f > 0 || !human) {
if (human) {
// PAIL: Be sure to drag all this code from the EntityHuman subclass each update.
@@ -2620,7 +2681,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -2620,7 +2684,7 @@ public abstract class LivingEntity extends Entity implements Attackable {

@Override
protected void onBelowWorld() {
Expand All @@ -2919,7 +2922,7 @@ index c28e31f1c42b2248e51aa2c22f2584eab10afa68..97798b6f2feed1a13900644eca1ad4de
}

protected void updateSwingTime() {
@@ -2815,7 +2876,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -2815,7 +2879,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
}

protected long lastJumpTime = 0L; // Paper - Prevent excessive velocity through repeated crits
Expand All @@ -2928,15 +2931,15 @@ index c28e31f1c42b2248e51aa2c22f2584eab10afa68..97798b6f2feed1a13900644eca1ad4de
float f = this.getJumpPower();

if (f > 1.0E-5F) {
@@ -2975,6 +3036,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -2975,6 +3039,7 @@ public abstract class LivingEntity extends Entity implements Attackable {

if (f3 > 0.0F) {
this.playSound(this.getFallDamageSound((int) f3), 1.0F, 1.0F);
+ if (level().purpurConfig.elytraKineticDamage) // Purpur
this.hurt(this.damageSources().flyIntoWall(), f3);
}
}
@@ -3512,8 +3574,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3512,8 +3577,10 @@ public abstract class LivingEntity extends Entity implements Attackable {

this.pushEntities();
// Paper start - Add EntityMoveEvent
Expand All @@ -2949,7 +2952,7 @@ index c28e31f1c42b2248e51aa2c22f2584eab10afa68..97798b6f2feed1a13900644eca1ad4de
Location from = new Location(this.level().getWorld(), this.xo, this.yo, this.zo, this.yRotO, this.xRotO);
Location to = new Location(this.level().getWorld(), this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
io.papermc.paper.event.entity.EntityMoveEvent event = new io.papermc.paper.event.entity.EntityMoveEvent(this.getBukkitLivingEntity(), from, to.clone());
@@ -3523,12 +3587,48 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3523,12 +3590,48 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.absMoveTo(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ(), event.getTo().getYaw(), event.getTo().getPitch());
}
}
Expand Down Expand Up @@ -2998,7 +3001,7 @@ index c28e31f1c42b2248e51aa2c22f2584eab10afa68..97798b6f2feed1a13900644eca1ad4de
}

public boolean isSensitiveToWater() {
@@ -3549,7 +3649,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3549,7 +3652,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
int j = i / 10;

if (j % 2 == 0) {
Expand Down

0 comments on commit 3f34600

Please sign in to comment.