mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-21 10:27:44 +01:00
Fix compilation issues (#1530)
This commit is contained in:
@@ -6,14 +6,14 @@ Subject: [PATCH] API for any mob to burn daylight
|
||||
Co-authored by: Encode42 <me@encode42.dev>
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 09ca45c5b369195b24e5f574217f709cae932137..1be8cf8d8457dcabab313e4b329c0831df6c57ce 100644
|
||||
index b0db81b3ebf17f6834716b09d6c30c8d19dc1dec..7b3b76cb9dd8b7f6254baffcd0f94aa70918ff04 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -534,6 +534,21 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
public boolean canSaveToDisk() {
|
||||
return true;
|
||||
@@ -536,6 +536,22 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
}
|
||||
+ // copied from Mob
|
||||
// Purpur end
|
||||
|
||||
+ // Purpur start - copied from Mob - API for any mob to burn daylight
|
||||
+ public boolean isSunBurnTick() {
|
||||
+ if (this.level().isDay() && !this.level().isClientSide) {
|
||||
+ float f = this.getLightLevelDependentMagicValue();
|
||||
@@ -27,19 +27,20 @@ index 09ca45c5b369195b24e5f574217f709cae932137..1be8cf8d8457dcabab313e4b329c0831
|
||||
+
|
||||
+ return false;
|
||||
+ }
|
||||
+ // Purpur end - copied from Mob - API for any mob to burn daylight
|
||||
+
|
||||
// Purpur end
|
||||
|
||||
public Entity(EntityType<?> type, Level world) {
|
||||
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
|
||||
this.passengers = ImmutableList.of();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index aa89957fd6b7fdf75ae4a98747f2032c23c84b2e..3b77111bdf50cd836d6e4199e6224b594430b147 100644
|
||||
index ee48e98e6981225b486ea933d51fb4b9cc73fa18..9367e0f148d3aa9a60dfd8881a3c337630a53129 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -286,6 +286,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
public org.bukkit.craftbukkit.entity.CraftLivingEntity getBukkitLivingEntity() { return (org.bukkit.craftbukkit.entity.CraftLivingEntity) super.getBukkitEntity(); } // Paper
|
||||
public boolean silentDeath = false; // Paper - mark entity as dying silently for cancellable death event
|
||||
public net.kyori.adventure.util.TriState frictionState = net.kyori.adventure.util.TriState.NOT_SET; // Paper - Friction API
|
||||
+ protected boolean shouldBurnInDay = false; public boolean shouldBurnInDay() { return this.shouldBurnInDay; } public void setShouldBurnInDay(boolean shouldBurnInDay) { this.shouldBurnInDay = shouldBurnInDay; } // Purpur
|
||||
+ protected boolean shouldBurnInDay = false; public boolean shouldBurnInDay() { return this.shouldBurnInDay; } public void setShouldBurnInDay(boolean shouldBurnInDay) { this.shouldBurnInDay = shouldBurnInDay; } // Purpur - API for any mob to burn daylight
|
||||
|
||||
@Override
|
||||
public float getBukkitYaw() {
|
||||
@@ -47,7 +48,7 @@ index aa89957fd6b7fdf75ae4a98747f2032c23c84b2e..3b77111bdf50cd836d6e4199e6224b59
|
||||
dataresult.resultOrPartial(logger::error).ifPresent((nbtbase) -> {
|
||||
nbt.put("Brain", nbtbase);
|
||||
});
|
||||
+ nbt.putBoolean("Purpur.ShouldBurnInDay", shouldBurnInDay); // Purpur
|
||||
+ nbt.putBoolean("Purpur.ShouldBurnInDay", this.shouldBurnInDay); // Purpur - API for any mob to burn daylight
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -55,21 +56,21 @@ index aa89957fd6b7fdf75ae4a98747f2032c23c84b2e..3b77111bdf50cd836d6e4199e6224b59
|
||||
this.brain = this.makeBrain(new Dynamic(NbtOps.INSTANCE, nbt.get("Brain")));
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ // Purpur start - API for any mob to burn daylight
|
||||
+ if (nbt.contains("Purpur.ShouldBurnInDay")) {
|
||||
+ shouldBurnInDay = nbt.getBoolean("Purpur.ShouldBurnInDay");
|
||||
+ this.shouldBurnInDay = nbt.getBoolean("Purpur.ShouldBurnInDay");
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+ // Purpur end - API for any mob to burn daylight
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
@@ -3580,6 +3587,33 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3580,6 +3587,34 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
this.hurt(this.damageSources().drown(), 1.0F);
|
||||
}
|
||||
|
||||
+ // Purpur start - copied from Zombie
|
||||
+ // Purpur start - copied from Zombie - API for any mob to burn daylight
|
||||
+ if (this.isAlive()) {
|
||||
+ boolean flag = shouldBurnInDay && this.isSunBurnTick(); // Paper - shouldBurnInDay API
|
||||
+ boolean flag = this.shouldBurnInDay() && this.isSunBurnTick(); // Paper - shouldBurnInDay API // Purpur - use shouldBurnInDay() method to handle Phantoms properly - API for any mob to burn daylight
|
||||
+
|
||||
+ if (flag) {
|
||||
+ ItemStack itemstack = this.getItemBySlot(EquipmentSlot.HEAD);
|
||||
@@ -89,19 +90,20 @@ index aa89957fd6b7fdf75ae4a98747f2032c23c84b2e..3b77111bdf50cd836d6e4199e6224b59
|
||||
+ }
|
||||
+
|
||||
+ if (flag) {
|
||||
+ if (getRider() == null || !this.isControllable()) // Purpur - ignore mobs which are uncontrollable or without rider - API for any mob to burn daylight
|
||||
+ this.igniteForSeconds(8.0F);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+ // Purpur end - copied from Zombie - API for any mob to burn daylight
|
||||
}
|
||||
|
||||
public boolean isSensitiveToWater() {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
index d69dc2f390b1afcbb2b3c57143e2181c879bb256..84827f266bddd75ee91e7e88e49caf6d66c58d2b 100644
|
||||
index 8b2dd71177b011c2a31e4959ca16057ad5288b22..6dfb13eef96ff43d368cd8163ae5883571cec604 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -1786,17 +1786,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||
@@ -1780,17 +1780,8 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||
protected void playAttackSound() {}
|
||||
|
||||
public boolean isSunBurnTick() {
|
||||
@@ -116,19 +118,20 @@ index d69dc2f390b1afcbb2b3c57143e2181c879bb256..84827f266bddd75ee91e7e88e49caf6d
|
||||
- }
|
||||
-
|
||||
- return false;
|
||||
+ // Purpur - implemented in Entity - API for any mob to burn daylight
|
||||
+ return super.isSunBurnTick();
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
index 5c1aa5859ac411098054be9f52bac0860ee667a5..f56580bdae043fa4e5e195481ae3d344fc725621 100644
|
||||
index 5c1aa5859ac411098054be9f52bac0860ee667a5..1d06c612eaba8b595fa3d094577f700989d1e224 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
@@ -66,6 +66,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
|
||||
protected AbstractSkeleton(EntityType<? extends AbstractSkeleton> type, Level world) {
|
||||
super(type, world);
|
||||
this.reassessWeaponGoal();
|
||||
+ this.setShouldBurnInDay(true); // Purpur
|
||||
+ this.setShouldBurnInDay(true); // Purpur - API for any mob to burn daylight
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -137,7 +140,7 @@ index 5c1aa5859ac411098054be9f52bac0860ee667a5..f56580bdae043fa4e5e195481ae3d344
|
||||
|
||||
// Paper start - shouldBurnInDay API
|
||||
- private boolean shouldBurnInDay = true;
|
||||
+ // private boolean shouldBurnInDay = true; // Purpur - moved to LivingEntity - keep methods for ABI compatibility
|
||||
+ //private boolean shouldBurnInDay = true; // Purpur - moved to LivingEntity; keep methods for ABI compatibility - API for any mob to burn daylight
|
||||
public boolean shouldBurnInDay() { return shouldBurnInDay; }
|
||||
public void setShouldBurnInDay(boolean shouldBurnInDay) { this.shouldBurnInDay = shouldBurnInDay; }
|
||||
// Paper end - shouldBurnInDay API
|
||||
@@ -168,37 +171,37 @@ index 5c1aa5859ac411098054be9f52bac0860ee667a5..f56580bdae043fa4e5e195481ae3d344
|
||||
- }
|
||||
- }
|
||||
-
|
||||
+ // Purpur start - implemented in LivingEntity
|
||||
+ // Purpur - implemented in LivingEntity - API for any mob to burn daylight
|
||||
super.aiStep();
|
||||
}
|
||||
|
||||
@@ -242,7 +220,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
|
||||
@@ -241,7 +219,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
|
||||
super.readAdditionalSaveData(nbt);
|
||||
this.reassessWeaponGoal();
|
||||
// Paper start - shouldBurnInDay API
|
||||
if (nbt.contains("Paper.ShouldBurnInDay")) {
|
||||
- this.shouldBurnInDay = nbt.getBoolean("Paper.ShouldBurnInDay");
|
||||
+ // this.shouldBurnInDay = nbt.getBoolean("Paper.ShouldBurnInDay"); // Purpur - implemented in LivingEntity
|
||||
- if (nbt.contains("Paper.ShouldBurnInDay")) {
|
||||
+ if (false && nbt.contains("Paper.ShouldBurnInDay")) { // Purpur - implemented in LivingEntity - API for any mob to burn daylight
|
||||
this.shouldBurnInDay = nbt.getBoolean("Paper.ShouldBurnInDay");
|
||||
}
|
||||
// Paper end - shouldBurnInDay API
|
||||
}
|
||||
@@ -251,7 +229,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
|
||||
@Override
|
||||
public void addAdditionalSaveData(CompoundTag nbt) {
|
||||
super.addAdditionalSaveData(nbt);
|
||||
- nbt.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay);
|
||||
+ // nbt.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); // Purpur - implemented in LivingEntity
|
||||
+ //nbt.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); // Purpur - implemented in LivingEntity - API for any mob to burn daylight
|
||||
}
|
||||
// Paper end - shouldBurnInDay API
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Husk.java b/src/main/java/net/minecraft/world/entity/monster/Husk.java
|
||||
index cb96bd5769159e6c25968673ea07cd6d107cff46..440c90feeae3a55c98e2011ecb27c28d58f11e6e 100644
|
||||
index cb96bd5769159e6c25968673ea07cd6d107cff46..cbfb5bf945b747328746d21395e66d523c268468 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Husk.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Husk.java
|
||||
@@ -20,6 +20,7 @@ public class Husk extends Zombie {
|
||||
|
||||
public Husk(EntityType<? extends Husk> type, Level world) {
|
||||
super(type, world);
|
||||
+ this.setShouldBurnInDay(false); // Purpur
|
||||
+ this.setShouldBurnInDay(false); // Purpur - API for any mob to burn daylight
|
||||
}
|
||||
|
||||
// Purpur start
|
||||
@@ -207,19 +210,19 @@ index cb96bd5769159e6c25968673ea07cd6d107cff46..440c90feeae3a55c98e2011ecb27c28d
|
||||
@Override
|
||||
public boolean isSunSensitive() {
|
||||
- return false;
|
||||
+ return this.shouldBurnInDay; // Purpur - moved to LivingEntity - keep methods for ABI compatibility
|
||||
+ return this.shouldBurnInDay; // Purpur - moved to LivingEntity; keep methods for ABI compatibility - API for any mob to burn daylight
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
index 554e01cf4fb3b15549c8c381274014c4735e08c6..df85753709271a6ad1f802da63f189200ead9a3a 100644
|
||||
index 554e01cf4fb3b15549c8c381274014c4735e08c6..f6b2e0797554baa3bc74e886e22d5bac67c424f6 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
@@ -59,6 +59,7 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
this.xpReward = 5;
|
||||
this.moveControl = new Phantom.PhantomMoveControl(this);
|
||||
this.lookControl = new Phantom.PhantomLookControl(this, this);
|
||||
+ this.setShouldBurnInDay(true); // Purpur
|
||||
+ this.setShouldBurnInDay(true); // Purpur - API for any mob to burn daylight
|
||||
}
|
||||
|
||||
// Purpur start
|
||||
@@ -236,7 +239,7 @@ index 554e01cf4fb3b15549c8c381274014c4735e08c6..df85753709271a6ad1f802da63f18920
|
||||
- this.igniteForSeconds(8.0F);
|
||||
- }
|
||||
-
|
||||
+ // Purpur - moved down to shouldBurnInDay()
|
||||
+ // Purpur - implemented in LivingEntity; moved down to shouldBurnInDay() - API for any mob to burn daylight
|
||||
super.aiStep();
|
||||
}
|
||||
|
||||
@@ -245,7 +248,7 @@ index 554e01cf4fb3b15549c8c381274014c4735e08c6..df85753709271a6ad1f802da63f18920
|
||||
this.spawningEntity = nbt.getUUID("Paper.SpawningEntity");
|
||||
}
|
||||
- if (nbt.contains("Paper.ShouldBurnInDay")) {
|
||||
+ if (false && nbt.contains("Paper.ShouldBurnInDay")) { // Purpur - implemented in LivingEntity
|
||||
+ if (false && nbt.contains("Paper.ShouldBurnInDay")) { // Purpur - implemented in LivingEntity - API for any mob to burn daylight
|
||||
this.shouldBurnInDay = nbt.getBoolean("Paper.ShouldBurnInDay");
|
||||
}
|
||||
// Paper end
|
||||
@@ -254,35 +257,29 @@ index 554e01cf4fb3b15549c8c381274014c4735e08c6..df85753709271a6ad1f802da63f18920
|
||||
nbt.putUUID("Paper.SpawningEntity", this.spawningEntity);
|
||||
}
|
||||
- nbt.putBoolean("Paper.ShouldBurnInDay", shouldBurnInDay);
|
||||
+ // nbt.putBoolean("Paper.ShouldBurnInDay", shouldBurnInDay); // Purpur - implemented in LivingEntity
|
||||
+ //nbt.putBoolean("Paper.ShouldBurnInDay", shouldBurnInDay); // Purpur - implemented in LivingEntity - API for any mob to burn daylight
|
||||
// Paper end
|
||||
}
|
||||
|
||||
@@ -356,8 +349,20 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
@@ -356,8 +349,14 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
return this.spawningEntity;
|
||||
}
|
||||
public void setSpawningEntity(java.util.UUID entity) { this.spawningEntity = entity; }
|
||||
- private boolean shouldBurnInDay = true;
|
||||
- public boolean shouldBurnInDay() { return shouldBurnInDay; }
|
||||
+
|
||||
+ // private boolean shouldBurnInDay = true; // Purpur - moved to LivingEntity - keep methods for ABI compatibility
|
||||
+ // Purpur start
|
||||
+ //private boolean shouldBurnInDay = true; // Purpur - moved to LivingEntity; keep methods for ABI compatibility - API for any mob to burn daylight
|
||||
+ // Purpur start - API for any mob to burn daylight
|
||||
+ public boolean shouldBurnInDay() {
|
||||
+ // Purpur start
|
||||
+ boolean burnFromDaylight = this.shouldBurnInDay && this.isSunBurnTick() && this.level().purpurConfig.phantomBurnInDaylight;
|
||||
+ boolean burnFromDaylight = this.shouldBurnInDay && this.level().purpurConfig.phantomBurnInDaylight;
|
||||
+ boolean burnFromLightSource = this.level().purpurConfig.phantomBurnInLight > 0 && this.level().getMaxLocalRawBrightness(blockPosition()) >= this.level().purpurConfig.phantomBurnInLight;
|
||||
+ if (this.isAlive() && (burnFromDaylight || burnFromLightSource)) { // Paper - shouldBurnInDay API
|
||||
+ // Purpur end
|
||||
+ if (getRider() == null || !this.isControllable()) // Purpur
|
||||
+ this.igniteForSeconds(8.0F);
|
||||
+ }
|
||||
+ return burnFromDaylight || burnFromLightSource;
|
||||
+ }
|
||||
+ // Purpur End
|
||||
+ // Purpur end - API for any mob to burn daylight
|
||||
public void setShouldBurnInDay(boolean shouldBurnInDay) { this.shouldBurnInDay = shouldBurnInDay; }
|
||||
// Paper end
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||||
index 1c2291c8a20541cc1e306efdd5263e5d8b3e0b16..c8a664447f19e437eb7c615563add92715be9650 100644
|
||||
index 1c2291c8a20541cc1e306efdd5263e5d8b3e0b16..dd3890d405c9eb5ad2630fc555f7c74fd3d76f6e 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||||
@@ -97,11 +97,12 @@ public class Zombie extends Monster {
|
||||
@@ -290,12 +287,12 @@ index 1c2291c8a20541cc1e306efdd5263e5d8b3e0b16..c8a664447f19e437eb7c615563add927
|
||||
public int conversionTime;
|
||||
private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field
|
||||
- private boolean shouldBurnInDay = true; // Paper - Add more Zombie API
|
||||
+ // private boolean shouldBurnInDay = true; // Paper - Add more Zombie API // Purpur - implemented in LivingEntity
|
||||
+ //private boolean shouldBurnInDay = true; // Paper - Add more Zombie API // Purpur - implemented in LivingEntity - API for any mob to burn daylight
|
||||
|
||||
public Zombie(EntityType<? extends Zombie> type, Level world) {
|
||||
super(type, world);
|
||||
this.breakDoorGoal = new BreakDoorGoal(this, com.google.common.base.Predicates.in(world.paperConfig().entities.behavior.doorBreakingDifficulty.getOrDefault(type, world.paperConfig().entities.behavior.doorBreakingDifficulty.get(EntityType.ZOMBIE)))); // Paper - Configurable door breaking difficulty
|
||||
+ this.setShouldBurnInDay(true); // Purpur
|
||||
+ this.setShouldBurnInDay(true); // Purpur - API for any mob to burn daylight
|
||||
}
|
||||
|
||||
public Zombie(Level world) {
|
||||
@@ -329,7 +326,7 @@ index 1c2291c8a20541cc1e306efdd5263e5d8b3e0b16..c8a664447f19e437eb7c615563add927
|
||||
- }
|
||||
- }
|
||||
-
|
||||
+ // Purpur - implemented in LivingEntity
|
||||
+ // Purpur - implemented in LivingEntity - API for any mob to burn daylight
|
||||
super.aiStep();
|
||||
}
|
||||
|
||||
@@ -337,7 +334,7 @@ index 1c2291c8a20541cc1e306efdd5263e5d8b3e0b16..c8a664447f19e437eb7c615563add927
|
||||
|
||||
}
|
||||
|
||||
+ public boolean shouldBurnInDay() { return isSunSensitive(); } // Purpur - for ABI compatibility
|
||||
+ public boolean shouldBurnInDay() { return this.isSunSensitive(); } // Purpur - for ABI compatibility - API for any mob to burn daylight
|
||||
public boolean isSunSensitive() {
|
||||
return this.shouldBurnInDay; // Paper - Add more Zombie API
|
||||
}
|
||||
@@ -346,52 +343,55 @@ index 1c2291c8a20541cc1e306efdd5263e5d8b3e0b16..c8a664447f19e437eb7c615563add927
|
||||
nbt.putInt("InWaterTime", this.isInWater() ? this.inWaterTime : -1);
|
||||
nbt.putInt("DrownedConversionTime", this.isUnderWaterConverting() ? this.conversionTime : -1);
|
||||
- nbt.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); // Paper - Add more Zombie API
|
||||
+ // nbt.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); // Paper - Add more Zombie API // Purpur - implemented in LivingEntity
|
||||
+ //nbt.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); // Paper - Add more Zombie API // Purpur - implemented in LivingEntity - API for any mob to burn daylight
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -502,7 +479,7 @@ public class Zombie extends Monster {
|
||||
@@ -501,7 +478,7 @@ public class Zombie extends Monster {
|
||||
this.startUnderWaterConversion(nbt.getInt("DrownedConversionTime"));
|
||||
}
|
||||
// Paper start - Add more Zombie API
|
||||
if (nbt.contains("Paper.ShouldBurnInDay")) {
|
||||
- this.shouldBurnInDay = nbt.getBoolean("Paper.ShouldBurnInDay");
|
||||
+ // this.shouldBurnInDay = nbt.getBoolean("Paper.ShouldBurnInDay"); // Purpur - implemented in LivingEntity
|
||||
- if (nbt.contains("Paper.ShouldBurnInDay")) {
|
||||
+ if (false && nbt.contains("Paper.ShouldBurnInDay")) { // Purpur - implemented in LivingEntity - API for any mob to burn daylight
|
||||
this.shouldBurnInDay = nbt.getBoolean("Paper.ShouldBurnInDay");
|
||||
}
|
||||
// Paper end - Add more Zombie API
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index 3629a6f99e99ca686446a23eea0329771c4d11cc..4c1303c5b9f631efd9497cf893a6ca0348157f2c 100644
|
||||
index 84479dad6078a2a12e6b977185bdbbe7f6b36576..ef550741b2173a1a6f24c3bc532bb530eccd6217 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -86,6 +86,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
@@ -86,6 +86,13 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
this.entityType = CraftEntityType.minecraftToBukkit(entity.getType());
|
||||
}
|
||||
|
||||
+ // Purpur start - API for any mob to burn daylight
|
||||
+ @Override
|
||||
+ public boolean isInDaylight() {
|
||||
+ return getHandle().isSunBurnTick();
|
||||
+ }
|
||||
+ // Purpur end - API for any mob to burn daylight
|
||||
+
|
||||
public static <T extends Entity> CraftEntity getEntity(CraftServer server, T entity) {
|
||||
Preconditions.checkArgument(entity != null, "Unknown entity");
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
index 386647f6000c71c59ab8d7875219eefdc5a3d7ef..88be8ebe619f2e42bdffab534da4f269b802cf41 100644
|
||||
index a1e715629313346f670bce92483996122b0f1d7b..26eaf4d9b931bfe51482e1f5d2350fc591778acc 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -1188,5 +1188,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
if (slot == null) return;
|
||||
getHandle().broadcastBreakEvent(org.bukkit.craftbukkit.CraftEquipmentSlot.getNMS(slot));
|
||||
@@ -1181,4 +1181,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
this.getHandle().setYBodyRot(bodyYaw);
|
||||
}
|
||||
// Paper end - body yaw API
|
||||
+
|
||||
+ // Purpur start - API for any mob to burn daylight
|
||||
+ @Override
|
||||
+ public boolean shouldBurnInDay() {
|
||||
+ return getHandle().shouldBurnInDay();
|
||||
+ return this.getHandle().shouldBurnInDay();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setShouldBurnInDay(boolean shouldBurnInDay) {
|
||||
+ getHandle().setShouldBurnInDay(shouldBurnInDay);
|
||||
+ public void setShouldBurnInDay(final boolean shouldBurnInDay) {
|
||||
+ this.getHandle().setShouldBurnInDay(shouldBurnInDay);
|
||||
+ }
|
||||
// Purpur end
|
||||
+ // Purpur end - API for any mob to burn daylight
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user