mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-20 01:47:42 +01:00
102 lines
6.3 KiB
Diff
102 lines
6.3 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 97f8087ade872591f1d4ba0783b8ee38d5f614aa..c53f871238809fc62bb8080eb2b895c2fcac6d29 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
@@ -1041,9 +1041,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 d1c0e95e13ab791627678957da8ecc4de183e3ce..83b3e1871c8af80c3e5ad3f101fb8997241a3c7b 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
@@ -1199,6 +1199,7 @@ public class PurpurWorldConfig {
|
|
public boolean creeperExplodeWhenKilled = false;
|
|
public boolean creeperHealthRadius = false;
|
|
public boolean creeperAlwaysDropExp = false;
|
|
+ public double creeperHeadVisibilityPercent = 0.5D;
|
|
private void creeperSettings() {
|
|
if (PurpurConfig.version < 10) {
|
|
double oldValue = getDouble("mobs.creeper.attributes.max-health", creeperMaxHealth);
|
|
@@ -1213,6 +1214,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 double dolphinMaxHealth = 10.0D;
|
|
@@ -1811,6 +1813,7 @@ public class PurpurWorldConfig {
|
|
public boolean piglinTakeDamageFromWater = false;
|
|
public int piglinPortalSpawnModifier = 2000;
|
|
public boolean piglinAlwaysDropExp = false;
|
|
+ public double piglinHeadVisibilityPercent = 0.5D;
|
|
private void piglinSettings() {
|
|
if (PurpurConfig.version < 10) {
|
|
double oldValue = getDouble("mobs.piglin.attributes.max-health", piglinMaxHealth);
|
|
@@ -1822,6 +1825,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 double piglinBruteMaxHealth = 50.0D;
|
|
@@ -2024,6 +2028,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() {
|
|
if (PurpurConfig.version < 10) {
|
|
double oldValue = getDouble("mobs.skeleton.attributes.max-health", skeletonMaxHealth);
|
|
@@ -2033,6 +2038,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 double skeletonHorseMaxHealthMin = 15.0D;
|
|
@@ -2426,6 +2432,7 @@ public class PurpurWorldConfig {
|
|
public boolean zombieBypassMobGriefing = false;
|
|
public boolean zombieTakeDamageFromWater = false;
|
|
public boolean zombieAlwaysDropExp = false;
|
|
+ public double zombieHeadVisibilityPercent = 0.5D;
|
|
private void zombieSettings() {
|
|
if (PurpurConfig.version < 10) {
|
|
double oldValue = getDouble("mobs.zombie.attributes.max-health", zombieMaxHealth);
|
|
@@ -2441,6 +2448,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 double zombieHorseMaxHealthMin = 15.0D;
|