mirror of https://github.com/YatopiaMC/Yatopia.git
112 lines
7.8 KiB
Diff
112 lines
7.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: draycia <lonelyyordle@gmail.com>
|
|
Date: Sun, 12 Apr 2020 20:41:59 -0700
|
|
Subject: [PATCH] Phantoms burn in light
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityPhantom.java b/src/main/java/net/minecraft/world/entity/monster/EntityPhantom.java
|
|
index daf738e8f0987aa6ab200189d7a26d166918b8fc..07ede7b75a65a5815f1ae1ebf03ec0fdb4621afb 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/EntityPhantom.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/EntityPhantom.java
|
|
@@ -18,6 +18,7 @@ import net.minecraft.sounds.SoundEffect;
|
|
import net.minecraft.sounds.SoundEffects;
|
|
import net.minecraft.util.MathHelper;
|
|
import net.minecraft.world.DifficultyDamageScaler;
|
|
+import net.minecraft.world.EnumHand;
|
|
import net.minecraft.world.damagesource.DamageSource;
|
|
import net.minecraft.world.entity.Entity;
|
|
import net.minecraft.world.entity.EntityFlying;
|
|
@@ -41,6 +42,7 @@ import net.minecraft.world.entity.boss.enderdragon.EntityEnderCrystal;
|
|
import net.minecraft.world.entity.player.EntityHuman;
|
|
import net.minecraft.world.item.ItemStack;
|
|
import net.minecraft.world.item.Items;
|
|
+import net.minecraft.world.item.crafting.RecipeItemStack;
|
|
import net.minecraft.world.level.World;
|
|
import net.minecraft.world.level.WorldAccess;
|
|
import net.minecraft.world.level.levelgen.HeightMap;
|
|
@@ -54,6 +56,7 @@ public class EntityPhantom extends EntityFlying implements IMonster {
|
|
private BlockPosition d; public void setHome(BlockPosition home) { this.d = home; } public BlockPosition getHome() { return this.d; } // Purpur - OBFHELPER
|
|
private EntityPhantom.AttackPhase bo; public AttackPhase getAttackPhase() { return this.bo; } // Purpur - OBFHELPER
|
|
private Vec3D crystalPosition; // Purpur
|
|
+ private static final RecipeItemStack TORCH = RecipeItemStack.a(Items.torch(), Items.soulTorch()); // Purpur
|
|
|
|
public EntityPhantom(EntityTypes<? extends EntityPhantom> entitytypes, World world) {
|
|
super(entitytypes, world);
|
|
@@ -166,7 +169,7 @@ public class EntityPhantom extends EntityFlying implements IMonster {
|
|
|
|
@Override
|
|
public void movementTick() {
|
|
- if (this.isAlive() && this.eG()) {
|
|
+ if (this.isAlive() && ((world.purpurConfig.phantomBurnInDaylight && this.isInDaylight()) || (world.purpurConfig.phantomBurnInLight > 0 && world.getLightLevel(new BlockPosition(this)) >= world.purpurConfig.phantomBurnInLight))) { // Purpur
|
|
this.setOnFire(8);
|
|
}
|
|
|
|
@@ -416,7 +419,7 @@ public class EntityPhantom extends EntityFlying implements IMonster {
|
|
} else {
|
|
this.c = 60;
|
|
List<EntityHuman> list = EntityPhantom.this.world.a(this.b, (EntityLiving) EntityPhantom.this, EntityPhantom.this.getBoundingBox().grow(16.0D, 64.0D, 16.0D));
|
|
-
|
|
+ if (world.purpurConfig.phantomIgnorePlayersWithTorch) list.removeIf(human -> TORCH.test(human.getItemInHand(EnumHand.MAIN_HAND)) || TORCH.test(human.getItemInHand(EnumHand.OFF_HAND)));// Purpur
|
|
if (!list.isEmpty()) {
|
|
list.sort(Comparator.comparing(Entity::locY).reversed());
|
|
Iterator iterator = list.iterator();
|
|
@@ -515,6 +518,12 @@ public class EntityPhantom extends EntityFlying implements IMonster {
|
|
return false;
|
|
} else if (entityliving instanceof EntityHuman && (((EntityHuman) entityliving).isSpectator() || ((EntityHuman) entityliving).isCreative())) {
|
|
return false;
|
|
+ // Purpur start
|
|
+ } else if (world.purpurConfig.phantomBurnInLight > 0 && world.getLightLevel(new BlockPosition(EntityPhantom.this)) >= world.purpurConfig.phantomBurnInLight) {
|
|
+ return false;
|
|
+ } else if (world.purpurConfig.phantomIgnorePlayersWithTorch && (TORCH.test(entityliving.getItemInHand(EnumHand.MAIN_HAND)) || TORCH.test(entityliving.getItemInHand(EnumHand.OFF_HAND)))) {
|
|
+ return false;
|
|
+ // Purpur end
|
|
} else if (!this.a()) {
|
|
return false;
|
|
} else {
|
|
diff --git a/src/main/java/net/minecraft/world/item/Items.java b/src/main/java/net/minecraft/world/item/Items.java
|
|
index 993a88a5937417016821ef9d7cd58e4ee097491c..64b4fcf6f43c39db0fe57fc7a74f0d954e966a61 100644
|
|
--- a/src/main/java/net/minecraft/world/item/Items.java
|
|
+++ b/src/main/java/net/minecraft/world/item/Items.java
|
|
@@ -187,7 +187,7 @@ public class Items {
|
|
public static final Item cm = a(Blocks.BOOKSHELF, CreativeModeTab.b);
|
|
public static final Item cn = a(Blocks.MOSSY_COBBLESTONE, CreativeModeTab.b);
|
|
public static final Item co = a(Blocks.OBSIDIAN, CreativeModeTab.b);
|
|
- public static final Item cp = a((ItemBlock) (new ItemBlockWallable(Blocks.TORCH, Blocks.WALL_TORCH, (new Item.Info()).a(CreativeModeTab.c))));
|
|
+ public static final Item cp = a((ItemBlock) (new ItemBlockWallable(Blocks.TORCH, Blocks.WALL_TORCH, (new Item.Info()).a(CreativeModeTab.c)))); public static final Item torch() { return cp; } // Purpur - OBFHELPER
|
|
public static final Item cq = a(Blocks.END_ROD, CreativeModeTab.c);
|
|
public static final Item cr = a(Blocks.CHORUS_PLANT, CreativeModeTab.c);
|
|
public static final Item cs = a(Blocks.CHORUS_FLOWER, CreativeModeTab.c);
|
|
@@ -239,7 +239,7 @@ public class Items {
|
|
public static final Item dm = a(Blocks.SOUL_SOIL, CreativeModeTab.b);
|
|
public static final Item dn = a(Blocks.BASALT, CreativeModeTab.b);
|
|
public static final Item do_ = a(Blocks.cP, CreativeModeTab.b);
|
|
- public static final Item dp = a((ItemBlock) (new ItemBlockWallable(Blocks.SOUL_TORCH, Blocks.SOUL_WALL_TORCH, (new Item.Info()).a(CreativeModeTab.c))));
|
|
+ public static final Item dp = a((ItemBlock) (new ItemBlockWallable(Blocks.SOUL_TORCH, Blocks.SOUL_WALL_TORCH, (new Item.Info()).a(CreativeModeTab.c)))); public static final Item soulTorch() { return dp; } // Purpur - OBFHELPER
|
|
public static final Item dq = a(Blocks.GLOWSTONE, CreativeModeTab.b);
|
|
public static final Item dr = a(Blocks.JACK_O_LANTERN, CreativeModeTab.b);
|
|
public static final Item ds = a(Blocks.OAK_TRAPDOOR, CreativeModeTab.d);
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
index 86578f20429aa6bf5f3de1233c6287ce26be9827..201974ec4db915e5a79ed36625f0870a7ff84207 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -454,6 +454,9 @@ public class PurpurWorldConfig {
|
|
public int phantomSpawnOverheadRadius = 10;
|
|
public int phantomSpawnMinPerAttempt = 1;
|
|
public int phantomSpawnMaxPerAttempt = -1;
|
|
+ public int phantomBurnInLight = 0;
|
|
+ public boolean phantomIgnorePlayersWithTorch = false;
|
|
+ public boolean phantomBurnInDaylight = true;
|
|
private void phantomSettings() {
|
|
phantomAttackedByCrystalRadius = getDouble("mobs.phantom.attacked-by-crystal-range", phantomAttackedByCrystalRadius);
|
|
phantomAttackedByCrystalDamage = (float) getDouble("mobs.phantom.attacked-by-crystal-damage", phantomAttackedByCrystalDamage);
|
|
@@ -470,6 +473,9 @@ public class PurpurWorldConfig {
|
|
phantomSpawnOverheadRadius = getInt("mobs.phantom.spawn.overhead.radius", phantomSpawnOverheadRadius);
|
|
phantomSpawnMinPerAttempt = getInt("mobs.phantom.spawn.per-attempt.min", phantomSpawnMinPerAttempt);
|
|
phantomSpawnMaxPerAttempt = getInt("mobs.phantom.spawn.per-attempt.max", phantomSpawnMaxPerAttempt);
|
|
+ phantomBurnInLight = getInt("mobs.phantom.burn-in-light", phantomBurnInLight);
|
|
+ phantomBurnInDaylight = getBoolean("mobs.phantom.burn-in-daylight", phantomBurnInDaylight);
|
|
+ phantomIgnorePlayersWithTorch = getBoolean("mobs.phantom.ignore-players-with-torch", phantomIgnorePlayersWithTorch);
|
|
}
|
|
|
|
public boolean pigGiveSaddleBack = false;
|