mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 08:27:43 +01:00
Mob head visibility percent
This commit is contained in:
82
patches/server/0251-Mob-head-visibility-percent.patch
Normal file
82
patches/server/0251-Mob-head-visibility-percent.patch
Normal file
@@ -0,0 +1,82 @@
|
||||
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 b6022415925d365931a1110f727d5a22a04b9cee..49238d8b25f4d8a477bd5bbf02e655fe02a99058 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -992,9 +992,17 @@ public abstract class LivingEntity extends Entity {
|
||||
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.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;
|
||||
+ }
|
||||
+ // 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 d600414555e076047a2114255538f0a2ab3fbd94..7c35a14a02fb160918ef33d2c57666bc1f167a87 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -1237,6 +1237,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);
|
||||
@@ -1253,6 +1254,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;
|
||||
@@ -2224,6 +2226,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);
|
||||
@@ -2235,6 +2238,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;
|
||||
@@ -2707,6 +2711,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);
|
||||
@@ -2724,6 +2729,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;
|
||||
Reference in New Issue
Block a user