Obfuscation helpers

This commit is contained in:
William Blake Galbreath
2019-07-10 20:13:50 -05:00
parent e0fd9f7eaf
commit 03be5e1044
11 changed files with 279 additions and 215 deletions

View File

@@ -1,16 +1,17 @@
From cfbb0bb30d3e59592aeb8799880857a3a88f92c1 Mon Sep 17 00:00:00 2001
From 5c6fa6e2f30756c23b1e2998a4978e934fcc9e3a Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Sat, 4 May 2019 01:10:30 -0500
Subject: [PATCH] cows to mooshroom when fed mushrooms
---
.../java/net/minecraft/server/Entity.java | 1 +
.../java/net/minecraft/server/EntityCow.java | 76 ++++++++++++++++++-
.../java/net/minecraft/server/Entity.java | 2 +
.../java/net/minecraft/server/EntityCow.java | 71 ++++++++++++++++++-
.../net/minecraft/server/EntityLiving.java | 10 ++-
.../java/net/pl3x/purpur/PurpurConfig.java | 5 ++
3 files changed, 81 insertions(+), 1 deletion(-)
4 files changed, 85 insertions(+), 3 deletions(-)
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index c5198af94b..485da37a73 100644
index 0a2c9a9f8..dd7da4117 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1048,6 +1048,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -21,26 +22,19 @@ index c5198af94b..485da37a73 100644
public void a(SoundEffect soundeffect, float f, float f1) {
if (!this.isSilent()) {
this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, soundeffect, this.getSoundCategory(), f, f1);
@@ -2545,6 +2546,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
this.invulnerable = flag;
}
+ public void copyPositionRotation(Entity entity) { this.u(entity); } // Purpur - OBFHELPER
public void u(Entity entity) {
this.setPositionRotation(entity.locX, entity.locY, entity.locZ, entity.yaw, entity.pitch);
}
diff --git a/src/main/java/net/minecraft/server/EntityCow.java b/src/main/java/net/minecraft/server/EntityCow.java
index d2c2e3cc33..f053ff0e50 100644
index d2c2e3cc3..c3aef0b2a 100644
--- a/src/main/java/net/minecraft/server/EntityCow.java
+++ b/src/main/java/net/minecraft/server/EntityCow.java
@@ -1,9 +1,14 @@
package net.minecraft.server;
// CraftBukkit start
+import net.pl3x.purpur.PurpurConfig;
import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
// CraftBukkit end
+// Purpur start
+import com.destroystokyo.paper.event.entity.EntityTransformedEvent;
+import org.bukkit.event.entity.EntityTransformEvent;
+// Purpur end
public class EntityCow extends EntityAnimal {
@@ -16,7 +21,7 @@ public class EntityCow extends EntityAnimal {
@@ -16,7 +16,7 @@ public class EntityCow extends EntityAnimal {
this.goalSelector.a(0, new PathfinderGoalFloat(this));
this.goalSelector.a(1, new PathfinderGoalPanic(this, 2.0D));
this.goalSelector.a(2, new PathfinderGoalBreed(this, 1.0D));
@@ -49,7 +43,7 @@ index d2c2e3cc33..f053ff0e50 100644
this.goalSelector.a(4, new PathfinderGoalFollowParent(this, 1.25D));
this.goalSelector.a(5, new PathfinderGoalRandomStrollLand(this, 1.0D));
this.goalSelector.a(6, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F));
@@ -79,11 +84,80 @@ public class EntityCow extends EntityAnimal {
@@ -79,11 +79,80 @@ public class EntityCow extends EntityAnimal {
// CraftBukkit end
return true;
@@ -81,7 +75,7 @@ index d2c2e3cc33..f053ff0e50 100644
+ private boolean feedMushroom(EntityHuman entityhuman, ItemStack itemstack) {
+ world.broadcastEntityEffect(this, (byte) 18); // hearts
+ playSound(SoundEffects.ENTITY_COW_MILK, 1.0F, 1.0F);
+ if (incrementFeedCount(itemstack) < PurpurConfig.feedMushroomsToCows) {
+ if (incrementFeedCount(itemstack) < net.pl3x.purpur.PurpurConfig.feedMushroomsToCows) {
+ if (!entityhuman.abilities.canInstantlyBuild) {
+ itemstack.subtract(1);
+ }
@@ -99,18 +93,18 @@ index d2c2e3cc33..f053ff0e50 100644
+ mooshroom.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
+ mooshroom.setHealth(this.getHealth());
+ mooshroom.setAge(getAge());
+ mooshroom.u(this);
+ mooshroom.aK = this.aK;
+ mooshroom.aM = this.aM;
+ mooshroom.copyPositionRotation(this);
+ mooshroom.setRenderYawOffset(this.getRenderYawOffset());
+ mooshroom.setHeadRotation(this.getHeadRotation());
+ mooshroom.lastYaw = this.lastYaw;
+ mooshroom.lastPitch = this.lastPitch;
+ if (this.hasCustomName()) {
+ mooshroom.setCustomName(this.getCustomName());
+ }
+ if (CraftEventFactory.callEntityTransformEvent(this, mooshroom, EntityTransformEvent.TransformReason.SHROOMED).isCancelled()) {
+ if (CraftEventFactory.callEntityTransformEvent(this, mooshroom, org.bukkit.event.entity.EntityTransformEvent.TransformReason.SHROOMED).isCancelled()) {
+ return false;
+ }
+ if (!new EntityTransformedEvent(this.getBukkitEntity(), mooshroom.getBukkitEntity(), EntityTransformedEvent.TransformedReason.SHROOMED).callEvent()) {
+ if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), mooshroom.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.SHROOMED).callEvent()) {
+ return false;
+ }
+ this.world.addEntity(mooshroom);
@@ -130,8 +124,29 @@ index d2c2e3cc33..f053ff0e50 100644
@Override
public EntityCow createChild(EntityAgeable entityageable) {
return (EntityCow) EntityTypes.COW.a(this.world);
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index d44ea9ec5..84bc1a629 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -2742,8 +2742,14 @@ public abstract class EntityLiving extends Entity {
this.aM = f;
}
- @Override
- public void l(float f) {
+ // Purpur start
+ public float getRenderYawOffset() {
+ return this.aK;
+ }
+ // Purpur end
+
+ public void setRenderYawOffset(float f) { this.l(f); } // Purpur - OBFHELPER
+ @Override public void l(float f) {
this.aK = f;
}
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
index 2f87a929c1..3a1a6b9671 100644
index 2f87a929c..3a1a6b967 100644
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
@@ -124,4 +124,9 @@ public class PurpurConfig {

View File

@@ -1,24 +1,25 @@
From 87a60fa232ee8a521f6d3b8e1d9b27f21ecec0af Mon Sep 17 00:00:00 2001
From 3ffd0f1a1470899d3ba61300e32ac3eab30f596c Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Fri, 3 May 2019 23:53:16 -0500
Subject: [PATCH] Fix cow rotation when shearing mooshroom
---
src/main/java/net/minecraft/server/EntityMushroomCow.java | 6 ++++++
1 file changed, 6 insertions(+)
src/main/java/net/minecraft/server/EntityMushroomCow.java | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/main/java/net/minecraft/server/EntityMushroomCow.java b/src/main/java/net/minecraft/server/EntityMushroomCow.java
index d1059355ad..6bfffb4077 100644
index d1059355a..f4f60c38d 100644
--- a/src/main/java/net/minecraft/server/EntityMushroomCow.java
+++ b/src/main/java/net/minecraft/server/EntityMushroomCow.java
@@ -101,7 +101,13 @@ public class EntityMushroomCow extends EntityCow {
entitycow.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
entitycow.setHealth(this.getHealth());
- entitycow.aK = this.aK;
+ // Purpur start - correctly copy rotation
+ entitycow.u(this);
entitycow.aK = this.aK;
+ entitycow.aM = this.aM;
+ entitycow.copyPositionRotation(this);
+ entitycow.setRenderYawOffset(this.getRenderYawOffset());
+ entitycow.setHeadRotation(this.getHeadRotation());
+ entitycow.lastYaw = this.lastYaw;
+ entitycow.lastPitch = this.lastPitch;
+ // Purpur end

View File

@@ -1,25 +1,18 @@
From 64c7e4e5d7c36b73a4a012fa258066a3913feba4 Mon Sep 17 00:00:00 2001
From 6f98e087a81f0c88afc5a0d57ffaccfaa69ffc4e Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Fri, 3 May 2019 23:58:44 -0500
Subject: [PATCH] Snowman set pumpkin on/off by player interaction
---
.../net/minecraft/server/EntitySnowman.java | 20 ++++++++++++++++++-
.../net/minecraft/server/EntitySnowman.java | 19 ++++++++++++++++++-
.../java/net/pl3x/purpur/PurpurConfig.java | 7 +++++++
2 files changed, 26 insertions(+), 1 deletion(-)
2 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/src/main/java/net/minecraft/server/EntitySnowman.java b/src/main/java/net/minecraft/server/EntitySnowman.java
index fe1381cc17..e106b1dce4 100644
index fe1381cc1..1fed1d6e7 100644
--- a/src/main/java/net/minecraft/server/EntitySnowman.java
+++ b/src/main/java/net/minecraft/server/EntitySnowman.java
@@ -2,12 +2,14 @@ package net.minecraft.server;
import javax.annotation.Nullable;
// CraftBukkit start
+import net.pl3x.purpur.PurpurConfig;
import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.event.player.PlayerShearEntityEvent;
// CraftBukkit end
@@ -8,6 +8,7 @@ import org.bukkit.event.player.PlayerShearEntityEvent;
public class EntitySnowman extends EntityGolem implements IRangedEntity {
@@ -27,7 +20,7 @@ index fe1381cc17..e106b1dce4 100644
private static final DataWatcherObject<Byte> b = DataWatcher.a(EntitySnowman.class, DataWatcherRegistry.a);
public EntitySnowman(EntityTypes<? extends EntitySnowman> entitytypes, World world) {
@@ -112,7 +114,7 @@ public class EntitySnowman extends EntityGolem implements IRangedEntity {
@@ -112,7 +113,7 @@ public class EntitySnowman extends EntityGolem implements IRangedEntity {
protected boolean a(EntityHuman entityhuman, EnumHand enumhand) {
ItemStack itemstack = entityhuman.b(enumhand);
@@ -36,20 +29,20 @@ index fe1381cc17..e106b1dce4 100644
// CraftBukkit start
PlayerShearEntityEvent event = new PlayerShearEntityEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), this.getBukkitEntity());
this.world.getServer().getPluginManager().callEvent(event);
@@ -126,6 +128,22 @@ public class EntitySnowman extends EntityGolem implements IRangedEntity {
@@ -126,6 +127,22 @@ public class EntitySnowman extends EntityGolem implements IRangedEntity {
itemstack.damage(1, entityhuman, (entityhuman1) -> {
entityhuman1.d(enumhand);
});
+
+ // Purpur start
+ if (PurpurConfig.snowmanDropsPumpkin) {
+ if (net.pl3x.purpur.PurpurConfig.snowmanDropsPumpkin) {
+ EntityItem pumpkin = new EntityItem(world, locX, locY, locZ, new ItemStack(Blocks.PUMPKIN.getItem()));
+ pumpkin.pickupDelay = 10;
+ world.addEntity(pumpkin);
+ }
+ return true;
+ }} else {
+ if (PurpurConfig.snowmanPumpkinPutBack && PUMPKIN.test(itemstack)) {
+ if (net.pl3x.purpur.PurpurConfig.snowmanPumpkinPutBack && PUMPKIN.test(itemstack)) {
+ setHasPumpkin(true);
+ if (!entityhuman.abilities.canInstantlyBuild) {
+ itemstack.subtract(1);
@@ -60,7 +53,7 @@ index fe1381cc17..e106b1dce4 100644
return super.a(entityhuman, enumhand);
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
index 3a1a6b9671..1666412782 100644
index 3a1a6b967..166641278 100644
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
@@ -129,4 +129,11 @@ public class PurpurConfig {

View File

@@ -1,4 +1,4 @@
From 38e634bad7487c17e998ca79edc18ca82da1dd1b Mon Sep 17 00:00:00 2001
From d5b26b7987432b2a6fb3bc0d022061b9e378f796 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Thu, 9 May 2019 14:27:37 -0500
Subject: [PATCH] Silk touch spawners
@@ -6,14 +6,14 @@ Subject: [PATCH] Silk touch spawners
---
src/main/java/net/minecraft/server/Block.java | 1 +
.../net/minecraft/server/BlockMobSpawner.java | 35 +++++++++++++++++++
.../net/minecraft/server/EntityTypes.java | 13 +++++++
.../net/minecraft/server/ItemSpawner.java | 22 ++++++++++++
.../net/minecraft/server/EntityTypes.java | 14 ++++++++
.../net/minecraft/server/ItemSpawner.java | 23 ++++++++++++
src/main/java/net/minecraft/server/Items.java | 2 +-
5 files changed, 72 insertions(+), 1 deletion(-)
5 files changed, 74 insertions(+), 1 deletion(-)
create mode 100644 src/main/java/net/minecraft/server/ItemSpawner.java
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java
index 5d8db912a6..8e16162a7b 100644
index 5d8db912a..8e16162a7 100644
--- a/src/main/java/net/minecraft/server/Block.java
+++ b/src/main/java/net/minecraft/server/Block.java
@@ -493,6 +493,7 @@ public class Block implements IMaterial {
@@ -25,7 +25,7 @@ index 5d8db912a6..8e16162a7b 100644
if (!world.isClientSide && !itemstack.isEmpty() && world.getGameRules().getBoolean(GameRules.DO_TILE_DROPS)) {
float f = 0.5F;
diff --git a/src/main/java/net/minecraft/server/BlockMobSpawner.java b/src/main/java/net/minecraft/server/BlockMobSpawner.java
index bb77d916ab..974a5d2816 100644
index bb77d916a..974a5d281 100644
--- a/src/main/java/net/minecraft/server/BlockMobSpawner.java
+++ b/src/main/java/net/minecraft/server/BlockMobSpawner.java
@@ -11,6 +11,40 @@ public class BlockMobSpawner extends BlockTileEntity {
@@ -78,10 +78,10 @@ index bb77d916ab..974a5d2816 100644
return i;
diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java
index eaacc9bff8..ec63f1dbe1 100644
index eaacc9bff..c32f40a60 100644
--- a/src/main/java/net/minecraft/server/EntityTypes.java
+++ b/src/main/java/net/minecraft/server/EntityTypes.java
@@ -137,6 +137,12 @@ public class EntityTypes<T extends Entity> {
@@ -137,10 +137,17 @@ public class EntityTypes<T extends Entity> {
return (EntityTypes) IRegistry.a((IRegistry) IRegistry.ENTITY_TYPE, s, (Object) entitytypes_a.a(s));
}
@@ -94,7 +94,12 @@ index eaacc9bff8..ec63f1dbe1 100644
public static MinecraftKey getName(EntityTypes<?> entitytypes) {
return IRegistry.ENTITY_TYPE.getKey(entitytypes);
}
@@ -255,6 +261,12 @@ public class EntityTypes<T extends Entity> {
+ public static Optional<EntityTypes<?>> getType(String name) { return a(name); } // Purpur - OBFHELPER
public static Optional<EntityTypes<?>> a(String s) {
return IRegistry.ENTITY_TYPE.getOptional(MinecraftKey.a(s));
}
@@ -255,6 +262,12 @@ public class EntityTypes<T extends Entity> {
return this.ba;
}
@@ -107,7 +112,7 @@ index eaacc9bff8..ec63f1dbe1 100644
public String e() {
if (this.be == null) {
this.be = SystemUtils.a("entity", IRegistry.ENTITY_TYPE.getKey(this));
@@ -263,6 +275,7 @@ public class EntityTypes<T extends Entity> {
@@ -263,6 +276,7 @@ public class EntityTypes<T extends Entity> {
return this.be;
}
@@ -117,10 +122,10 @@ index eaacc9bff8..ec63f1dbe1 100644
this.bf = new ChatMessage(this.e(), new Object[0]);
diff --git a/src/main/java/net/minecraft/server/ItemSpawner.java b/src/main/java/net/minecraft/server/ItemSpawner.java
new file mode 100644
index 0000000000..05dbc162fa
index 000000000..7dc68ffe9
--- /dev/null
+++ b/src/main/java/net/minecraft/server/ItemSpawner.java
@@ -0,0 +1,22 @@
@@ -0,0 +1,23 @@
+package net.minecraft.server;
+
+public class ItemSpawner extends ItemBlock {
@@ -132,11 +137,12 @@ index 0000000000..05dbc162fa
+ protected boolean a(BlockPosition blockposition, World world, EntityHuman entityhuman, ItemStack itemstack, IBlockData iblockdata) {
+ boolean handled = super.a(blockposition, world, entityhuman, itemstack, iblockdata);
+ if (entityhuman.getBukkitEntity().hasPermission("purpur.place.spawners")) {
+ TileEntity te = world.getTileEntity(blockposition);
+ if (te instanceof TileEntityMobSpawner && itemstack.hasTag()) {
+ TileEntity spawner = world.getTileEntity(blockposition);
+ if (spawner instanceof TileEntityMobSpawner && itemstack.hasTag()) {
+ NBTTagCompound tag = itemstack.getTag();
+ if (tag.hasKey("Purpur.mob_type")) {
+ EntityTypes.a(tag.getString("Purpur.mob_type")).ifPresent(type -> ((TileEntityMobSpawner) te).getSpawner().setMobName(type));
+ EntityTypes.getType(tag.getString("Purpur.mob_type")).ifPresent(type ->
+ ((TileEntityMobSpawner) spawner).getSpawner().setMobName(type));
+ }
+ }
+ }
@@ -144,7 +150,7 @@ index 0000000000..05dbc162fa
+ }
+}
diff --git a/src/main/java/net/minecraft/server/Items.java b/src/main/java/net/minecraft/server/Items.java
index 84646dbc26..987297634c 100644
index 84646dbc2..987297634 100644
--- a/src/main/java/net/minecraft/server/Items.java
+++ b/src/main/java/net/minecraft/server/Items.java
@@ -155,7 +155,7 @@ public class Items {

View File

@@ -1,15 +1,60 @@
From fb39b44c654ae8bfaae679e4031d088616b50e38 Mon Sep 17 00:00:00 2001
From 76c45487e76be7cbec6df4e8438bc79095cc5227 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Thu, 9 May 2019 18:26:06 -0500
Subject: [PATCH] Phantoms attracted to crystals and crystals shoot phantoms
---
.../minecraft/server/EntityEnderCrystal.java | 49 ++++++
.../net/minecraft/server/EntityPhantom.java | 165 +++++++++++++++++-
2 files changed, 211 insertions(+), 3 deletions(-)
.../net/minecraft/server/DamageSource.java | 1 +
.../java/net/minecraft/server/Entity.java | 8 +-
.../minecraft/server/EntityEnderCrystal.java | 49 +++++
.../net/minecraft/server/EntityPhantom.java | 170 +++++++++++++++++-
.../net/minecraft/server/IEntityAccess.java | 1 +
5 files changed, 219 insertions(+), 10 deletions(-)
diff --git a/src/main/java/net/minecraft/server/DamageSource.java b/src/main/java/net/minecraft/server/DamageSource.java
index 730a15f33..31454349a 100644
--- a/src/main/java/net/minecraft/server/DamageSource.java
+++ b/src/main/java/net/minecraft/server/DamageSource.java
@@ -77,6 +77,7 @@ public class DamageSource {
return (new EntityDamageSourceIndirect("thrown", entity, entity1)).c();
}
+ public static DamageSource indirectMagic(Entity entity, @Nullable Entity owner) { return c(entity, owner); } // Purpur - OBFHELPER
public static DamageSource c(Entity entity, @Nullable Entity entity1) {
return (new EntityDamageSourceIndirect("indirectMagic", entity, entity1)).setIgnoreArmor().setMagic();
}
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index dd7da4117..adfd6e855 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1399,6 +1399,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
return d3 * d3 + d4 * d4 + d5 * d5;
}
+ public double getDistanceSq(Entity entity) { return this.h(entity); } // Purpur - OBFHELPER
public double h(Entity entity) {
return this.c(entity.ci());
}
@@ -1918,14 +1919,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
return this.a(new ItemStack(imaterial), (float) i);
}
- @Nullable
- public EntityItem a(ItemStack itemstack) {
+ @Nullable public EntityItem dropItem(ItemStack itemstack) { return this.a(itemstack); } // Purpur - OBFHELPER
+ @Nullable public EntityItem a(ItemStack itemstack) {
return this.a(itemstack, 0.0F);
}
@Nullable public final EntityItem dropItem(ItemStack itemstack, float offset) { return this.a(itemstack, offset); } // Paper - OBFHELPER
- @Nullable
- public EntityItem a(ItemStack itemstack, float f) {
+ @Nullable public EntityItem a(ItemStack itemstack, float f) {
if (itemstack.isEmpty()) {
return null;
} else if (this.world.isClientSide) {
diff --git a/src/main/java/net/minecraft/server/EntityEnderCrystal.java b/src/main/java/net/minecraft/server/EntityEnderCrystal.java
index 9491cb9de..871c65b88 100644
index 801552fc6..b3366b461 100644
--- a/src/main/java/net/minecraft/server/EntityEnderCrystal.java
+++ b/src/main/java/net/minecraft/server/EntityEnderCrystal.java
@@ -13,6 +13,12 @@ public class EntityEnderCrystal extends Entity {
@@ -35,7 +80,7 @@ index 9491cb9de..871c65b88 100644
+ }
+
+ if (targetPhantom == null) {
+ for (EntityPhantom phantom : world.a(EntityPhantom.class, getBoundingBox().grow(16, 16, 16))) {
+ for (EntityPhantom phantom : world.getEntities(EntityPhantom.class, getBoundingBox().grow(16, 16, 16))) {
+ if (phantom.hasLineOfSight(this)) {
+ attackPhantom(phantom);
+ break;
@@ -48,7 +93,7 @@ index 9491cb9de..871c65b88 100644
+ if (targetPhantom.hasLineOfSight(this)) {
+ if (phantomDamageCooldown <= 0) {
+ phantomDamageCooldown = 20;
+ targetPhantom.damageEntity(DamageSource.c(this, this), 1.0F);
+ targetPhantom.damageEntity(DamageSource.indirectMagic(this, this), 1.0F);
+ }
+ } else {
+ forgetPhantom(); // no longer in sight
@@ -77,25 +122,24 @@ index 9491cb9de..871c65b88 100644
@Override
protected void b(NBTTagCompound nbttagcompound) {
diff --git a/src/main/java/net/minecraft/server/EntityPhantom.java b/src/main/java/net/minecraft/server/EntityPhantom.java
index e5d032d02..6aa116f4b 100644
index b672ac5c2..4e07287e9 100644
--- a/src/main/java/net/minecraft/server/EntityPhantom.java
+++ b/src/main/java/net/minecraft/server/EntityPhantom.java
@@ -1,5 +1,6 @@
package net.minecraft.server;
@@ -8,9 +8,10 @@ import javax.annotation.Nullable;
public class EntityPhantom extends EntityFlying implements IMonster {
+import java.util.Comparator;
import java.util.EnumSet;
import java.util.Iterator;
import java.util.List;
@@ -11,6 +12,7 @@ public class EntityPhantom extends EntityFlying implements IMonster {
private Vec3D c;
private BlockPosition d;
private EntityPhantom.AttackPhase bz;
private static final DataWatcherObject<Integer> b = DataWatcher.a(EntityPhantom.class, DataWatcherRegistry.b);
- private Vec3D c;
- private BlockPosition d;
- private EntityPhantom.AttackPhase bz;
+ private Vec3D c; public void setHomeOffset(Vec3D offset) { this.c = offset; } public Vec3D getHomeOffset() { return this.c; } // Purpur - OBFHELPER
+ private BlockPosition d; public void setHome(BlockPosition home) { this.d = home; } public BlockPosition getHome() { return this.d; } // Purpur - OBFHELPER
+ private EntityPhantom.AttackPhase bz; public AttackPhase getAttackPhase() { return this.bz; } // Purpur - OBFHELPER
+ private BlockPosition crystalPosition; // Purpur
public EntityPhantom(EntityTypes<? extends EntityPhantom> entitytypes, World world) {
super(entitytypes, world);
@@ -29,8 +31,10 @@ public class EntityPhantom extends EntityFlying implements IMonster {
@@ -29,8 +30,10 @@ public class EntityPhantom extends EntityFlying implements IMonster {
@Override
protected void initPathfinder() {
@@ -106,7 +150,7 @@ index e5d032d02..6aa116f4b 100644
this.goalSelector.a(3, new EntityPhantom.e());
this.targetSelector.a(1, new EntityPhantom.b());
}
@@ -114,6 +118,26 @@ public class EntityPhantom extends EntityFlying implements IMonster {
@@ -114,6 +117,26 @@ public class EntityPhantom extends EntityFlying implements IMonster {
super.mobTick();
}
@@ -116,7 +160,7 @@ index e5d032d02..6aa116f4b 100644
+ boolean dropped = false;
+ if (killer == null && damagesource.getEntity() instanceof EntityEnderCrystal) {
+ if (random.nextInt(5) < 1) { // 1 out of 5 chance (20%)
+ dropped = a(new ItemStack(Items.PHANTOM_MEMBRANE)) != null;
+ dropped = dropItem(new ItemStack(Items.PHANTOM_MEMBRANE)) != null;
+ }
+ }
+ if (!dropped) {
@@ -133,7 +177,7 @@ index e5d032d02..6aa116f4b 100644
@Override
public GroupDataEntity prepare(GeneratorAccess generatoraccess, DifficultyDamageScaler difficultydamagescaler, EnumMobSpawn enummobspawn, @Nullable GroupDataEntity groupdataentity, @Nullable NBTTagCompound nbttagcompound) {
this.d = (new BlockPosition(this)).up(5);
@@ -202,6 +226,136 @@ public class EntityPhantom extends EntityFlying implements IMonster {
@@ -202,6 +225,136 @@ public class EntityPhantom extends EntityFlying implements IMonster {
}
// Paper end
@@ -141,23 +185,23 @@ index e5d032d02..6aa116f4b 100644
+ class FindCrystalGoal extends PathfinderGoal {
+ private final EntityPhantom phantom;
+ private EntityEnderCrystal crystal;
+ private Comparator<EntityEnderCrystal> comparator;
+ private java.util.Comparator<EntityEnderCrystal> comparator;
+
+ FindCrystalGoal(EntityPhantom phantom) {
+ this.phantom = phantom;
+ comparator = Comparator.comparingDouble(phantom::h);
+ comparator = java.util.Comparator.comparingDouble(phantom::h);
+ }
+
+ @Override
+ public boolean a() { // shouldExecute
+ double range = maxTargetRange();
+ List<EntityEnderCrystal> crystals = world.a(EntityEnderCrystal.class, phantom.getBoundingBox().grow(range, range, range));
+ List<EntityEnderCrystal> crystals = world.getEntities(EntityEnderCrystal.class, phantom.getBoundingBox().grow(range, range, range));
+ if (crystals.isEmpty()) {
+ return false;
+ }
+ crystals.sort(comparator);
+ crystal = crystals.get(0);
+ if (phantom.h(crystal) > range * range) {
+ if (phantom.getDistanceSq(crystal) > range * range) {
+ crystal = null;
+ return false;
+ }
@@ -170,7 +214,7 @@ index e5d032d02..6aa116f4b 100644
+ return false;
+ }
+ double range = maxTargetRange();
+ return phantom.h(crystal) <= (range * range) * 2;
+ return phantom.getDistanceSq(crystal) <= (range * range) * 2;
+ }
+
+ @Override
@@ -190,7 +234,7 @@ index e5d032d02..6aa116f4b 100644
+ return range == null ? 16.0D : range.getValue();
+ }
+
+ class DistanceComparator implements Comparator<Entity> {
+ class DistanceComparator implements java.util.Comparator<Entity> {
+ private final Entity entity;
+
+ public DistanceComparator(Entity entity) {
@@ -198,14 +242,14 @@ index e5d032d02..6aa116f4b 100644
+ }
+
+ public int compare(Entity entity1, Entity entity2) {
+ return Double.compare(entity.h(entity1), entity.h(entity2));
+ return Double.compare(entity.getDistanceSq(entity1), entity.getDistanceSq(entity2));
+ }
+ }
+ }
+
+ class OrbitCrystalGoal extends PathfinderGoal {
+ private final EntityPhantom phantom;
+ private float c;
+ private float offset;
+ private float radius;
+ private float verticalChange;
+ private float direction;
@@ -241,28 +285,28 @@ index e5d032d02..6aa116f4b 100644
+ }
+ }
+ if (phantom.random.nextInt(450) == 0) {
+ this.c = phantom.random.nextFloat() * 2.0F * 3.1415927F;
+ this.offset = phantom.random.nextFloat() * 2.0F * 3.1415927F;
+ updateOffset();
+ }
+ if (phantom.c.c(phantom.locX, phantom.locY, phantom.locZ) < 4.0D) {
+ if (phantom.getHomeOffset().c(phantom.locX, phantom.locY, phantom.locZ) < 4.0D) {
+ updateOffset();
+ }
+ if (phantom.c.y < phantom.locY && !phantom.world.isEmpty((new BlockPosition(phantom)).down(1))) {
+ if (phantom.getHomeOffset().y < phantom.locY && !phantom.world.isEmpty((new BlockPosition(phantom)).down(1))) {
+ this.verticalChange = Math.max(1.0F, this.verticalChange);
+ updateOffset();
+ }
+ if (phantom.c.y > phantom.locY && !phantom.world.isEmpty((new BlockPosition(phantom)).up(1))) {
+ if (phantom.getHomeOffset().y > phantom.locY && !phantom.world.isEmpty((new BlockPosition(phantom)).up(1))) {
+ this.verticalChange = Math.min(-1.0F, this.verticalChange);
+ updateOffset();
+ }
+ }
+
+ private void updateOffset() {
+ this.c += this.direction * 15.0F * 0.017453292F;
+ phantom.c = new Vec3D(phantom.crystalPosition).add(
+ (double) (this.radius * MathHelper.cos(this.c)),
+ this.offset += this.direction * 15.0F * 0.017453292F;
+ phantom.setHomeOffset(new Vec3D(phantom.crystalPosition).add(
+ (double) (this.radius * MathHelper.cos(this.offset)),
+ (double) (-4.0F + this.verticalChange),
+ (double) (this.radius * MathHelper.sin(this.c)));
+ (double) (this.radius * MathHelper.sin(this.offset))));
+ }
+ }
+ // Purpur end
@@ -270,7 +314,7 @@ index e5d032d02..6aa116f4b 100644
class b extends PathfinderGoal {
private final PathfinderTargetCondition b;
@@ -259,7 +413,7 @@ public class EntityPhantom extends EntityFlying implements IMonster {
@@ -259,7 +412,7 @@ public class EntityPhantom extends EntityFlying implements IMonster {
public boolean a() {
EntityLiving entityliving = EntityPhantom.this.getGoalTarget();
@@ -279,12 +323,12 @@ index e5d032d02..6aa116f4b 100644
}
@Override
@@ -305,11 +459,16 @@ public class EntityPhantom extends EntityFlying implements IMonster {
@@ -305,11 +458,16 @@ public class EntityPhantom extends EntityFlying implements IMonster {
@Override
public boolean a() {
- return EntityPhantom.this.getGoalTarget() != null && EntityPhantom.this.bz == EntityPhantom.AttackPhase.SWOOP;
+ return !isCirclingCrystal() && EntityPhantom.this.getGoalTarget() != null && EntityPhantom.this.bz == EntityPhantom.AttackPhase.SWOOP; // Purpur
+ return !isCirclingCrystal() && EntityPhantom.this.getGoalTarget() != null && EntityPhantom.this.getAttackPhase() == EntityPhantom.AttackPhase.SWOOP; // Purpur
}
@Override
@@ -297,15 +341,27 @@ index e5d032d02..6aa116f4b 100644
EntityLiving entityliving = EntityPhantom.this.getGoalTarget();
if (entityliving == null) {
@@ -379,7 +538,7 @@ public class EntityPhantom extends EntityFlying implements IMonster {
@@ -379,7 +537,7 @@ public class EntityPhantom extends EntityFlying implements IMonster {
@Override
public boolean a() {
- return EntityPhantom.this.getGoalTarget() == null || EntityPhantom.this.bz == EntityPhantom.AttackPhase.CIRCLE;
+ return !isCirclingCrystal() && EntityPhantom.this.getGoalTarget() == null || EntityPhantom.this.bz == EntityPhantom.AttackPhase.CIRCLE; // Purpur
+ return !isCirclingCrystal() && EntityPhantom.this.getGoalTarget() == null || EntityPhantom.this.getAttackPhase() == EntityPhantom.AttackPhase.CIRCLE; // Purpur
}
@Override
diff --git a/src/main/java/net/minecraft/server/IEntityAccess.java b/src/main/java/net/minecraft/server/IEntityAccess.java
index 3a86c519c..9f78ae099 100644
--- a/src/main/java/net/minecraft/server/IEntityAccess.java
+++ b/src/main/java/net/minecraft/server/IEntityAccess.java
@@ -30,6 +30,7 @@ public interface IEntityAccess {
});
}
+ default <T extends Entity> List<T> getEntities(Class<? extends T> oclass, AxisAlignedBB axisalignedbb) { return a(oclass, axisalignedbb); } // Purpur - OBFHELPER
default <T extends Entity> List<T> a(Class<? extends T> oclass, AxisAlignedBB axisalignedbb) {
return this.a(oclass, axisalignedbb, IEntitySelector.f);
}
--
2.20.1

View File

@@ -1,4 +1,4 @@
From 17561f8c3ae230ab95d83035ad1b647823cc0757 Mon Sep 17 00:00:00 2001
From e1588564c74131a5b5b60262ea82f7df7607f8d7 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Tue, 30 Apr 2019 19:17:21 -0500
Subject: [PATCH] Integrate ridables
@@ -35,7 +35,7 @@ Subject: [PATCH] Integrate ridables
.../minecraft/server/EntityIllagerWizard.java | 3 +
.../minecraft/server/EntityInsentient.java | 51 +++++++-
.../net/minecraft/server/EntityIronGolem.java | 1 +
.../net/minecraft/server/EntityLiving.java | 25 +++-
.../net/minecraft/server/EntityLiving.java | 24 +++-
.../net/minecraft/server/EntityMagmaCube.java | 3 +-
.../minecraft/server/EntityMushroomCow.java | 1 +
.../net/minecraft/server/EntityOcelot.java | 3 +
@@ -136,7 +136,7 @@ Subject: [PATCH] Integrate ridables
.../controller/ControllerMoveWASDWater.java | 42 +++++++
.../craftbukkit/entity/CraftLivingEntity.java | 10 ++
.../bukkit/craftbukkit/entity/CraftMob.java | 12 ++
132 files changed, 1249 insertions(+), 106 deletions(-)
132 files changed, 1248 insertions(+), 106 deletions(-)
create mode 100644 src/main/java/net/pl3x/purpur/controller/ControllerLookWASD.java
create mode 100644 src/main/java/net/pl3x/purpur/controller/ControllerMoveWASD.java
create mode 100644 src/main/java/net/pl3x/purpur/controller/ControllerMoveWASDFlying.java
@@ -165,7 +165,7 @@ index 454627f65..df3d6cf28 100644
this.d = false;
this.a.aM = this.a(this.a.aM, this.h() + 20.0F, this.b);
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index c10b41dff..e8b5729ef 100644
index adfd6e855..cf5d829f6 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -78,6 +78,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -223,7 +223,7 @@ index c10b41dff..e8b5729ef 100644
this.passengers.remove(entity);
entity.j = 60;
}
@@ -3275,4 +3290,20 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -3276,4 +3291,20 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
public void setMot(double d0, double d1, double d2) {
this.setMot(new Vec3D(d0, d1, d2));
}
@@ -524,10 +524,10 @@ index 1e3782122..c0b066d18 100644
@Override
diff --git a/src/main/java/net/minecraft/server/EntityCow.java b/src/main/java/net/minecraft/server/EntityCow.java
index f053ff0e5..16a35418f 100644
index c3aef0b2a..087ce8739 100644
--- a/src/main/java/net/minecraft/server/EntityCow.java
+++ b/src/main/java/net/minecraft/server/EntityCow.java
@@ -14,6 +14,7 @@ public class EntityCow extends EntityAnimal {
@@ -9,6 +9,7 @@ public class EntityCow extends EntityAnimal {
public EntityCow(EntityTypes<? extends EntityCow> entitytypes, World world) {
super(entitytypes, world);
@@ -1701,7 +1701,7 @@ index 8e463111b..fd6a926ca 100644
}
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index c2d83bf3e..694200deb 100644
index 60ddadbfe..7e59a7b30 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -87,10 +87,10 @@ public abstract class EntityLiving extends Entity {
@@ -1769,14 +1769,6 @@ index c2d83bf3e..694200deb 100644
public void o(float f) {
this.bD = f;
}
@@ -2743,6 +2755,7 @@ public abstract class EntityLiving extends Entity {
this.aM = f;
}
+ public void setRenderYawOffset(float renderYawOffset) { l(renderYawOffset); } // Purpur - OBFHELPER
@Override
public void l(float f) {
this.aK = f;
diff --git a/src/main/java/net/minecraft/server/EntityMagmaCube.java b/src/main/java/net/minecraft/server/EntityMagmaCube.java
index a17316c77..b34a258c2 100644
--- a/src/main/java/net/minecraft/server/EntityMagmaCube.java
@@ -1799,7 +1791,7 @@ index a17316c77..b34a258c2 100644
this.setMot(vec3d.x, (double) (0.42F + (float) this.getSize() * 0.1F), vec3d.z);
diff --git a/src/main/java/net/minecraft/server/EntityMushroomCow.java b/src/main/java/net/minecraft/server/EntityMushroomCow.java
index 6bfffb407..b6d5fe362 100644
index f4f60c38d..f868ea114 100644
--- a/src/main/java/net/minecraft/server/EntityMushroomCow.java
+++ b/src/main/java/net/minecraft/server/EntityMushroomCow.java
@@ -18,6 +18,7 @@ public class EntityMushroomCow extends EntityCow {
@@ -2063,10 +2055,10 @@ index 94e973ffb..d743ddb9c 100644
@Nullable
diff --git a/src/main/java/net/minecraft/server/EntityPhantom.java b/src/main/java/net/minecraft/server/EntityPhantom.java
index ea11de3cb..8517fcf29 100644
index 4e07287e9..7f414aee9 100644
--- a/src/main/java/net/minecraft/server/EntityPhantom.java
+++ b/src/main/java/net/minecraft/server/EntityPhantom.java
@@ -16,12 +16,14 @@ public class EntityPhantom extends EntityFlying implements IMonster {
@@ -15,12 +15,14 @@ public class EntityPhantom extends EntityFlying implements IMonster {
public EntityPhantom(EntityTypes<? extends EntityPhantom> entitytypes, World world) {
super(entitytypes, world);
@@ -2081,7 +2073,7 @@ index ea11de3cb..8517fcf29 100644
}
@Override
@@ -106,7 +108,7 @@ public class EntityPhantom extends EntityFlying implements IMonster {
@@ -105,7 +107,7 @@ public class EntityPhantom extends EntityFlying implements IMonster {
@Override
public void movementTick() {
@@ -2090,15 +2082,15 @@ index ea11de3cb..8517fcf29 100644
this.setOnFire(8);
}
@@ -239,6 +241,7 @@ public class EntityPhantom extends EntityFlying implements IMonster {
@@ -238,6 +240,7 @@ public class EntityPhantom extends EntityFlying implements IMonster {
@Override
public boolean a() { // shouldExecute
+ if (this.phantom.getRider() != null) return false;
double range = maxTargetRange();
List<EntityEnderCrystal> crystals = world.a(EntityEnderCrystal.class, phantom.getBoundingBox().grow(range, range, range));
List<EntityEnderCrystal> crystals = world.getEntities(EntityEnderCrystal.class, phantom.getBoundingBox().grow(range, range, range));
if (crystals.isEmpty()) {
@@ -255,6 +258,7 @@ public class EntityPhantom extends EntityFlying implements IMonster {
@@ -254,6 +257,7 @@ public class EntityPhantom extends EntityFlying implements IMonster {
@Override
public boolean b() { // shouldContinueExecuting
@@ -2106,7 +2098,7 @@ index ea11de3cb..8517fcf29 100644
if (crystal == null || !crystal.isAlive()) {
return false;
}
@@ -306,6 +310,7 @@ public class EntityPhantom extends EntityFlying implements IMonster {
@@ -305,6 +309,7 @@ public class EntityPhantom extends EntityFlying implements IMonster {
@Override
public boolean a() { // shouldExecute
@@ -2114,7 +2106,7 @@ index ea11de3cb..8517fcf29 100644
return phantom.isCirclingCrystal();
}
@@ -368,6 +373,7 @@ public class EntityPhantom extends EntityFlying implements IMonster {
@@ -367,6 +372,7 @@ public class EntityPhantom extends EntityFlying implements IMonster {
@Override
public boolean a() {
@@ -2122,7 +2114,7 @@ index ea11de3cb..8517fcf29 100644
if (this.c > 0) {
--this.c;
return false;
@@ -397,6 +403,7 @@ public class EntityPhantom extends EntityFlying implements IMonster {
@@ -396,6 +402,7 @@ public class EntityPhantom extends EntityFlying implements IMonster {
@Override
public boolean b() {
@@ -2130,7 +2122,7 @@ index ea11de3cb..8517fcf29 100644
EntityLiving entityliving = EntityPhantom.this.getGoalTarget();
return entityliving != null ? EntityPhantom.this.a(entityliving, PathfinderTargetCondition.a) : false;
@@ -411,6 +418,7 @@ public class EntityPhantom extends EntityFlying implements IMonster {
@@ -410,6 +417,7 @@ public class EntityPhantom extends EntityFlying implements IMonster {
@Override
public boolean a() {
@@ -2138,12 +2130,12 @@ index ea11de3cb..8517fcf29 100644
EntityLiving entityliving = EntityPhantom.this.getGoalTarget();
return !isCirclingCrystal() && entityliving != null && EntityPhantom.this.a(EntityPhantom.this.getGoalTarget(), PathfinderTargetCondition.a); // Purpur
@@ -459,12 +467,14 @@ public class EntityPhantom extends EntityFlying implements IMonster {
@@ -458,12 +466,14 @@ public class EntityPhantom extends EntityFlying implements IMonster {
@Override
public boolean a() {
+ if (EntityPhantom.this.getRider() != null) return false; // Purpur
return !isCirclingCrystal() && EntityPhantom.this.getGoalTarget() != null && EntityPhantom.this.bz == EntityPhantom.AttackPhase.SWOOP; // Purpur
return !isCirclingCrystal() && EntityPhantom.this.getGoalTarget() != null && EntityPhantom.this.getAttackPhase() == EntityPhantom.AttackPhase.SWOOP; // Purpur
}
@Override
@@ -2153,15 +2145,15 @@ index ea11de3cb..8517fcf29 100644
if (isCirclingCrystal()) {
return false;
}
@@ -538,6 +548,7 @@ public class EntityPhantom extends EntityFlying implements IMonster {
@@ -537,6 +547,7 @@ public class EntityPhantom extends EntityFlying implements IMonster {
@Override
public boolean a() {
+ if (EntityPhantom.this.getRider() != null) return false; // Purpur
return !isCirclingCrystal() && EntityPhantom.this.getGoalTarget() == null || EntityPhantom.this.bz == EntityPhantom.AttackPhase.CIRCLE; // Purpur
return !isCirclingCrystal() && EntityPhantom.this.getGoalTarget() == null || EntityPhantom.this.getAttackPhase() == EntityPhantom.AttackPhase.CIRCLE; // Purpur
}
@@ -605,14 +616,23 @@ public class EntityPhantom extends EntityFlying implements IMonster {
@@ -604,14 +615,23 @@ public class EntityPhantom extends EntityFlying implements IMonster {
}
}
@@ -2187,7 +2179,7 @@ index ea11de3cb..8517fcf29 100644
}
class d extends EntityAIBodyControl {
@@ -628,7 +648,7 @@ public class EntityPhantom extends EntityFlying implements IMonster {
@@ -627,7 +647,7 @@ public class EntityPhantom extends EntityFlying implements IMonster {
}
}
@@ -2196,7 +2188,7 @@ index ea11de3cb..8517fcf29 100644
private float j = 0.1F;
@@ -636,8 +656,19 @@ public class EntityPhantom extends EntityFlying implements IMonster {
@@ -635,8 +655,19 @@ public class EntityPhantom extends EntityFlying implements IMonster {
super(entityinsentient);
}
@@ -2684,10 +2676,10 @@ index a59b66e66..2feb9d67b 100644
this.setMot(vec3d.x, 0.41999998688697815D, vec3d.z);
diff --git a/src/main/java/net/minecraft/server/EntitySnowman.java b/src/main/java/net/minecraft/server/EntitySnowman.java
index e106b1dce..cee9bd683 100644
index 1fed1d6e7..389372ba4 100644
--- a/src/main/java/net/minecraft/server/EntitySnowman.java
+++ b/src/main/java/net/minecraft/server/EntitySnowman.java
@@ -14,6 +14,7 @@ public class EntitySnowman extends EntityGolem implements IRangedEntity {
@@ -13,6 +13,7 @@ public class EntitySnowman extends EntityGolem implements IRangedEntity {
public EntitySnowman(EntityTypes<? extends EntitySnowman> entitytypes, World world) {
super(entitytypes, world);
@@ -2695,7 +2687,7 @@ index e106b1dce..cee9bd683 100644
}
@Override
@@ -75,6 +76,7 @@ public class EntitySnowman extends EntityGolem implements IRangedEntity {
@@ -74,6 +75,7 @@ public class EntitySnowman extends EntityGolem implements IRangedEntity {
return;
}
@@ -2957,10 +2949,10 @@ index 0037d1380..02a21641c 100644
return false;
} else {
diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java
index ec63f1dbe..4aac81d3a 100644
index c32f40a60..ad58a3c9a 100644
--- a/src/main/java/net/minecraft/server/EntityTypes.java
+++ b/src/main/java/net/minecraft/server/EntityTypes.java
@@ -262,6 +262,10 @@ public class EntityTypes<T extends Entity> {
@@ -263,6 +263,10 @@ public class EntityTypes<T extends Entity> {
}
// Purpur start

View File

@@ -1,17 +1,17 @@
From 19eee04e36e465587cc15e413a773221c07ec6dd Mon Sep 17 00:00:00 2001
From 458fda51cacad3f29fee4f83569abc21f4db2ef3 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Sun, 12 May 2019 00:43:12 -0500
Subject: [PATCH] Make giants naturally spawn and have AI
---
.../java/net/minecraft/server/BiomeBase.java | 1 +
.../java/net/minecraft/server/Biomes.java | 25 ++++++++++++++++
.../minecraft/server/EntityGiantZombie.java | 30 ++++++++++++++++++-
.../java/net/minecraft/server/Biomes.java | 25 +++++++++++++++++
.../minecraft/server/EntityGiantZombie.java | 28 ++++++++++++++++++-
.../java/net/pl3x/purpur/PurpurConfig.java | 7 +++++
4 files changed, 62 insertions(+), 1 deletion(-)
4 files changed, 60 insertions(+), 1 deletion(-)
diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/net/minecraft/server/BiomeBase.java
index 72eb669c50..f1500f7a0e 100644
index 72eb669c5..f1500f7a0 100644
--- a/src/main/java/net/minecraft/server/BiomeBase.java
+++ b/src/main/java/net/minecraft/server/BiomeBase.java
@@ -97,6 +97,7 @@ public abstract class BiomeBase {
@@ -23,7 +23,7 @@ index 72eb669c50..f1500f7a0e 100644
((List) this.u.get(enumcreaturetype)).add(biomebase_biomemeta);
}
diff --git a/src/main/java/net/minecraft/server/Biomes.java b/src/main/java/net/minecraft/server/Biomes.java
index f4698a6809..3f7f7a2de8 100644
index f4698a680..3f7f7a2de 100644
--- a/src/main/java/net/minecraft/server/Biomes.java
+++ b/src/main/java/net/minecraft/server/Biomes.java
@@ -92,5 +92,30 @@ public abstract class Biomes {
@@ -58,25 +58,17 @@ index f4698a6809..3f7f7a2de8 100644
+ // Purpur end
}
diff --git a/src/main/java/net/minecraft/server/EntityGiantZombie.java b/src/main/java/net/minecraft/server/EntityGiantZombie.java
index b7e2022b19..28b93ce736 100644
index b7e2022b1..3af376079 100644
--- a/src/main/java/net/minecraft/server/EntityGiantZombie.java
+++ b/src/main/java/net/minecraft/server/EntityGiantZombie.java
@@ -1,5 +1,7 @@
package net.minecraft.server;
+import net.pl3x.purpur.PurpurConfig;
+
public class EntityGiantZombie extends EntityMonster {
public EntityGiantZombie(EntityTypes<? extends EntityGiantZombie> entitytypes, World world) {
@@ -24,8 +26,34 @@ public class EntityGiantZombie extends EntityMonster {
@@ -24,8 +24,34 @@ public class EntityGiantZombie extends EntityMonster {
this.getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).setValue(50.0D);
}
+ // Purpur start
+ @Override
+ protected void initPathfinder() {
+ if (PurpurConfig.giantsHaveAI) {
+ if (net.pl3x.purpur.PurpurConfig.giantsHaveAI) {
+ this.goalSelector.a(0, new PathfinderGoalFloat(this));
+ this.goalSelector.a(2, new PathfinderGoalMeleeAttack(this, 1.0D, false));
+ this.goalSelector.a(7, new PathfinderGoalRandomStrollLand(this, 1.0D));
@@ -106,7 +98,7 @@ index b7e2022b19..28b93ce736 100644
}
}
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
index 1fe54bb161..162ab011ea 100644
index 1fe54bb16..162ab011e 100644
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
@@ -135,6 +135,13 @@ public class PurpurConfig {

View File

@@ -1,4 +1,4 @@
From b6f682d729fd517aadd3e13ff1cd103df00aaa9a Mon Sep 17 00:00:00 2001
From 0c3b1c07c2cd9820818551a76fe1b2df4a245322 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Sun, 19 May 2019 18:11:53 -0500
Subject: [PATCH] Add regen effect to campfires
@@ -11,7 +11,7 @@ Subject: [PATCH] Add regen effect to campfires
4 files changed, 89 insertions(+), 3 deletions(-)
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 694200deb2..1704609a7d 100644
index 7e59a7b30..53cf6fc39 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -2715,10 +2715,19 @@ public abstract class EntityLiving extends Entity {
@@ -38,7 +38,7 @@ index 694200deb2..1704609a7d 100644
@Override
diff --git a/src/main/java/net/minecraft/server/EntityPotion.java b/src/main/java/net/minecraft/server/EntityPotion.java
index acf6082e7f..b0732da909 100644
index acf6082e7..b0732da90 100644
--- a/src/main/java/net/minecraft/server/EntityPotion.java
+++ b/src/main/java/net/minecraft/server/EntityPotion.java
@@ -91,6 +91,7 @@ public class EntityPotion extends EntityProjectile {
@@ -82,7 +82,7 @@ index acf6082e7f..b0732da909 100644
AxisAlignedBB axisalignedbb = this.getBoundingBox().grow(4.0D, 2.0D, 4.0D);
List<EntityLiving> list = this.world.a(EntityLiving.class, axisalignedbb, EntityPotion.e);
diff --git a/src/main/java/net/minecraft/server/TileEntityCampfire.java b/src/main/java/net/minecraft/server/TileEntityCampfire.java
index 2317adde44..7360e462d9 100644
index 2317adde4..7360e462d 100644
--- a/src/main/java/net/minecraft/server/TileEntityCampfire.java
+++ b/src/main/java/net/minecraft/server/TileEntityCampfire.java
@@ -14,6 +14,7 @@ public class TileEntityCampfire extends TileEntity implements Clearable, ITickab
@@ -151,7 +151,7 @@ index 2317adde44..7360e462d9 100644
}
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 30f11fe261..5e9c633ac8 100644
index 30f11fe26..cea2bcad5 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -60,4 +60,25 @@ public class PurpurWorldConfig {
@@ -168,7 +168,7 @@ index 30f11fe261..5e9c633ac8 100644
+ public int campfireRegenBoostRange = 10;
+ public int campfireRegenBoostAmp = 1;
+ public boolean campfireRegenBoostRequireLineOfSight = false;
+ private void campireRegenSettings() {
+ private void campfireRegenSettings() {
+ campfireRegenInterval = getInt("campfire-regen.interval", campfireRegenInterval);
+ campfireRegenDuration = getInt("campfire-regen.duration", campfireRegenDuration);
+ campfireRegenRange = getInt("campfire-regen.range", campfireRegenRange);

View File

@@ -1,25 +1,38 @@
From efdbf6479d70b20959933d43eae954e9d1d2b9c9 Mon Sep 17 00:00:00 2001
From a0a4abaa7e4b3ee773d5ed33d845fc743dbdf541 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Thu, 23 May 2019 16:20:21 -0500
Subject: [PATCH] Campfires should fall with gravity
---
.../net/minecraft/server/BlockCampfire.java | 20 ++++++++++++++++++-
.../net/pl3x/purpur/PurpurWorldConfig.java | 5 +++++
2 files changed, 24 insertions(+), 1 deletion(-)
src/main/java/net/minecraft/server/Block.java | 1 +
.../net/minecraft/server/BlockCampfire.java | 26 ++++++++++++++++++-
.../net/pl3x/purpur/PurpurWorldConfig.java | 5 ++++
3 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java
index 8e16162a7..47a3ddd7f 100644
--- a/src/main/java/net/minecraft/server/Block.java
+++ b/src/main/java/net/minecraft/server/Block.java
@@ -375,6 +375,7 @@ public class Block implements IMaterial {
PacketDebug.a(world, blockposition);
}
+ public int tickRate(IWorldReader world) { return this.a(world); } // Purpur - OBFHELPER
public int a(IWorldReader iworldreader) {
return 10;
}
diff --git a/src/main/java/net/minecraft/server/BlockCampfire.java b/src/main/java/net/minecraft/server/BlockCampfire.java
index 5cbe8e68e..904bf47b8 100644
index 5cbe8e68e..eca3487b0 100644
--- a/src/main/java/net/minecraft/server/BlockCampfire.java
+++ b/src/main/java/net/minecraft/server/BlockCampfire.java
@@ -72,8 +72,26 @@ public class BlockCampfire extends BlockTileEntity implements IBlockWaterlogged
@@ -72,8 +72,32 @@ public class BlockCampfire extends BlockTileEntity implements IBlockWaterlogged
return (IBlockData) ((IBlockData) ((IBlockData) ((IBlockData) this.getBlockData().set(BlockCampfire.d, flag)).set(BlockCampfire.c, this.j(world.getType(blockposition.down())))).set(BlockCampfire.b, !flag)).set(BlockCampfire.e, blockactioncontext.f());
}
+ // Purpur start - Campfires should fall with gravity
+ @Override
+ public void onPlace(IBlockData iblockdata, World world, BlockPosition pos, IBlockData iblockdata1, boolean flag) {
+ world.getBlockTickList().a(pos, this, this.a((IWorldReader) world));
+ world.getBlockTickList().a(pos, this, tickRate(world));
+ }
+
+ @Override
@@ -30,16 +43,22 @@ index 5cbe8e68e..904bf47b8 100644
+ if (iblockdata.get(BlockCampfire.d) && iblockdata.get(BlockCampfire.b)) {
+ world.setTypeAndData(pos, iblockdata.set(BlockCampfire.b, false), 3);
+ }
+ world.getBlockTickList().a(pos, this, tickRate(world));
+ }
+
+ @Override
+ public int tickRate(IWorldReader world) {
+ return 1;
+ }
+ // Purpur end
+
@Override
public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {
+ generatoraccess.getBlockTickList().a(blockposition, this, this.a((IWorldReader) generatoraccess)); // Purpur - Campfires should fall with gravity
+ generatoraccess.getBlockTickList().a(blockposition, this, tickRate(generatoraccess)); // Purpur - Campfires should fall with gravity
if ((Boolean) iblockdata.get(BlockCampfire.d)) {
generatoraccess.getFluidTickList().a(blockposition, FluidTypes.WATER, FluidTypes.WATER.a((IWorldReader) generatoraccess));
}
@@ -107,7 +125,7 @@ public class BlockCampfire extends BlockTileEntity implements IBlockWaterlogged
@@ -107,7 +131,7 @@ public class BlockCampfire extends BlockTileEntity implements IBlockWaterlogged
@Override
public boolean place(GeneratorAccess generatoraccess, BlockPosition blockposition, IBlockData iblockdata, Fluid fluid) {
@@ -49,7 +68,7 @@ index 5cbe8e68e..904bf47b8 100644
if (flag) {
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 5e9c633ac..6e6d6defd 100644
index cea2bcad5..dc2da586e 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -61,6 +61,11 @@ public class PurpurWorldConfig {

View File

@@ -1,30 +1,29 @@
From c9975466f043da8dc4f0e1c0a7ba4db7dbd352ef Mon Sep 17 00:00:00 2001
From 7a219781d500be21e684c902ea24fb0b97a3697c Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Thu, 6 Jun 2019 21:30:49 -0500
Subject: [PATCH] Campfires burn out in rain
---
src/main/java/net/minecraft/server/BlockCampfire.java | 4 ++++
src/main/java/net/minecraft/server/BlockCampfire.java | 3 +++
src/main/java/net/pl3x/purpur/PurpurWorldConfig.java | 5 +++++
2 files changed, 9 insertions(+)
2 files changed, 8 insertions(+)
diff --git a/src/main/java/net/minecraft/server/BlockCampfire.java b/src/main/java/net/minecraft/server/BlockCampfire.java
index 904bf47b8..1858c8cd4 100644
index eca3487b0..d787fa006 100644
--- a/src/main/java/net/minecraft/server/BlockCampfire.java
+++ b/src/main/java/net/minecraft/server/BlockCampfire.java
@@ -86,6 +86,10 @@ public class BlockCampfire extends BlockTileEntity implements IBlockWaterlogged
@@ -86,6 +86,9 @@ public class BlockCampfire extends BlockTileEntity implements IBlockWaterlogged
if (iblockdata.get(BlockCampfire.d) && iblockdata.get(BlockCampfire.b)) {
world.setTypeAndData(pos, iblockdata.set(BlockCampfire.b, false), 3);
}
+ if (world.purpurConfig.campfiresGoOutInRain && world.getTime() % 20 == 0L && iblockdata.get(BlockCampfire.b) && world.isRainingAt(pos.shift(EnumDirection.UP))) {
+ world.setTypeAndData(pos, iblockdata.set(BlockCampfire.b, false), 3);
+ }
+ world.getBlockTickList().a(pos, this, 1);
world.getBlockTickList().a(pos, this, tickRate(world));
}
// Purpur end
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 490c2ede6..7f1c3ccb6 100644
index 1238864e7..f090f76a1 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -92,6 +92,11 @@ public class PurpurWorldConfig {

View File

@@ -1,17 +1,17 @@
From a5647dc8df2a486be84ea8b22c12981f33c6d318 Mon Sep 17 00:00:00 2001
From 8d3470ef8929a26859c9cdc01999b1a411006bd2 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Thu, 20 Jun 2019 18:48:58 -0500
Subject: [PATCH] Phantoms spawn naturally in the end
---
.../net/minecraft/server/BiomeTheEndHighIsland.java | 3 ++-
src/main/java/net/minecraft/server/EntityPhantom.java | 10 +++++++++-
.../java/net/minecraft/server/SpawnerCreature.java | 6 ++++++
src/main/java/net/pl3x/purpur/PurpurConfig.java | 5 +++++
4 files changed, 22 insertions(+), 2 deletions(-)
.../java/net/minecraft/server/BiomeTheEndHighIsland.java | 3 ++-
src/main/java/net/minecraft/server/EntityPhantom.java | 8 ++++++++
src/main/java/net/minecraft/server/SpawnerCreature.java | 6 ++++++
src/main/java/net/pl3x/purpur/PurpurConfig.java | 5 +++++
4 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/src/main/java/net/minecraft/server/BiomeTheEndHighIsland.java b/src/main/java/net/minecraft/server/BiomeTheEndHighIsland.java
index 6592d15291..67cb1520be 100644
index 6592d1529..67cb1520b 100644
--- a/src/main/java/net/minecraft/server/BiomeTheEndHighIsland.java
+++ b/src/main/java/net/minecraft/server/BiomeTheEndHighIsland.java
@@ -4,10 +4,11 @@ public class BiomeTheEndHighIsland extends BiomeBase {
@@ -28,19 +28,10 @@ index 6592d15291..67cb1520be 100644
}
}
diff --git a/src/main/java/net/minecraft/server/EntityPhantom.java b/src/main/java/net/minecraft/server/EntityPhantom.java
index 8517fcf293..124bcc884e 100644
index 7f414aee9..924358157 100644
--- a/src/main/java/net/minecraft/server/EntityPhantom.java
+++ b/src/main/java/net/minecraft/server/EntityPhantom.java
@@ -10,7 +10,7 @@ public class EntityPhantom extends EntityFlying implements IMonster {
private static final DataWatcherObject<Integer> b = DataWatcher.a(EntityPhantom.class, DataWatcherRegistry.b);
private Vec3D c;
- private BlockPosition d;
+ private BlockPosition d; public void setHome(BlockPosition home) { this.d = home; } public BlockPosition getHome() { return this.d; } // Purpur - OBFHELPER
private EntityPhantom.AttackPhase bz;
private BlockPosition crystalPosition; // Purpur
@@ -26,6 +26,12 @@ public class EntityPhantom extends EntityFlying implements IMonster {
@@ -25,6 +25,12 @@ public class EntityPhantom extends EntityFlying implements IMonster {
this.canBeRiddenInWater = false; // Purpur
}
@@ -53,7 +44,7 @@ index 8517fcf293..124bcc884e 100644
@Override
protected EntityAIBodyControl o() {
return new EntityPhantom.d(this);
@@ -100,6 +106,8 @@ public class EntityPhantom extends EntityFlying implements IMonster {
@@ -99,6 +105,8 @@ public class EntityPhantom extends EntityFlying implements IMonster {
this.world.addParticle(Particles.MYCELIUM, this.locX - (double) f2, this.locY + (double) f4, this.locZ - (double) f3, 0.0D, 0.0D, 0.0D);
}
@@ -63,7 +54,7 @@ index 8517fcf293..124bcc884e 100644
this.die();
}
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index b442e09eb4..3e16cb2bc7 100644
index b442e09eb..3e16cb2bc 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -75,6 +75,12 @@ public final class SpawnerCreature {
@@ -80,7 +71,7 @@ index b442e09eb4..3e16cb2bc7 100644
EntityPositionTypes.Surface entitypositiontypes_surface = EntityPositionTypes.a(entitytypes);
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
index 703fbab6e6..542ac964a8 100644
index 703fbab6e..542ac964a 100644
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
@@ -154,6 +154,11 @@ public class PurpurConfig {