mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Make entities lag less
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
From 2e8872045aafef81931f68bbd35d4e1821a118fa Mon Sep 17 00:00:00 2001
|
||||
From 2dedb27e03409f30cbd7b2f6891c9601f60f4851 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
|
||||
@@ -7,9 +7,9 @@ Subject: [PATCH] Phantoms attracted to crystals and crystals shoot phantoms
|
||||
.../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/EntityPhantom.java | 180 +++++++++++++++++-
|
||||
.../net/minecraft/server/IEntityAccess.java | 1 +
|
||||
5 files changed, 219 insertions(+), 10 deletions(-)
|
||||
5 files changed, 225 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/DamageSource.java b/src/main/java/net/minecraft/server/DamageSource.java
|
||||
index 730a15f332..31454349a2 100644
|
||||
@@ -122,7 +122,7 @@ index 801552fc61..ad88cc9822 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 e5d032d02b..9b62d2ce38 100644
|
||||
index e5d032d02b..2d62248fcc 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityPhantom.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityPhantom.java
|
||||
@@ -8,9 +8,10 @@ import javax.annotation.Nullable;
|
||||
@@ -139,18 +139,26 @@ index e5d032d02b..9b62d2ce38 100644
|
||||
|
||||
public EntityPhantom(EntityTypes<? extends EntityPhantom> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -29,8 +30,10 @@ public class EntityPhantom extends EntityFlying implements IMonster {
|
||||
@@ -29,10 +30,14 @@ public class EntityPhantom extends EntityFlying implements IMonster {
|
||||
|
||||
@Override
|
||||
protected void initPathfinder() {
|
||||
+ this.goalSelector.a(0, new FindCrystalGoal(this)); // Purpur
|
||||
this.goalSelector.a(1, new EntityPhantom.c());
|
||||
this.goalSelector.a(2, new EntityPhantom.i());
|
||||
+ this.goalSelector.a(3, new OrbitCrystalGoal(this)); // Purpur
|
||||
this.goalSelector.a(3, new EntityPhantom.e());
|
||||
this.targetSelector.a(1, new EntityPhantom.b());
|
||||
- this.goalSelector.a(1, new EntityPhantom.c());
|
||||
- this.goalSelector.a(2, new EntityPhantom.i());
|
||||
- this.goalSelector.a(3, new EntityPhantom.e());
|
||||
- this.targetSelector.a(1, new EntityPhantom.b());
|
||||
+ // Purpur start
|
||||
+ this.goalSelector.a(1, new FindCrystalGoal(this));
|
||||
+ this.goalSelector.a(2, new OrbitCrystalGoal(this));
|
||||
+ this.goalSelector.a(3, new EntityPhantom.c()); // PickAttackGoal
|
||||
+ this.goalSelector.a(4, new EntityPhantom.i()); // SweepAttackGoal
|
||||
+ this.goalSelector.a(5, new EntityPhantom.e()); // OrbitPointGoal
|
||||
+ this.targetSelector.a(1, new EntityPhantom.b()); // AttackPlayerGoal
|
||||
+ // Purpur end
|
||||
}
|
||||
@@ -114,6 +117,26 @@ public class EntityPhantom extends EntityFlying implements IMonster {
|
||||
|
||||
@Override
|
||||
@@ -114,6 +119,26 @@ public class EntityPhantom extends EntityFlying implements IMonster {
|
||||
super.mobTick();
|
||||
}
|
||||
|
||||
@@ -177,7 +185,7 @@ index e5d032d02b..9b62d2ce38 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 +225,136 @@ public class EntityPhantom extends EntityFlying implements IMonster {
|
||||
@@ -202,6 +227,136 @@ public class EntityPhantom extends EntityFlying implements IMonster {
|
||||
}
|
||||
// Paper end
|
||||
|
||||
@@ -314,7 +322,7 @@ index e5d032d02b..9b62d2ce38 100644
|
||||
class b extends PathfinderGoal {
|
||||
|
||||
private final PathfinderTargetCondition b;
|
||||
@@ -259,7 +412,7 @@ public class EntityPhantom extends EntityFlying implements IMonster {
|
||||
@@ -259,7 +414,7 @@ public class EntityPhantom extends EntityFlying implements IMonster {
|
||||
public boolean a() {
|
||||
EntityLiving entityliving = EntityPhantom.this.getGoalTarget();
|
||||
|
||||
@@ -323,7 +331,7 @@ index e5d032d02b..9b62d2ce38 100644
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -305,11 +458,16 @@ public class EntityPhantom extends EntityFlying implements IMonster {
|
||||
@@ -305,11 +460,16 @@ public class EntityPhantom extends EntityFlying implements IMonster {
|
||||
|
||||
@Override
|
||||
public boolean a() {
|
||||
@@ -341,7 +349,7 @@ index e5d032d02b..9b62d2ce38 100644
|
||||
EntityLiving entityliving = EntityPhantom.this.getGoalTarget();
|
||||
|
||||
if (entityliving == null) {
|
||||
@@ -379,7 +537,7 @@ public class EntityPhantom extends EntityFlying implements IMonster {
|
||||
@@ -379,7 +539,7 @@ public class EntityPhantom extends EntityFlying implements IMonster {
|
||||
|
||||
@Override
|
||||
public boolean a() {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
From 0dfdfd6131c8ce51cb3d7ca41ec3069c77b3ad10 Mon Sep 17 00:00:00 2001
|
||||
From 87605ad90c84030a6149c9ff94307907be3a48f9 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Sun, 12 May 2019 01:14:46 -0500
|
||||
Subject: [PATCH] Pigs give saddle back
|
||||
@@ -8,10 +8,10 @@ Subject: [PATCH] Pigs give saddle back
|
||||
1 file changed, 11 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityPig.java b/src/main/java/net/minecraft/server/EntityPig.java
|
||||
index fd57e5bde..e1e43cebf 100644
|
||||
index 30feec4701..a2d4c2f54b 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityPig.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityPig.java
|
||||
@@ -119,10 +119,20 @@ public class EntityPig extends EntityAnimal {
|
||||
@@ -120,10 +120,20 @@ public class EntityPig extends EntityAnimal {
|
||||
return true;
|
||||
}
|
||||
if (hasSaddle() && !isVehicle()) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From 7d030363a5743c15c3e5dd3f9fed242f1607e0bb Mon Sep 17 00:00:00 2001
|
||||
From 0499d98e81084bfbc08ce063be99a3eb30487494 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Sat, 15 Jun 2019 03:12:15 -0500
|
||||
Subject: [PATCH] Make Iron Golems Swim
|
||||
@@ -9,7 +9,7 @@ Subject: [PATCH] Make Iron Golems Swim
|
||||
2 files changed, 6 insertions(+)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityIronGolem.java b/src/main/java/net/minecraft/server/EntityIronGolem.java
|
||||
index fd6a926ca..fd7972289 100644
|
||||
index 2c34ab337a..9bb033336c 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityIronGolem.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityIronGolem.java
|
||||
@@ -14,6 +14,7 @@ public class EntityIronGolem extends EntityGolem {
|
||||
@@ -17,11 +17,11 @@ index fd6a926ca..fd7972289 100644
|
||||
@Override
|
||||
protected void initPathfinder() {
|
||||
+ if (net.pl3x.purpur.PurpurConfig.ironGolemSwims) this.goalSelector.a(0, new PathfinderGoalFloat(this)); // Purpur
|
||||
this.goalSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur
|
||||
this.goalSelector.a(1, new PathfinderGoalMeleeAttack(this, 1.0D, true));
|
||||
this.goalSelector.a(2, new PathfinderGoalMoveTowardsTarget(this, 0.9D, 32.0F));
|
||||
this.goalSelector.a(2, new PathfinderGoalStrollVillage(this, 0.6D));
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
index 48c8da91e..ad373d20c 100644
|
||||
index 48c8da91e3..ad373d20c1 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
@@ -155,6 +155,11 @@ public class PurpurConfig {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
From 38b13b7a3ab0c969150fce2169cb40b9a8255fc1 Mon Sep 17 00:00:00 2001
|
||||
From 5b4eae6813ae81a4973df42286316e660562fbdd 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
|
||||
|
||||
---
|
||||
.../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(-)
|
||||
.../server/BiomeTheEndHighIsland.java | 3 ++-
|
||||
.../net/minecraft/server/EntityPhantom.java | 19 +++++++++++++++++++
|
||||
.../net/minecraft/server/SpawnerCreature.java | 6 ++++++
|
||||
.../java/net/pl3x/purpur/PurpurConfig.java | 5 +++++
|
||||
4 files changed, 32 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BiomeTheEndHighIsland.java b/src/main/java/net/minecraft/server/BiomeTheEndHighIsland.java
|
||||
index e8cf6153ec..b2a8fe3020 100644
|
||||
@@ -28,10 +28,18 @@ index e8cf6153ec..b2a8fe3020 100644
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityPhantom.java b/src/main/java/net/minecraft/server/EntityPhantom.java
|
||||
index 7496be10a2..836f18a7de 100644
|
||||
index cc175b3970..84038b9c2f 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityPhantom.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityPhantom.java
|
||||
@@ -25,6 +25,12 @@ public class EntityPhantom extends EntityFlying implements IMonster {
|
||||
@@ -12,6 +12,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 bz; public AttackPhase getAttackPhase() { return this.bz; } // Purpur - OBFHELPER
|
||||
private BlockPosition crystalPosition; // Purpur
|
||||
+ private boolean firstTick = true; // Purpur
|
||||
|
||||
public EntityPhantom(EntityTypes<? extends EntityPhantom> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -25,6 +26,12 @@ public class EntityPhantom extends EntityFlying implements IMonster {
|
||||
this.canBeRiddenInWater = false; // Purpur
|
||||
}
|
||||
|
||||
@@ -44,11 +52,21 @@ index 7496be10a2..836f18a7de 100644
|
||||
@Override
|
||||
protected EntityAIBodyControl o() {
|
||||
return new EntityPhantom.d(this);
|
||||
@@ -99,6 +105,8 @@ public class EntityPhantom extends EntityFlying implements IMonster {
|
||||
@@ -102,6 +109,18 @@ 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);
|
||||
}
|
||||
|
||||
+ if (net.pl3x.purpur.PurpurConfig.spawnPhantomsInTheEnd && world.getWorld().getEnvironment() == org.bukkit.World.Environment.THE_END && getHome().y < 70) getHome().y = 70 + world.random.nextInt(20); // Purpur
|
||||
+ // Purpur start
|
||||
+ if (firstTick) {
|
||||
+ firstTick = false;
|
||||
+ if (net.pl3x.purpur.PurpurConfig.spawnPhantomsInTheEnd) {
|
||||
+ if (world.getWorld().getEnvironment() == org.bukkit.World.Environment.THE_END && getHome().y < 70) {
|
||||
+ // correct home position if spawned in the end
|
||||
+ getHome().y = 70 + world.random.nextInt(20);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
if (!this.world.isClientSide && this.world.getDifficulty() == EnumDifficulty.PEACEFUL) {
|
||||
this.die();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From eab5cee2a53339bdf99a85b6f2966b4aa2045381 Mon Sep 17 00:00:00 2001
|
||||
From 0053b709510e354de23738f70d82e816fa55c91b Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Fri, 12 Jul 2019 16:18:55 -0500
|
||||
Subject: [PATCH] Prevent entities from loading unloaded chunks
|
||||
@@ -22,10 +22,10 @@ index 26a30e1c02..cfe21c2e70 100644
|
||||
|
||||
if (iblockdata.isAir()) {
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java
|
||||
index 0939bbd5fb..6c5e10eef0 100644
|
||||
index a438d30414..5839f848d6 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityEnderman.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityEnderman.java
|
||||
@@ -222,6 +222,7 @@ public class EntityEnderman extends EntityMonster {
|
||||
@@ -223,6 +223,7 @@ public class EntityEnderman extends EntityMonster {
|
||||
|
||||
private boolean l(double d0, double d1, double d2) {
|
||||
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(d0, d1, d2);
|
||||
@@ -34,10 +34,10 @@ index 0939bbd5fb..6c5e10eef0 100644
|
||||
while (blockposition_mutableblockposition.getY() > 0 && !this.world.getType(blockposition_mutableblockposition).getMaterial().isSolid()) {
|
||||
blockposition_mutableblockposition.c(EnumDirection.DOWN);
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
|
||||
index 6fbe1a7817..8fbad4b91b 100644
|
||||
index 4456cf1354..d967620756 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityZombie.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
|
||||
@@ -298,6 +298,7 @@ public class EntityZombie extends EntityMonster {
|
||||
@@ -299,6 +299,7 @@ public class EntityZombie extends EntityMonster {
|
||||
int j1 = j + MathHelper.nextInt(this.random, 7, 40) * MathHelper.nextInt(this.random, -1, 1);
|
||||
int k1 = k + MathHelper.nextInt(this.random, 7, 40) * MathHelper.nextInt(this.random, -1, 1);
|
||||
BlockPosition blockposition = new BlockPosition(i1, j1 - 1, k1);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From 82849cfc5047ae9330b0a1bc67dea5eef6a6ca77 Mon Sep 17 00:00:00 2001
|
||||
From c979581487a50fbb9cb58ea2e7c38131a4c80a78 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Sat, 13 Jul 2019 15:56:22 -0500
|
||||
Subject: [PATCH] Tulips change fox type
|
||||
@@ -10,10 +10,10 @@ Subject: [PATCH] Tulips change fox type
|
||||
3 files changed, 34 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityFox.java b/src/main/java/net/minecraft/server/EntityFox.java
|
||||
index a6fd50c492..53e67ab5f2 100644
|
||||
index 27b29f6336..834fbbe132 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityFox.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityFox.java
|
||||
@@ -231,6 +231,11 @@ public class EntityFox extends EntityAnimal {
|
||||
@@ -232,6 +232,11 @@ public class EntityFox extends EntityAnimal {
|
||||
}
|
||||
|
||||
private void initializePathFinderGoals() {
|
||||
@@ -25,7 +25,7 @@ index a6fd50c492..53e67ab5f2 100644
|
||||
if (this.getFoxType() == EntityFox.Type.RED) {
|
||||
this.targetSelector.a(4, this.bH);
|
||||
this.targetSelector.a(4, this.bI);
|
||||
@@ -263,6 +268,7 @@ public class EntityFox extends EntityAnimal {
|
||||
@@ -264,6 +269,7 @@ public class EntityFox extends EntityAnimal {
|
||||
|
||||
public void setFoxType(EntityFox.Type entityfox_type) {
|
||||
this.datawatcher.set(EntityFox.bz, entityfox_type.c());
|
||||
@@ -33,7 +33,7 @@ index a6fd50c492..53e67ab5f2 100644
|
||||
}
|
||||
|
||||
private List<UUID> ek() {
|
||||
@@ -625,6 +631,27 @@ public class EntityFox extends EntityAnimal {
|
||||
@@ -626,6 +632,27 @@ public class EntityFox extends EntityAnimal {
|
||||
}
|
||||
|
||||
// Purpur start
|
||||
|
||||
Reference in New Issue
Block a user