mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 08:27:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@46c6f49 Fix Registry#getKey implementation PaperMC/Paper@4c6ea84 move junit platform dep to -server and -api PaperMC/Paper@c31d95e remove test plugin diff accidentally committed PaperMC/Paper@90d50aa update .editorconfig PaperMC/Paper@8ad15d6 Update minecraft dir references PaperMC/Paper@083c083 Fix a bunch more issues arising from mutable types (#11769) PaperMC/Paper@eb793c3 [ci skip] more cleanup from repo reorg PaperMC/Paper@f8bf600 Fix potion effect type removal (#11778) PaperMC/Paper@188124b Fix totems negating incorrect item (#11776) PaperMC/Paper@a0b3326 refactor registry entry to detach 'delayed' from other meta PaperMC/Paper@cbf630d Move missing import into feature patches to fix pre-features compile PaperMC/Paper@17f649d Fix PlayerTradeEvent visual issue when being cancelled (#11773) PaperMC/Paper@976b0a4 [ci skip] Simplify and update contribution guidelines PaperMC/Paper@63c94c9 [ci skip] Comment out update tasks, update comments PaperMC/Paper@62d4130 [ci skip] Fix Inventory#addItem javadoc mismatch with behaviour (#11782) PaperMC/Paper@bd4c235 Throw during plugin update folder process on failed rename/delete (#11784) PaperMC/Paper@793d361 Fix recipe book items order (#11787) PaperMC/Paper@c768099 Fix tripwires (#11790) PaperMC/Paper@17d76ae Correctly die when cancelling EntityResurrectEvent (#11785) PaperMC/Paper@aa2c52b Fix dropper inventory var PaperMC/Paper@d0d0efe Partially revert 083c083188 for Transformation (#11798) PaperMC/Paper@b8a0541 Fix 0 parameter in Player#applyMending (#11802) PaperMC/Paper@9e2d39c Fix double chest identification (#11812) PaperMC/Paper@321d17c [ci skip] Only build PRs on correct label (#11811) PaperMC/Paper@d568e17 Port basic lookAt methods from Player to Entity (#11775) PaperMC/Paper@25cc3d8 Fix EnchantmentView#setOffers length precondition being flipped (#11818) PaperMC/Paper@763b32d Fix framed maps looping through all players in world (#11819) PaperMC/Paper@946314f Remove disableTeleportationSuffocationCheck config (#11822) PaperMC/Paper@140577b Fix broken field rename compat for instrument "feel_goat_horn" (#11824) PaperMC/Paper@a07cec1 Add effective name to ItemStack (#11770) PaperMC/Paper@3a479ea Add Registry#getTags (#11795) PaperMC/Paper@d85d318 Fix NullPointerException in PlayerInteractEvent#getClickedPosition (#11827) PaperMC/Paper@3331805 Deprecate #furnace_materials item tag (#11823) PaperMC/Paper@c9a904e Fix keepalive logic resetting counter PaperMC/Paper@a8f850a temporarily revert OldEnum toString changes (#11829) PaperMC/Paper@a14c06b fix annotation test for null marked inner classes (#11826) PaperMC/Paper@f51aa3e Fix BlockRedstoneEvent for tripwire hooks (#11791) PaperMC/Paper@af2812f For new registry values, allow copying from existing (#11796) PaperMC/Paper@0efd301 Fix suggestions for ResourceLocation (#11830) PaperMC/Paper@aac246a Expand on entity serialization API (#11807) PaperMC/Paper@953f6f9 Banner pattern registry modification (#11803) PaperMC/Paper@a5b8df6 add tagkey file for entity type (#11832) PaperMC/Paper@c530c39 More var name fixes PaperMC/Paper@2b73d19 More var name fixes PaperMC/Paper@326c687 Fix whack diff from last commit PaperMC/Paper@13c94e4 Updated adventure to 4.18.0 (#11809) PaperMC/Paper@ca8709b Fix more incorrect array nullability annotations (#11836) PaperMC/Paper@e10dcbf [ci skip] Improve build workflow conditions (#11842) PaperMC/Paper@b4051db Handle disabled vanilla registry values correctly (#11781) PaperMC/Paper@4b89390 Fix contextual map renderer memory leak (#11841) PaperMC/Paper@5c7537c Add DamageType RegistryEvent (#11783) PaperMC/Paper@33411ec Properly remove UnsafeValues#getDamageEffect PaperMC/Paper@0629524 Directly build Art (#11813) PaperMC/Paper@e0abc5f Do not spawn fire for visual lightning (#11845) PaperMC/Paper@dac977a Correctly force particles (#11850) PaperMC/Paper@feb8756 Add datapack registration lifecycle event (#11804) PaperMC/Paper@18da1ae [ci skip] update DiscoveredDatapack javadoc PaperMC/Paper@93a3df0 Extend HumanEntity#dropItem API (#11810) PaperMC/Paper@287eb52 Use hidden classes for event executors (#11848) PaperMC/Paper@887f3f7 [ci skip] Replace FQN with import in EventExecutor PaperMC/Paper@d00344a update jb annotations to 26.0.1 (#11860) PaperMC/Paper@60edd61 [ci skip] Fix spelling of ignition's word into javadoc (#11864) PaperMC/Paper@a81990e Update mache, fixes dev bundle use with Java 23 PaperMC/Paper@1e4669e [ci skip] Clarify loot table behavior when set to null. (#11861) PaperMC/Paper@9298f59 Update paperweight to 2.0.0-beta.10 PaperMC/Paper@bdfad1c Add sendRich/PlainMessage methods to Server (#11872) PaperMC/Paper@1dd52be Use playerlist whitelist status instead of properties PaperMC/Paper@83995d7 Fix settings changes not being saved (#11881) PaperMC/Paper@daddcf6 Fix JOML javadoc URL (#11883) PaperMC/Paper@edde726 [ci skip] Add missing Nullable annotations for NMS DamageSource (#11875) PaperMC/Paper@4106da7 Fix retain passengers teleport flag (#11858) PaperMC/Paper@6ab1352 Improve performance of PoiCompetitorScan by unrolling stream (#11871) PaperMC/Paper@33a590b Fix TargetHitEvent#getSignalStrength() post-hard-fork (#11897) PaperMC/Paper@f367f10 Add rotation helpers to Location (#11908) PaperMC/Paper@9f90b4c Fix ItemDamageEvents called for 0 damage (#11900) PaperMC/Paper@486e521 Re-add droped MapLike spam fix (#11917) PaperMC/Paper@3375570 Fix MapCanvas#drawImage (#11865) PaperMC/Paper@49d15f6 Fix DiscoveredDatapack#getSource (#11928) PaperMC/Paper@b34ae4f Fix wolves ignoring result of damage event (#11932) PaperMC/Paper@efdcaa2 Fix removing the "LootTable" nbt tag from Block entities (#11929) PaperMC/Paper@55f3f28 Reimplement ItemStack Obfuscation (#11817) PaperMC/Paper@08fc33c Update CustomTimingsHandler Nag Message (#11923) PaperMC/Paper@5e14504 [ci skip] Add missing deprecated docs for isEnabledByFeature (#11938) PaperMC/Paper@4007171 Correct obfuscation of oversized items (#11944) PaperMC/Paper@1b38f28 Fix reading recipes used on furnace (#11947) PaperMC/Paper@b03d39b [ci skip] Update paperweight to 2.0.0-beta.13 PaperMC/Paper@6316a50 Make CraftServer#isPrimaryThread use TickThread check PaperMC/Paper@ea7b961 Fix MapItem incorectly fetching water biomes on treasure maps (#11936) PaperMC/Paper@b242f1e Prevent day cycle on the client when using fixed time (#11924) PaperMC/Paper@3e42518 Fix snow accumulating in custom biomes without precipitation (#11854) PaperMC/Paper@3d9ecc4 Log thread check parameters when the thread check fails PaperMC/Paper@3ad3fbc Update to Concurrentutil 0.0.3 PaperMC/Paper@79ffcd1 Fix vanilla parity on enchantable items with no targets (#11896) PaperMC/Paper@19ddbef Fix InventoryAction wrong for Bundles (#11902) PaperMC/Paper@ac3aaa2 Don't use delayed registries in impl anywhere (#11918) PaperMC/Paper@775002a [ci skip] Remove nullable from SyncedEntityData#packAll (#11949) PaperMC/Paper@c949225 MenuType API addition InventoryView Builders (#11816) PaperMC/Paper@c2f24e1 Feat: Add 'with' methods to CommandSourceStack (#11868) PaperMC/Paper@ed75b0e Disallow calling JavaPlugin#getCommand during onEnable for Paper plugins (#11914) PaperMC/Paper@08ac057 Rename getPotentialBedLocation to getPotentialRespawnLocation (#11950) PaperMC/Paper@9746d73 Add back known movement check PaperMC/Paper@e5542cf Hide unnecessary decorated pot data (#11957) PaperMC/Paper@eb4db79 Make CommandSourceStack respect hidden players (#11898) PaperMC/Paper@76617dd Add EntityEffectTickEvent (#11838) PaperMC/Paper@86c6308 Fix locate command dist overflow/underflow (#11956) PaperMC/Paper@2ea6aee Deprecate Turtle#isDigging (#11959) PaperMC/Paper@ad74b67 Fix client visual desync if cooldown events are cancelled (#11892) PaperMC/Paper@50c2c59 Fix unstable Suggestion comparison by sorting int suggestions before text ones (#11941) PaperMC/Paper@3709150 Expose all possible block data states (#11958) PaperMC/Paper@5e23d28 Remove entity tag selector tag completion fix (#11964) PaperMC/Paper@ab1b312 Call PlayerItemDamageEvent for tridents (#11899) PaperMC/Paper@1bb3677 Remove deprecation from EntityRemoveEvent (#11961) PaperMC/Paper@d69981b [ci skip] Remove redundant build configuration PaperMC/Paper@6fde26d remove .paperassetsroot PaperMC/Paper@fe75eaf split direct holder support up from ctor accepting Holder
345 lines
18 KiB
Diff
345 lines
18 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Ben Kerllenevich <ben@omega24.dev>
|
|
Date: Tue, 25 May 2021 16:31:09 -0400
|
|
Subject: [PATCH] API for any mob to burn daylight
|
|
|
|
Co-authored by: Encode42 <me@encode42.dev>
|
|
|
|
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
|
index e4ee886f33ee63ae740cd89067c8ec81c12f2a62..f61c29abf75443b206f37b90950d6c0e14ea59ff 100644
|
|
--- a/net/minecraft/world/entity/Entity.java
|
|
+++ b/net/minecraft/world/entity/Entity.java
|
|
@@ -534,6 +534,24 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
|
}
|
|
// Purpur end - Add canSaveToDisk to Entity
|
|
|
|
+ // Purpur start - copied from Mob - API for any mob to burn daylight
|
|
+ public boolean isSunBurnTick() {
|
|
+ if (this.level().isDay() && !this.level().isClientSide) {
|
|
+ float lightLevelDependentMagicValue = this.getLightLevelDependentMagicValue();
|
|
+ BlockPos blockPos = BlockPos.containing(this.getX(), this.getEyeY(), this.getZ());
|
|
+ boolean flag = this.isInWaterRainOrBubble() || this.isInPowderSnow || this.wasInPowderSnow;
|
|
+ if (lightLevelDependentMagicValue > 0.5F
|
|
+ && this.random.nextFloat() * 30.0F < (lightLevelDependentMagicValue - 0.4F) * 2.0F
|
|
+ && !flag
|
|
+ && this.level().canSeeSky(blockPos)) {
|
|
+ return true;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ return false;
|
|
+ }
|
|
+ // Purpur end - copied from Mob - API for any mob to burn daylight
|
|
+
|
|
public Entity(EntityType<?> entityType, Level level) {
|
|
this.type = entityType;
|
|
this.level = level;
|
|
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
|
|
index 2dc588e2d503c16ccd2589ce18abd2ecebbc8e74..db5a2227009bc4d655fc781d5850221f36f2d112 100644
|
|
--- a/net/minecraft/world/entity/LivingEntity.java
|
|
+++ b/net/minecraft/world/entity/LivingEntity.java
|
|
@@ -301,6 +301,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 - API for any mob to burn daylight
|
|
|
|
@Override
|
|
public float getBukkitYaw() {
|
|
@@ -809,6 +810,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
|
});
|
|
DataResult<Tag> dataResult = this.brain.serializeStart(NbtOps.INSTANCE);
|
|
dataResult.resultOrPartial(LOGGER::error).ifPresent(brain -> compound.put("Brain", brain));
|
|
+ compound.putBoolean("Purpur.ShouldBurnInDay", this.shouldBurnInDay); // Purpur - API for any mob to burn daylight
|
|
}
|
|
|
|
@Override
|
|
@@ -892,6 +894,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
|
if (compound.contains("Brain", 10)) {
|
|
this.brain = this.makeBrain(new Dynamic<>(NbtOps.INSTANCE, compound.get("Brain")));
|
|
}
|
|
+
|
|
+ // Purpur start - API for any mob to burn daylight
|
|
+ if (compound.contains("Purpur.ShouldBurnInDay")) {
|
|
+ this.shouldBurnInDay = compound.getBoolean("Purpur.ShouldBurnInDay");
|
|
+ }
|
|
+ // Purpur end - API for any mob to burn daylight
|
|
}
|
|
|
|
// CraftBukkit start
|
|
@@ -3574,6 +3582,32 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
|
if (this.level() instanceof ServerLevel serverLevel && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) {
|
|
this.hurtServer(serverLevel, this.damageSources().drown(), 1.0F);
|
|
}
|
|
+
|
|
+ // Purpur start - copied from Zombie - API for any mob to burn daylight
|
|
+ if (this.isAlive()) {
|
|
+ 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 itemBySlot = this.getItemBySlot(EquipmentSlot.HEAD);
|
|
+ if (!itemBySlot.isEmpty()) {
|
|
+ if (itemBySlot.isDamageableItem()) {
|
|
+ Item item = itemBySlot.getItem();
|
|
+ itemBySlot.setDamageValue(itemBySlot.getDamageValue() + this.random.nextInt(2));
|
|
+ if (itemBySlot.getDamageValue() >= itemBySlot.getMaxDamage()) {
|
|
+ this.onEquippedItemBroken(item, EquipmentSlot.HEAD);
|
|
+ this.setItemSlot(EquipmentSlot.HEAD, ItemStack.EMPTY);
|
|
+ }
|
|
+ }
|
|
+
|
|
+ flag = false;
|
|
+ }
|
|
+
|
|
+ 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 - copied from Zombie - API for any mob to burn daylight
|
|
}
|
|
|
|
public boolean isSensitiveToWater() {
|
|
diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java
|
|
index d93584c6793818463e8883ffe399bf16b03263a9..70ee86993d381445855ac7e7290da384d6675987 100644
|
|
--- a/net/minecraft/world/entity/Mob.java
|
|
+++ b/net/minecraft/world/entity/Mob.java
|
|
@@ -1655,19 +1655,8 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
|
}
|
|
|
|
public boolean isSunBurnTick() {
|
|
- if (this.level().isDay() && !this.level().isClientSide) {
|
|
- float lightLevelDependentMagicValue = this.getLightLevelDependentMagicValue();
|
|
- BlockPos blockPos = BlockPos.containing(this.getX(), this.getEyeY(), this.getZ());
|
|
- boolean flag = this.isInWaterRainOrBubble() || this.isInPowderSnow || this.wasInPowderSnow;
|
|
- if (lightLevelDependentMagicValue > 0.5F
|
|
- && this.random.nextFloat() * 30.0F < (lightLevelDependentMagicValue - 0.4F) * 2.0F
|
|
- && !flag
|
|
- && this.level().canSeeSky(blockPos)) {
|
|
- return true;
|
|
- }
|
|
- }
|
|
-
|
|
- return false;
|
|
+ // Purpur - implemented in Entity - API for any mob to burn daylight
|
|
+ return super.isSunBurnTick();
|
|
}
|
|
|
|
@Override
|
|
diff --git a/net/minecraft/world/entity/monster/AbstractSkeleton.java b/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
|
index e186aee80b052b7fc4bfe02763010bfb2d55ea35..223739818e9ac6c9fe396b82bce53a3ab029610a 100644
|
|
--- a/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
|
+++ b/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
|
@@ -64,11 +64,12 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
|
|
AbstractSkeleton.this.setAggressive(true);
|
|
}
|
|
};
|
|
- private boolean shouldBurnInDay = true; // Paper - shouldBurnInDay API
|
|
+ //private boolean shouldBurnInDay = true; // Paper - shouldBurnInDay API // Purpur - moved to LivingEntity; keep methods for ABI compatibility - API for any mob to burn daylight
|
|
|
|
protected AbstractSkeleton(EntityType<? extends AbstractSkeleton> entityType, Level level) {
|
|
super(entityType, level);
|
|
this.reassessWeaponGoal();
|
|
+ this.setShouldBurnInDay(true); // Purpur - API for any mob to burn daylight
|
|
}
|
|
|
|
@Override
|
|
@@ -110,27 +111,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
|
|
|
|
@Override
|
|
public void aiStep() {
|
|
- boolean isSunBurnTick = this.shouldBurnInDay && this.isSunBurnTick(); // Paper - shouldBurnInDay API
|
|
- if (isSunBurnTick) {
|
|
- ItemStack itemBySlot = this.getItemBySlot(EquipmentSlot.HEAD);
|
|
- if (!itemBySlot.isEmpty()) {
|
|
- if (itemBySlot.isDamageableItem()) {
|
|
- Item item = itemBySlot.getItem();
|
|
- itemBySlot.setDamageValue(itemBySlot.getDamageValue() + this.random.nextInt(2));
|
|
- if (itemBySlot.getDamageValue() >= itemBySlot.getMaxDamage()) {
|
|
- this.onEquippedItemBroken(item, EquipmentSlot.HEAD);
|
|
- this.setItemSlot(EquipmentSlot.HEAD, ItemStack.EMPTY);
|
|
- }
|
|
- }
|
|
-
|
|
- isSunBurnTick = false;
|
|
- }
|
|
-
|
|
- if (isSunBurnTick) {
|
|
- this.igniteForSeconds(8.0F);
|
|
- }
|
|
- }
|
|
-
|
|
+ // Purpur - implemented in LivingEntity - API for any mob to burn daylight
|
|
super.aiStep();
|
|
}
|
|
|
|
@@ -243,7 +224,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
|
|
super.readAdditionalSaveData(compound);
|
|
this.reassessWeaponGoal();
|
|
// Paper start - shouldBurnInDay API
|
|
- if (compound.contains("Paper.ShouldBurnInDay")) {
|
|
+ if (false && compound.contains("Paper.ShouldBurnInDay")) { // Purpur - implemented in LivingEntity - API for any mob to burn daylight
|
|
this.shouldBurnInDay = compound.getBoolean("Paper.ShouldBurnInDay");
|
|
}
|
|
// Paper end - shouldBurnInDay API
|
|
@@ -252,7 +233,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
|
|
@Override
|
|
public void addAdditionalSaveData(final net.minecraft.nbt.CompoundTag nbt) {
|
|
super.addAdditionalSaveData(nbt);
|
|
- nbt.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay);
|
|
+ //nbt.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); // Purpur - implemented in LivingEntity - API for any mob to burn daylight
|
|
}
|
|
// Paper end - shouldBurnInDay API
|
|
|
|
diff --git a/net/minecraft/world/entity/monster/Husk.java b/net/minecraft/world/entity/monster/Husk.java
|
|
index 31eef2869945d9de565d627cac3fc1a5db380a2a..e618e716cb5ff3a3c5d284e985455694cc0edde0 100644
|
|
--- a/net/minecraft/world/entity/monster/Husk.java
|
|
+++ b/net/minecraft/world/entity/monster/Husk.java
|
|
@@ -19,6 +19,7 @@ import net.minecraft.world.level.ServerLevelAccessor;
|
|
public class Husk extends Zombie {
|
|
public Husk(EntityType<? extends Husk> entityType, Level level) {
|
|
super(entityType, level);
|
|
+ this.setShouldBurnInDay(false); // Purpur - API for any mob to burn daylight
|
|
}
|
|
|
|
// Purpur start - Ridables
|
|
@@ -82,7 +83,7 @@ public class Husk extends Zombie {
|
|
|
|
@Override
|
|
public boolean isSunSensitive() {
|
|
- return false;
|
|
+ return this.shouldBurnInDay; // Purpur - moved to LivingEntity; keep methods for ABI compatibility - API for any mob to burn daylight
|
|
}
|
|
|
|
@Override
|
|
diff --git a/net/minecraft/world/entity/monster/Phantom.java b/net/minecraft/world/entity/monster/Phantom.java
|
|
index 32b7c34d3c68dcfa936b628b2d038524204129a3..0ee817699fffbb929011465029182cc56befc30c 100644
|
|
--- a/net/minecraft/world/entity/monster/Phantom.java
|
|
+++ b/net/minecraft/world/entity/monster/Phantom.java
|
|
@@ -60,6 +60,7 @@ public class Phantom extends FlyingMob implements Enemy {
|
|
this.xpReward = 5;
|
|
this.moveControl = new Phantom.PhantomMoveControl(this);
|
|
this.lookControl = new Phantom.PhantomLookControl(this);
|
|
+ this.setShouldBurnInDay(true); // Purpur - API for any mob to burn daylight
|
|
}
|
|
|
|
// Purpur start - Ridables
|
|
@@ -146,6 +147,16 @@ public class Phantom extends FlyingMob implements Enemy {
|
|
}
|
|
// Purpur end - Toggle for water sensitive mob damage
|
|
|
|
+ //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() {
|
|
+ boolean burnFromDaylight = this.shouldBurnInDay && this.level().purpurConfig.phantomBurnInDaylight;
|
|
+ boolean burnFromLightSource = this.level().purpurConfig.phantomBurnInLight > 0 && this.level().getMaxLocalRawBrightness(blockPosition()) >= this.level().purpurConfig.phantomBurnInLight;
|
|
+ return burnFromDaylight || burnFromLightSource;
|
|
+ }
|
|
+ public void setShouldBurnInDay(boolean shouldBurnInDay) { this.shouldBurnInDay = shouldBurnInDay; }
|
|
+ // Purpur end - API for any mob to burn daylight
|
|
+
|
|
@Override
|
|
public boolean isFlapping() {
|
|
return (this.getUniqueFlapTickOffset() + this.tickCount) % TICKS_PER_FLAP == 0;
|
|
@@ -261,6 +272,7 @@ public class Phantom extends FlyingMob implements Enemy {
|
|
|
|
@Override
|
|
public void aiStep() {
|
|
+ // Purpur - implemented in LivingEntity; moved down to shouldBurnInDay() - API for any mob to burn daylight
|
|
// Purpur start - Phantoms burn in light
|
|
boolean burnFromDaylight = this.shouldBurnInDay && this.isSunBurnTick() && this.level().purpurConfig.phantomBurnInDaylight;
|
|
boolean burnFromLightSource = this.level().purpurConfig.phantomBurnInLight > 0 && this.level().getMaxLocalRawBrightness(blockPosition()) >= this.level().purpurConfig.phantomBurnInLight;
|
|
@@ -299,7 +311,7 @@ public class Phantom extends FlyingMob implements Enemy {
|
|
if (compound.hasUUID("Paper.SpawningEntity")) {
|
|
this.spawningEntity = compound.getUUID("Paper.SpawningEntity");
|
|
}
|
|
- if (compound.contains("Paper.ShouldBurnInDay")) {
|
|
+ if (false && compound.contains("Paper.ShouldBurnInDay")) { // Purpur - implemented in LivingEntity - API for any mob to burn daylight
|
|
this.shouldBurnInDay = compound.getBoolean("Paper.ShouldBurnInDay");
|
|
}
|
|
// Paper end
|
|
@@ -316,7 +328,7 @@ public class Phantom extends FlyingMob implements Enemy {
|
|
if (this.spawningEntity != null) {
|
|
compound.putUUID("Paper.SpawningEntity", this.spawningEntity);
|
|
}
|
|
- compound.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay);
|
|
+ //compound.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); // Purpur - implemented in LivingEntity - API for any mob to burn daylight
|
|
// Paper end
|
|
}
|
|
|
|
diff --git a/net/minecraft/world/entity/monster/Zombie.java b/net/minecraft/world/entity/monster/Zombie.java
|
|
index 5d12bc139c81ca342074c7c745635669020d0300..f8d41ce860c5f48ab9b5e4b79a554dab85d2ba9b 100644
|
|
--- a/net/minecraft/world/entity/monster/Zombie.java
|
|
+++ b/net/minecraft/world/entity/monster/Zombie.java
|
|
@@ -89,11 +89,12 @@ public class Zombie extends Monster {
|
|
private boolean canBreakDoors;
|
|
private int inWaterTime;
|
|
public int conversionTime;
|
|
- private boolean shouldBurnInDay = true; // Paper - Add more Zombie API
|
|
+ //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> entityType, Level level) {
|
|
super(entityType, level);
|
|
this.breakDoorGoal = new BreakDoorGoal(this, com.google.common.base.Predicates.in(level.paperConfig().entities.behavior.doorBreakingDifficulty.getOrDefault(entityType, level.paperConfig().entities.behavior.doorBreakingDifficulty.get(EntityType.ZOMBIE)))); // Paper - Configurable door breaking difficulty
|
|
+ this.setShouldBurnInDay(true); // Purpur - API for any mob to burn daylight
|
|
}
|
|
|
|
public Zombie(Level level) {
|
|
@@ -290,29 +291,7 @@ public class Zombie extends Monster {
|
|
|
|
@Override
|
|
public void aiStep() {
|
|
- if (this.isAlive()) {
|
|
- boolean flag = this.isSunSensitive() && this.isSunBurnTick();
|
|
- if (flag) {
|
|
- ItemStack itemBySlot = this.getItemBySlot(EquipmentSlot.HEAD);
|
|
- if (!itemBySlot.isEmpty()) {
|
|
- if (itemBySlot.isDamageableItem()) {
|
|
- Item item = itemBySlot.getItem();
|
|
- itemBySlot.setDamageValue(itemBySlot.getDamageValue() + this.random.nextInt(2));
|
|
- if (itemBySlot.getDamageValue() >= itemBySlot.getMaxDamage()) {
|
|
- this.onEquippedItemBroken(item, EquipmentSlot.HEAD);
|
|
- this.setItemSlot(EquipmentSlot.HEAD, ItemStack.EMPTY);
|
|
- }
|
|
- }
|
|
-
|
|
- flag = false;
|
|
- }
|
|
-
|
|
- if (flag) {
|
|
- this.igniteForSeconds(8.0F);
|
|
- }
|
|
- }
|
|
- }
|
|
-
|
|
+ // Purpur - implemented in LivingEntity - API for any mob to burn daylight
|
|
super.aiStep();
|
|
}
|
|
|
|
@@ -371,6 +350,7 @@ public class Zombie extends Monster {
|
|
// CraftBukkit end
|
|
}
|
|
|
|
+ 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
|
|
}
|
|
@@ -509,7 +489,7 @@ public class Zombie extends Monster {
|
|
compound.putBoolean("CanBreakDoors", this.canBreakDoors());
|
|
compound.putInt("InWaterTime", this.isInWater() ? this.inWaterTime : -1);
|
|
compound.putInt("DrownedConversionTime", this.isUnderWaterConverting() ? this.conversionTime : -1);
|
|
- compound.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); // Paper - Add more Zombie API
|
|
+ //compound.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); // Paper - Add more Zombie API // Purpur - implemented in LivingEntity - API for any mob to burn daylight
|
|
}
|
|
|
|
@Override
|
|
@@ -522,7 +502,7 @@ public class Zombie extends Monster {
|
|
this.startUnderWaterConversion(compound.getInt("DrownedConversionTime"));
|
|
}
|
|
// Paper start - Add more Zombie API
|
|
- if (compound.contains("Paper.ShouldBurnInDay")) {
|
|
+ if (false && compound.contains("Paper.ShouldBurnInDay")) { // Purpur - implemented in LivingEntity - API for any mob to burn daylight
|
|
this.shouldBurnInDay = compound.getBoolean("Paper.ShouldBurnInDay");
|
|
}
|
|
// Paper end - Add more Zombie API
|