Files
Purpur/patches/server/0233-Mob-head-visibility-percent.patch
granny 969064029c Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@d129162 Properly handle BlockBreakEvent#isDropItems (#8936)
PaperMC/Paper@67a1a8c Fix Inventory#getLocation not working for the composter (#9596)
PaperMC/Paper@5b34a09 Add option to disable chorus plant and mushroom block updates (#9442)
PaperMC/Paper@ed8401c Fix rotation for spawning display entities (#9552)
PaperMC/Paper@bd67b83 Determine lava and water fluid explosion resistance by their block explosion resistance (#9482)
PaperMC/Paper@d928dda Don't tab-complete namespaced commands if `send-namespaced` is false (#9366)
PaperMC/Paper@f43a19c Fix CME in CraftPersistentDataTypeRegistry (#6701)
PaperMC/Paper@45ba652 [ci skip] Rebuild patches
PaperMC/Paper@990765b Fire entity death event for ender dragon (#9495)
PaperMC/Paper@1259b93 Fixed CraftItemStack/CraftItemMeta enchantment level inconsistency (#8792)
PaperMC/Paper@88891c3  Add Entity Coordinate and Rotation API (#9461)
PaperMC/Paper@5bf82aa Add cancellability to PlayerTrackEntityEvent (#8605)
PaperMC/Paper@1b96c64 Improve cancelling PreCreatureSpawnEvent with per player mob spawns (#9400)
PaperMC/Paper@7232506 Add entity tracker min Y distance config option (#9406)
PaperMC/Paper@00a68b1 Player listing API (#8782)
PaperMC/Paper@af6142e [ci skip] Update Gradle wrapper
PaperMC/Paper@281855c Remove unused lag-compensate-block-breaking option (#9635)
PaperMC/Paper@35ef053 [ci skip] update editorconfig and gitattributes (#9608)
PaperMC/Paper@97b9c4a Fix NPE on Boat#getStatus (#9115)
PaperMC/Paper@2be57c6 Expand Pose API (#8781)
PaperMC/Paper@b29ecd4 Expose clicked BlockFace during BlockDamageEvent (#9632)
PaperMC/Paper@e3f29f4 MerchantRecipe: add copy constructor (#8703)
PaperMC/Paper@fed9042 More DragonBattle API (#5655)
PaperMC/Paper@27d39ca Properly clone custom nbt tags inside ItemMeta (#7849)
PaperMC/Paper@0c7385b Add PlayerPickItemEvent (#5590)
PaperMC/Paper@9395aa6 Improve performance of mass crafts (#9603)
PaperMC/Paper@7386a13 Fix endgateway teleportation offset (#9517)
PaperMC/Paper@a712766 Allow custom damage for trident (#8132)
PaperMC/Paper@3716832 Prevent overfilled bundles from duplicating items (#9633)
PaperMC/Paper@9cbad8e Expose Hand during BlockCanBuildEvent (#9636)
2023-08-22 18:41:13 -07:00

102 lines
6.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <blake.galbreath@gmail.com>
Date: Fri, 31 Dec 2021 06:40:19 -0600
Subject: [PATCH] Mob head visibility percent
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 21d6851cb903f214db92109a6c16bb7367e40e1c..aff8b1b0683e52038b6d92e052a012c9198bf8ce 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1040,9 +1040,20 @@ public abstract class LivingEntity extends Entity implements Attackable {
ItemStack itemstack = this.getItemBySlot(EquipmentSlot.HEAD);
EntityType<?> entitytypes = entity.getType();
- if (entitytypes == EntityType.SKELETON && itemstack.is(Items.SKELETON_SKULL) || entitytypes == EntityType.ZOMBIE && itemstack.is(Items.ZOMBIE_HEAD) || entitytypes == EntityType.PIGLIN && itemstack.is(Items.PIGLIN_HEAD) || entitytypes == EntityType.PIGLIN_BRUTE && itemstack.is(Items.PIGLIN_HEAD) || entitytypes == EntityType.CREEPER && itemstack.is(Items.CREEPER_HEAD)) {
- d0 *= 0.5D;
+ // Purpur start
+ if (entitytypes == EntityType.SKELETON && itemstack.is(Items.SKELETON_SKULL)) {
+ d0 *= entity.level().purpurConfig.skeletonHeadVisibilityPercent;
+ }
+ else if (entitytypes == EntityType.ZOMBIE && itemstack.is(Items.ZOMBIE_HEAD)) {
+ d0 *= entity.level().purpurConfig.zombieHeadVisibilityPercent;
+ }
+ else if (entitytypes == EntityType.CREEPER && itemstack.is(Items.CREEPER_HEAD)) {
+ 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
if (entity instanceof LivingEntity entityliving) {
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 30e63ae6bc35efc64a016966f55bfb1e7df52d89..91af2d4187b2e61426539d018900c810d048efc9 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -1309,6 +1309,7 @@ public class PurpurWorldConfig {
public boolean creeperExplodeWhenKilled = false;
public boolean creeperHealthRadius = false;
public boolean creeperAlwaysDropExp = false;
+ public double creeperHeadVisibilityPercent = 0.5D;
private void creeperSettings() {
creeperRidable = getBoolean("mobs.creeper.ridable", creeperRidable);
creeperRidableInWater = getBoolean("mobs.creeper.ridable-in-water", creeperRidableInWater);
@@ -1326,6 +1327,7 @@ public class PurpurWorldConfig {
creeperExplodeWhenKilled = getBoolean("mobs.creeper.explode-when-killed", creeperExplodeWhenKilled);
creeperHealthRadius = getBoolean("mobs.creeper.health-impacts-explosion", creeperHealthRadius);
creeperAlwaysDropExp = getBoolean("mobs.creeper.always-drop-exp", creeperAlwaysDropExp);
+ creeperHeadVisibilityPercent = getDouble("mobs.creeper.head-visibility-percent", creeperHeadVisibilityPercent);
}
public boolean dolphinRidable = false;
@@ -2112,6 +2114,7 @@ public class PurpurWorldConfig {
public boolean piglinTakeDamageFromWater = false;
public int piglinPortalSpawnModifier = 2000;
public boolean piglinAlwaysDropExp = false;
+ public double piglinHeadVisibilityPercent = 0.5D;
private void piglinSettings() {
piglinRidable = getBoolean("mobs.piglin.ridable", piglinRidable);
piglinRidableInWater = getBoolean("mobs.piglin.ridable-in-water", piglinRidableInWater);
@@ -2126,6 +2129,7 @@ public class PurpurWorldConfig {
piglinTakeDamageFromWater = getBoolean("mobs.piglin.takes-damage-from-water", piglinTakeDamageFromWater);
piglinPortalSpawnModifier = getInt("mobs.piglin.portal-spawn-modifier", piglinPortalSpawnModifier);
piglinAlwaysDropExp = getBoolean("mobs.piglin.always-drop-exp", piglinAlwaysDropExp);
+ piglinHeadVisibilityPercent = getDouble("mobs.piglin.head-visibility-percent", piglinHeadVisibilityPercent);
}
public boolean piglinBruteRidable = false;
@@ -2387,6 +2391,7 @@ public class PurpurWorldConfig {
public double skeletonMaxHealth = 20.0D;
public boolean skeletonTakeDamageFromWater = false;
public boolean skeletonAlwaysDropExp = false;
+ public double skeletonHeadVisibilityPercent = 0.5D;
private void skeletonSettings() {
skeletonRidable = getBoolean("mobs.skeleton.ridable", skeletonRidable);
skeletonRidableInWater = getBoolean("mobs.skeleton.ridable-in-water", skeletonRidableInWater);
@@ -2399,6 +2404,7 @@ public class PurpurWorldConfig {
skeletonMaxHealth = getDouble("mobs.skeleton.attributes.max_health", skeletonMaxHealth);
skeletonTakeDamageFromWater = getBoolean("mobs.skeleton.takes-damage-from-water", skeletonTakeDamageFromWater);
skeletonAlwaysDropExp = getBoolean("mobs.skeleton.always-drop-exp", skeletonAlwaysDropExp);
+ skeletonHeadVisibilityPercent = getDouble("mobs.skeleton.head-visibility-percent", skeletonHeadVisibilityPercent);
}
public boolean skeletonHorseRidableInWater = true;
@@ -2933,6 +2939,7 @@ public class PurpurWorldConfig {
public boolean zombieBypassMobGriefing = false;
public boolean zombieTakeDamageFromWater = false;
public boolean zombieAlwaysDropExp = false;
+ public double zombieHeadVisibilityPercent = 0.5D;
private void zombieSettings() {
zombieRidable = getBoolean("mobs.zombie.ridable", zombieRidable);
zombieRidableInWater = getBoolean("mobs.zombie.ridable-in-water", zombieRidableInWater);
@@ -2951,6 +2958,7 @@ public class PurpurWorldConfig {
zombieBypassMobGriefing = getBoolean("mobs.zombie.bypass-mob-griefing", zombieBypassMobGriefing);
zombieTakeDamageFromWater = getBoolean("mobs.zombie.takes-damage-from-water", zombieTakeDamageFromWater);
zombieAlwaysDropExp = getBoolean("mobs.zombie.always-drop-exp", zombieAlwaysDropExp);
+ zombieHeadVisibilityPercent = getDouble("mobs.zombie.head-visibility-percent", zombieHeadVisibilityPercent);
}
public boolean zombieHorseRidableInWater = false;