mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
1848 lines
74 KiB
Diff
1848 lines
74 KiB
Diff
From 00b6ffb99f648b7920bfdcf2a896820f116108c6 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
|
|
|
|
---
|
|
.../server/ControllerLookDolphin.java | 4 +-
|
|
.../java/net/minecraft/server/Entity.java | 15 +++-
|
|
.../net/minecraft/server/EntityChicken.java | 14 +++-
|
|
.../java/net/minecraft/server/EntityCow.java | 11 +++
|
|
.../net/minecraft/server/EntityCreeper.java | 11 +++
|
|
.../net/minecraft/server/EntityDolphin.java | 24 +++++-
|
|
.../net/minecraft/server/EntityDrowned.java | 6 +-
|
|
.../net/minecraft/server/EntityEnderman.java | 12 +++
|
|
.../net/minecraft/server/EntityEndermite.java | 14 +++-
|
|
.../java/net/minecraft/server/EntityFish.java | 30 ++++++--
|
|
.../minecraft/server/EntityGiantZombie.java | 11 +++
|
|
.../net/minecraft/server/EntityGuardian.java | 34 ++++++--
|
|
.../net/minecraft/server/EntityHorse.java | 10 ++-
|
|
.../minecraft/server/EntityHorseAbstract.java | 4 +-
|
|
.../server/EntityHorseChestedAbstract.java | 18 +++--
|
|
.../minecraft/server/EntityHorseDonkey.java | 3 +
|
|
.../net/minecraft/server/EntityHorseMule.java | 3 +
|
|
.../minecraft/server/EntityHorseSkeleton.java | 15 ++--
|
|
.../minecraft/server/EntityHorseZombie.java | 12 +--
|
|
.../net/minecraft/server/EntityHuman.java | 14 +++-
|
|
.../minecraft/server/EntityInsentient.java | 39 ++++++++++
|
|
.../net/minecraft/server/EntityIronGolem.java | 12 +++
|
|
.../net/minecraft/server/EntityLiving.java | 28 +++++--
|
|
.../net/minecraft/server/EntityLlama.java | 37 ++++++++-
|
|
.../minecraft/server/EntityMushroomCow.java | 11 +++
|
|
.../net/minecraft/server/EntityOcelot.java | 11 +++
|
|
.../net/minecraft/server/EntityPhantom.java | 36 +++++++--
|
|
.../java/net/minecraft/server/EntityPig.java | 11 +++
|
|
.../net/minecraft/server/EntityPolarBear.java | 12 +++
|
|
.../net/minecraft/server/EntityRabbit.java | 2 +-
|
|
.../net/minecraft/server/EntitySheep.java | 11 +++
|
|
.../minecraft/server/EntitySilverfish.java | 12 +++
|
|
.../server/EntitySkeletonAbstract.java | 12 +++
|
|
.../net/minecraft/server/EntitySlime.java | 2 +-
|
|
.../net/minecraft/server/EntitySnowman.java | 12 +++
|
|
.../net/minecraft/server/EntitySpider.java | 12 +++
|
|
.../net/minecraft/server/EntitySquid.java | 54 +++++++++++++
|
|
.../server/EntityTameableAnimal.java | 6 ++
|
|
.../net/minecraft/server/EntityTypes.java | 6 ++
|
|
.../java/net/minecraft/server/EntityWolf.java | 11 +++
|
|
.../net/minecraft/server/EntityZombie.java | 12 +++
|
|
.../purpur/controller/ControllerLookWASD.java | 46 +++++++++++
|
|
.../purpur/controller/ControllerMoveWASD.java | 77 +++++++++++++++++++
|
|
.../controller/ControllerMoveWASDFlying.java | 58 ++++++++++++++
|
|
.../controller/ControllerMoveWASDWater.java | 42 ++++++++++
|
|
.../craftbukkit/entity/CraftLivingEntity.java | 10 +++
|
|
46 files changed, 789 insertions(+), 58 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
|
|
create mode 100644 src/main/java/net/pl3x/purpur/controller/ControllerMoveWASDWater.java
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/ControllerLookDolphin.java b/src/main/java/net/minecraft/server/ControllerLookDolphin.java
|
|
index 454627f65..df3d6cf28 100644
|
|
--- a/src/main/java/net/minecraft/server/ControllerLookDolphin.java
|
|
+++ b/src/main/java/net/minecraft/server/ControllerLookDolphin.java
|
|
@@ -1,6 +1,6 @@
|
|
package net.minecraft.server;
|
|
|
|
-public class ControllerLookDolphin extends ControllerLook {
|
|
+public class ControllerLookDolphin extends net.pl3x.purpur.controller.ControllerLookWASD { // Purpur
|
|
|
|
private final int h;
|
|
|
|
@@ -10,7 +10,7 @@ public class ControllerLookDolphin extends ControllerLook {
|
|
}
|
|
|
|
@Override
|
|
- public void a() {
|
|
+ public void tick() { // Purpur
|
|
if (this.d) {
|
|
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 9834a8928..1b38ac55c 100644
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
|
@@ -101,6 +101,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
|
private int id;
|
|
public boolean i; public final boolean blocksEntitySpawning() { return this.i; } // Paper - OBFHELPER
|
|
public final List<Entity> passengers;
|
|
+ private EntityHuman rider; // Purpur
|
|
protected int j;
|
|
private Entity vehicle;
|
|
public boolean attachedToPlayer;
|
|
@@ -134,7 +135,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
|
public double H;
|
|
public double I;
|
|
public double J;
|
|
- public float K;
|
|
+ public float K; public float getStepHeight() { return K; } public void setStepHeight(float stepHeight) { this.K = stepHeight; } // Purpur - OBFHELPER
|
|
public boolean noclip;
|
|
public float M;
|
|
protected final Random random;
|
|
@@ -2015,6 +2016,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
|
return this.world.getCubes(this, this.d(entitypose));
|
|
}
|
|
|
|
+ // Purpur start
|
|
+ public EntityHuman getRider() {
|
|
+ return rider;
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
public void ejectPassengers() {
|
|
for (int i = this.passengers.size() - 1; i >= 0; --i) {
|
|
((Entity) this.passengers.get(i)).stopRiding();
|
|
@@ -2073,6 +2080,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
|
// Spigot end
|
|
if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.getRidingPassenger() instanceof EntityHuman)) {
|
|
this.passengers.add(0, entity);
|
|
+ this.rider = (EntityHuman) entity; // Purpur
|
|
} else {
|
|
this.passengers.add(entity);
|
|
}
|
|
@@ -2111,6 +2119,11 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
|
return false;
|
|
}
|
|
// Spigot end
|
|
+ // Purpur start
|
|
+ if (passengers.get(0) == rider) {
|
|
+ rider = null;
|
|
+ }
|
|
+ // Purpur end
|
|
this.passengers.remove(entity);
|
|
entity.j = 60;
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/EntityChicken.java b/src/main/java/net/minecraft/server/EntityChicken.java
|
|
index a374c3051..600eb1335 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityChicken.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityChicken.java
|
|
@@ -15,6 +15,11 @@ public class EntityChicken extends EntityAnimal {
|
|
super(entitytypes, world);
|
|
this.eggLayTime = this.random.nextInt(6000) + 6000;
|
|
this.a(PathType.WATER, 0.0F);
|
|
+ // Purpur start
|
|
+ this.moveController = new net.pl3x.purpur.controller.ControllerMoveWASD(this);
|
|
+ this.lookController = new net.pl3x.purpur.controller.ControllerLookWASD(this);
|
|
+ this.canBeRiddenInWater = true;
|
|
+ // Purpur end
|
|
}
|
|
|
|
@Override
|
|
@@ -65,7 +70,7 @@ public class EntityChicken extends EntityAnimal {
|
|
}
|
|
|
|
this.bz += this.bE * 2.0F;
|
|
- if (!this.world.isClientSide && this.isAlive() && !this.isBaby() && !this.isChickenJockey() && --this.eggLayTime <= 0) {
|
|
+ if (this.isAlive() && !this.isBaby() && !this.isChickenJockey() && --this.eggLayTime <= 0 && getRider() == null) { // Purpur
|
|
this.a(SoundEffects.ENTITY_CHICKEN_EGG, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
|
|
this.forceDrops = true; // CraftBukkit
|
|
this.a((IMaterial) Items.EGG);
|
|
@@ -75,6 +80,13 @@ public class EntityChicken extends EntityAnimal {
|
|
|
|
}
|
|
|
|
+ // Purpur start - processInteract
|
|
+ @Override
|
|
+ public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
|
+ return super.a(entityhuman, enumhand) || tryRide(entityhuman, enumhand);
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
@Override
|
|
public void b(float f, float f1) {}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityCow.java b/src/main/java/net/minecraft/server/EntityCow.java
|
|
index 4b460a0a7..aa1335b68 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityCow.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityCow.java
|
|
@@ -13,6 +13,11 @@ public class EntityCow extends EntityAnimal {
|
|
|
|
public EntityCow(EntityTypes<? extends EntityCow> entitytypes, World world) {
|
|
super(entitytypes, world);
|
|
+ // Purpur start
|
|
+ this.moveController = new net.pl3x.purpur.controller.ControllerMoveWASD(this);
|
|
+ this.lookController = new net.pl3x.purpur.controller.ControllerLookWASD(this);
|
|
+ this.canBeRiddenInWater = true;
|
|
+ // Purpur end
|
|
}
|
|
|
|
@Override
|
|
@@ -61,6 +66,12 @@ public class EntityCow extends EntityAnimal {
|
|
|
|
@Override
|
|
public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
|
+ // Purpur start - processInteract
|
|
+ return processInteract(entityhuman, enumhand) || tryRide(entityhuman, enumhand);
|
|
+ }
|
|
+
|
|
+ private boolean processInteract(EntityHuman entityhuman, EnumHand enumhand) {
|
|
+ // Purpur end
|
|
ItemStack itemstack = entityhuman.b(enumhand);
|
|
|
|
if (itemstack.getItem() == Items.BUCKET && !entityhuman.abilities.canInstantlyBuild && !this.isBaby()) {
|
|
diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java
|
|
index 0c2c3c730..fa92d23a8 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityCreeper.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityCreeper.java
|
|
@@ -20,6 +20,11 @@ public class EntityCreeper extends EntityMonster {
|
|
|
|
public EntityCreeper(EntityTypes<? extends EntityCreeper> entitytypes, World world) {
|
|
super(entitytypes, world);
|
|
+ // Purpur start
|
|
+ this.moveController = new net.pl3x.purpur.controller.ControllerMoveWASD(this);
|
|
+ this.lookController = new net.pl3x.purpur.controller.ControllerLookWASD(this);
|
|
+ this.canBeRiddenInWater = true;
|
|
+ // Purpur end
|
|
}
|
|
|
|
@Override
|
|
@@ -184,6 +189,12 @@ public class EntityCreeper extends EntityMonster {
|
|
|
|
@Override
|
|
protected boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
|
+ // Purpur start - processInteract
|
|
+ return processInteract(entityhuman, enumhand) || tryRide(entityhuman, enumhand);
|
|
+ }
|
|
+
|
|
+ private boolean processInteract(EntityHuman entityhuman, EnumHand enumhand) {
|
|
+ // Purpur end
|
|
ItemStack itemstack = entityhuman.b(enumhand);
|
|
|
|
if (itemstack.getItem() == Items.FLINT_AND_STEEL) {
|
|
diff --git a/src/main/java/net/minecraft/server/EntityDolphin.java b/src/main/java/net/minecraft/server/EntityDolphin.java
|
|
index 56394ccdc..e42c16603 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityDolphin.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityDolphin.java
|
|
@@ -20,6 +20,7 @@ public class EntityDolphin extends EntityWaterAnimal {
|
|
this.moveController = new EntityDolphin.a(this);
|
|
this.lookController = new ControllerLookDolphin(this, 10);
|
|
this.setCanPickupLoot(true);
|
|
+ this.canBeRiddenInWater = true; // Purpur
|
|
}
|
|
|
|
@Nullable
|
|
@@ -224,6 +225,12 @@ public class EntityDolphin extends EntityWaterAnimal {
|
|
|
|
@Override
|
|
protected boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
|
+ // Purpur start - processInteract
|
|
+ return processInteract(entityhuman, enumhand) || tryRide(entityhuman, enumhand);
|
|
+ }
|
|
+
|
|
+ protected boolean processInteract(EntityHuman entityhuman, EnumHand enumhand) {
|
|
+ // Purpur end
|
|
ItemStack itemstack = entityhuman.b(enumhand);
|
|
|
|
if (!itemstack.isEmpty() && itemstack.getItem().a(TagsItem.FISHES)) {
|
|
@@ -519,7 +526,7 @@ public class EntityDolphin extends EntityWaterAnimal {
|
|
}
|
|
}
|
|
|
|
- static class a extends ControllerMove {
|
|
+ static class a extends net.pl3x.purpur.controller.ControllerMoveWASDWater { // Purpur
|
|
|
|
private final EntityDolphin i;
|
|
|
|
@@ -528,8 +535,21 @@ public class EntityDolphin extends EntityWaterAnimal {
|
|
this.i = entitydolphin;
|
|
}
|
|
|
|
+ // Purpur start
|
|
+ @Override
|
|
+ public void tick(EntityHuman rider) {
|
|
+ if (this.i.getAirTicks() < 150) {
|
|
+ // if drowning override player WASD controls to find air
|
|
+ tick();
|
|
+ } else {
|
|
+ super.tick(rider);
|
|
+ this.i.setMot(this.i.getMot().add(0.0D, 0.005D, 0.0D));
|
|
+ }
|
|
+ }
|
|
+
|
|
@Override
|
|
- public void a() {
|
|
+ public void tick() {
|
|
+ // Purpur end
|
|
if (this.i.isInWater()) {
|
|
this.i.setMot(this.i.getMot().add(0.0D, 0.005D, 0.0D));
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/EntityDrowned.java b/src/main/java/net/minecraft/server/EntityDrowned.java
|
|
index 449fbee60..c692ea296 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityDrowned.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityDrowned.java
|
|
@@ -205,7 +205,7 @@ public class EntityDrowned extends EntityZombie implements IRangedEntity {
|
|
this.bz = flag;
|
|
}
|
|
|
|
- static class d extends ControllerMove {
|
|
+ static class d extends net.pl3x.purpur.controller.ControllerMoveWASD { // Purpur
|
|
|
|
private final EntityDrowned i;
|
|
|
|
@@ -215,7 +215,7 @@ public class EntityDrowned extends EntityZombie implements IRangedEntity {
|
|
}
|
|
|
|
@Override
|
|
- public void a() {
|
|
+ public void tick() { // Purpur
|
|
EntityLiving entityliving = this.i.getGoalTarget();
|
|
|
|
if (this.i.eg() && this.i.isInWater()) {
|
|
@@ -248,7 +248,7 @@ public class EntityDrowned extends EntityZombie implements IRangedEntity {
|
|
this.i.setMot(this.i.getMot().add(0.0D, -0.008D, 0.0D));
|
|
}
|
|
|
|
- super.a();
|
|
+ super.tick(); // Purpur
|
|
}
|
|
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java
|
|
index f08f139e9..1a8b3392e 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityEnderman.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityEnderman.java
|
|
@@ -24,6 +24,11 @@ public class EntityEnderman extends EntityMonster {
|
|
super(entitytypes, world);
|
|
this.K = 1.0F;
|
|
this.a(PathType.WATER, -1.0F);
|
|
+ // Purpur start
|
|
+ this.moveController = new net.pl3x.purpur.controller.ControllerMoveWASD(this);
|
|
+ this.lookController = new net.pl3x.purpur.controller.ControllerLookWASD(this);
|
|
+ this.canBeRiddenInWater = true;
|
|
+ // Purpur end
|
|
}
|
|
|
|
@Override
|
|
@@ -256,6 +261,13 @@ public class EntityEnderman extends EntityMonster {
|
|
|
|
}
|
|
|
|
+ // Purpur start - processInteract
|
|
+ @Override
|
|
+ public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
|
+ return super.a(entityhuman, enumhand) || tryRide(entityhuman, enumhand);
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
public void setCarried(@Nullable IBlockData iblockdata) {
|
|
this.datawatcher.set(EntityEnderman.d, Optional.ofNullable(iblockdata));
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/EntityEndermite.java b/src/main/java/net/minecraft/server/EntityEndermite.java
|
|
index 10b0f9653..a3f01d3af 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityEndermite.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityEndermite.java
|
|
@@ -9,6 +9,11 @@ public class EntityEndermite extends EntityMonster {
|
|
public EntityEndermite(EntityTypes<? extends EntityEndermite> entitytypes, World world) {
|
|
super(entitytypes, world);
|
|
this.f = 3;
|
|
+ // Purpur start
|
|
+ this.moveController = new net.pl3x.purpur.controller.ControllerMoveWASD(this);
|
|
+ this.lookController = new net.pl3x.purpur.controller.ControllerLookWASD(this);
|
|
+ this.canBeRiddenInWater = true;
|
|
+ // Purpur end
|
|
}
|
|
|
|
@Override
|
|
@@ -18,7 +23,7 @@ public class EntityEndermite extends EntityMonster {
|
|
this.goalSelector.a(3, new PathfinderGoalRandomStrollLand(this, 1.0D));
|
|
this.goalSelector.a(7, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
|
|
this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this));
|
|
- this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[0])).a());
|
|
+ this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[0])).a(new Class[0])); // Purpur - decompile error?
|
|
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, true));
|
|
}
|
|
|
|
@@ -138,4 +143,11 @@ public class EntityEndermite extends EntityMonster {
|
|
public EnumMonsterType getMonsterType() {
|
|
return EnumMonsterType.ARTHROPOD;
|
|
}
|
|
+
|
|
+ // Purpur start - processInteract
|
|
+ @Override
|
|
+ public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
|
+ return super.a(entityhuman, enumhand) || tryRide(entityhuman, enumhand);
|
|
+ }
|
|
+ // Purpur end
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/EntityFish.java b/src/main/java/net/minecraft/server/EntityFish.java
|
|
index a28fbdf1e..607386791 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityFish.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityFish.java
|
|
@@ -9,6 +9,10 @@ public abstract class EntityFish extends EntityWaterAnimal {
|
|
public EntityFish(EntityTypes<? extends EntityFish> entitytypes, World world) {
|
|
super(entitytypes, world);
|
|
this.moveController = new EntityFish.a(this);
|
|
+ // Purpur start
|
|
+ this.lookController = new net.pl3x.purpur.controller.ControllerLookWASD(this);
|
|
+ this.canBeRiddenInWater = true;
|
|
+ // Purpur end
|
|
}
|
|
|
|
@Override
|
|
@@ -75,11 +79,7 @@ public abstract class EntityFish extends EntityWaterAnimal {
|
|
protected void initPathfinder() {
|
|
super.initPathfinder();
|
|
this.goalSelector.a(0, new PathfinderGoalPanic(this, 1.25D));
|
|
- PathfinderGoalSelector pathfindergoalselector = this.goalSelector;
|
|
- Predicate predicate = IEntitySelector.f;
|
|
-
|
|
- predicate.getClass();
|
|
- pathfindergoalselector.a(2, new PathfinderGoalAvoidTarget<>(this, EntityHuman.class, 8.0F, 1.6D, 1.4D, predicate::test));
|
|
+ this.goalSelector.a(2, new PathfinderGoalAvoidTarget<>(this, EntityHuman.class, 8.0F, 1.6D, 1.4D, IEntitySelector.f::test)); // Purpur - decompile error?
|
|
this.goalSelector.a(4, new EntityFish.b(this));
|
|
}
|
|
|
|
@@ -91,7 +91,7 @@ public abstract class EntityFish extends EntityWaterAnimal {
|
|
@Override
|
|
public void e(Vec3D vec3d) {
|
|
if (this.de() && this.isInWater()) {
|
|
- this.a(0.01F, vec3d);
|
|
+ this.a(getRider() == null ? 0.1F : getSpeed(), vec3d); // Purpur
|
|
this.move(EnumMoveType.SELF, this.getMot());
|
|
this.setMot(this.getMot().a(0.9D));
|
|
if (this.getGoalTarget() == null) {
|
|
@@ -117,6 +117,12 @@ public abstract class EntityFish extends EntityWaterAnimal {
|
|
|
|
@Override
|
|
protected boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
|
+ // Purpur start - processInteract
|
|
+ return processInteract(entityhuman, enumhand) || tryRide(entityhuman, enumhand);
|
|
+ }
|
|
+
|
|
+ protected boolean processInteract(EntityHuman entityhuman, EnumHand enumhand) {
|
|
+ // Purpur end
|
|
ItemStack itemstack = entityhuman.b(enumhand);
|
|
|
|
if (itemstack.getItem() == Items.WATER_BUCKET && this.isAlive()) {
|
|
@@ -162,7 +168,7 @@ public abstract class EntityFish extends EntityWaterAnimal {
|
|
return SoundEffects.ENTITY_FISH_SWIM;
|
|
}
|
|
|
|
- static class a extends ControllerMove {
|
|
+ static class a extends net.pl3x.purpur.controller.ControllerMoveWASDWater { // Purpur
|
|
|
|
private final EntityFish i;
|
|
|
|
@@ -171,8 +177,16 @@ public abstract class EntityFish extends EntityWaterAnimal {
|
|
this.i = entityfish;
|
|
}
|
|
|
|
+ // Purpur start
|
|
+ @Override
|
|
+ public void tick(EntityHuman rider) {
|
|
+ super.tick(rider);
|
|
+ this.i.setMot(this.i.getMot().add(0.0D, 0.005D, 0.0D));
|
|
+ }
|
|
+
|
|
@Override
|
|
- public void a() {
|
|
+ public void tick() {
|
|
+ // Purpur end
|
|
if (this.i.a(TagsFluid.WATER)) {
|
|
this.i.setMot(this.i.getMot().add(0.0D, 0.005D, 0.0D));
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/EntityGiantZombie.java b/src/main/java/net/minecraft/server/EntityGiantZombie.java
|
|
index bcbade19e..e9962c2a7 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityGiantZombie.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityGiantZombie.java
|
|
@@ -5,7 +5,11 @@ public class EntityGiantZombie extends EntityMonster {
|
|
public EntityGiantZombie(EntityTypes<? extends EntityGiantZombie> entitytypes, World world) {
|
|
super(entitytypes, world);
|
|
// Purpur start
|
|
+ this.moveController = new net.pl3x.purpur.controller.ControllerMoveWASD(this);
|
|
+ this.lookController = new net.pl3x.purpur.controller.ControllerLookWASD(this);
|
|
+ this.canBeRiddenInWater = true;
|
|
this.safeFallDistance = 10.0F;
|
|
+ setStepHeight(2.0F);
|
|
// Purpur end
|
|
}
|
|
|
|
@@ -22,6 +26,13 @@ public class EntityGiantZombie extends EntityMonster {
|
|
this.getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).setValue(50.0D);
|
|
}
|
|
|
|
+ // Purpur start
|
|
+ @Override
|
|
+ public boolean a(EntityHuman entityhuman, EnumHand enumhand) { // processInteract
|
|
+ return super.a(entityhuman, enumhand) || tryRide(entityhuman, enumhand);
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
@Override
|
|
public float a(BlockPosition blockposition, IWorldReader iworldreader) {
|
|
return iworldreader.w(blockposition) - 0.5F;
|
|
diff --git a/src/main/java/net/minecraft/server/EntityGuardian.java b/src/main/java/net/minecraft/server/EntityGuardian.java
|
|
index 335416d96..62d1f2536 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityGuardian.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityGuardian.java
|
|
@@ -22,8 +22,15 @@ public class EntityGuardian extends EntityMonster {
|
|
super(entitytypes, world);
|
|
this.f = 10;
|
|
this.moveController = new EntityGuardian.ControllerMoveGuardian(this);
|
|
- this.c = this.random.nextFloat();
|
|
- this.d = this.c;
|
|
+ // Purpur start
|
|
+ this.lookController = new net.pl3x.purpur.controller.ControllerLookWASD(this) {
|
|
+ @Override
|
|
+ public void setYawPitch(float yaw, float pitch) {
|
|
+ super.setYawPitch(yaw, pitch * 0.35F);
|
|
+ }
|
|
+ };
|
|
+ this.canBeRiddenInWater = true;
|
|
+ // Purpur end
|
|
}
|
|
|
|
@Override
|
|
@@ -77,6 +84,7 @@ public class EntityGuardian extends EntityMonster {
|
|
return (Boolean) this.datawatcher.get(EntityGuardian.b);
|
|
}
|
|
|
|
+ private void setMovingFlag(boolean movingFlag) { r(movingFlag); } // Purpur - OBFHELPER
|
|
private void r(boolean flag) {
|
|
this.datawatcher.set(EntityGuardian.b, flag);
|
|
}
|
|
@@ -302,7 +310,7 @@ public class EntityGuardian extends EntityMonster {
|
|
@Override
|
|
public void e(Vec3D vec3d) {
|
|
if (this.de() && this.isInWater()) {
|
|
- this.a(0.1F, vec3d);
|
|
+ this.a(getRider() == null ? 0.1F : getSpeed(), vec3d); // Purpur
|
|
this.move(EnumMoveType.SELF, this.getMot());
|
|
this.setMot(this.getMot().a(0.9D));
|
|
if (!this.dY() && this.getGoalTarget() == null) {
|
|
@@ -314,7 +322,14 @@ public class EntityGuardian extends EntityMonster {
|
|
|
|
}
|
|
|
|
- static class ControllerMoveGuardian extends ControllerMove {
|
|
+ // Purpur start - processInteract
|
|
+ @Override
|
|
+ public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
|
+ return super.a(entityhuman, enumhand) || tryRide(entityhuman, enumhand);
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
+ static class ControllerMoveGuardian extends net.pl3x.purpur.controller.ControllerMoveWASDWater { // Purpur
|
|
|
|
private final EntityGuardian i;
|
|
|
|
@@ -324,7 +339,16 @@ public class EntityGuardian extends EntityMonster {
|
|
}
|
|
|
|
@Override
|
|
- public void a() {
|
|
+ // Purpur start
|
|
+ public void tick(EntityHuman rider) {
|
|
+ super.tick(rider);
|
|
+ this.i.setMot(this.i.getMot().add(0.0D, 0.005D, 0.0D));
|
|
+ this.i.setMovingFlag(this.i.getForward() > 0.0F); // control tail speed
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void tick() {
|
|
+ // Purpur end
|
|
if (this.h == ControllerMove.Operation.MOVE_TO && !this.i.getNavigation().n()) {
|
|
Vec3D vec3d = new Vec3D(this.b - this.i.locX, this.c - this.i.locY, this.d - this.i.locZ);
|
|
double d0 = vec3d.f();
|
|
diff --git a/src/main/java/net/minecraft/server/EntityHorse.java b/src/main/java/net/minecraft/server/EntityHorse.java
|
|
index 401f00561..0e6759303 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityHorse.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityHorse.java
|
|
@@ -201,12 +201,14 @@ public class EntityHorse extends EntityHorseAbstract {
|
|
}
|
|
}
|
|
|
|
- if (this.isBaby()) {
|
|
- return super.a(entityhuman, enumhand);
|
|
- } else {
|
|
+ // Purpur start - allow riding babies
|
|
+ //if (this.isBaby()) {
|
|
+ // return super.a(entityhuman, enumhand);
|
|
+ //} else {
|
|
this.g(entityhuman);
|
|
return true;
|
|
- }
|
|
+ //}
|
|
+ // Purpur end
|
|
}
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityHorseAbstract.java b/src/main/java/net/minecraft/server/EntityHorseAbstract.java
|
|
index 686bca4f2..0250a5653 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityHorseAbstract.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityHorseAbstract.java
|
|
@@ -81,7 +81,7 @@ public abstract class EntityHorseAbstract extends EntityAnimal implements IInven
|
|
}
|
|
|
|
public boolean isTamed() {
|
|
- return this.r(2);
|
|
+ return this.r(2) || isBaby(); // Purpur
|
|
}
|
|
|
|
@Nullable
|
|
@@ -280,6 +280,7 @@ public abstract class EntityHorseAbstract extends EntityAnimal implements IInven
|
|
return true;
|
|
}
|
|
|
|
+ public boolean isSaddled() { return eq(); } // Purpur - OBFHELPER
|
|
public boolean eq() {
|
|
return this.r(4);
|
|
}
|
|
@@ -600,6 +601,7 @@ public abstract class EntityHorseAbstract extends EntityAnimal implements IInven
|
|
|
|
}
|
|
|
|
+ public void makeMad() { eu(); } // Purpur - OBFHELPER
|
|
public void eu() {
|
|
this.eB();
|
|
SoundEffect soundeffect = this.getSoundAngry();
|
|
diff --git a/src/main/java/net/minecraft/server/EntityHorseChestedAbstract.java b/src/main/java/net/minecraft/server/EntityHorseChestedAbstract.java
|
|
index e61d8f07d..371f2dcb9 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityHorseChestedAbstract.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityHorseChestedAbstract.java
|
|
@@ -152,8 +152,12 @@ public abstract class EntityHorseChestedAbstract extends EntityHorseAbstract {
|
|
return true;
|
|
}
|
|
|
|
- this.eu();
|
|
- return true;
|
|
+ // Purpur start - don't make babies mad
|
|
+ if (!this.isBaby()) {
|
|
+ this.makeMad();
|
|
+ return true;
|
|
+ }
|
|
+ // Purpur end
|
|
}
|
|
|
|
if (!this.isCarryingChest() && itemstack.getItem() == Blocks.CHEST.getItem()) {
|
|
@@ -178,12 +182,14 @@ public abstract class EntityHorseChestedAbstract extends EntityHorseAbstract {
|
|
}
|
|
}
|
|
|
|
- if (this.isBaby()) {
|
|
- return super.a(entityhuman, enumhand);
|
|
- } else {
|
|
+ // Purpur start - allow riding babies
|
|
+ //if (this.isBaby()) {
|
|
+ // return super.a(entityhuman, enumhand);
|
|
+ //} else {
|
|
this.g(entityhuman);
|
|
return true;
|
|
- }
|
|
+ //}
|
|
+ // Purpur end
|
|
}
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityHorseDonkey.java b/src/main/java/net/minecraft/server/EntityHorseDonkey.java
|
|
index 46338f0f8..3083269a5 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityHorseDonkey.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityHorseDonkey.java
|
|
@@ -4,6 +4,9 @@ public class EntityHorseDonkey extends EntityHorseChestedAbstract {
|
|
|
|
public EntityHorseDonkey(EntityTypes<? extends EntityHorseDonkey> entitytypes, World world) {
|
|
super(entitytypes, world);
|
|
+ // Purpur start
|
|
+ this.canBeRiddenInWater = true;
|
|
+ // Purpur end
|
|
}
|
|
|
|
@Override
|
|
diff --git a/src/main/java/net/minecraft/server/EntityHorseMule.java b/src/main/java/net/minecraft/server/EntityHorseMule.java
|
|
index ef930d194..119ca47d0 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityHorseMule.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityHorseMule.java
|
|
@@ -4,6 +4,9 @@ public class EntityHorseMule extends EntityHorseChestedAbstract {
|
|
|
|
public EntityHorseMule(EntityTypes<? extends EntityHorseMule> entitytypes, World world) {
|
|
super(entitytypes, world);
|
|
+ // Purpur start
|
|
+ this.canBeRiddenInWater = true;
|
|
+ // Purpur end
|
|
}
|
|
|
|
@Override
|
|
diff --git a/src/main/java/net/minecraft/server/EntityHorseSkeleton.java b/src/main/java/net/minecraft/server/EntityHorseSkeleton.java
|
|
index b96726456..2193f218a 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityHorseSkeleton.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityHorseSkeleton.java
|
|
@@ -10,6 +10,9 @@ public class EntityHorseSkeleton extends EntityHorseAbstract {
|
|
|
|
public EntityHorseSkeleton(EntityTypes<? extends EntityHorseSkeleton> entitytypes, World world) {
|
|
super(entitytypes, world);
|
|
+ // Purpur start
|
|
+ this.canBeRiddenInWater = true;
|
|
+ // Purpur end
|
|
}
|
|
|
|
@Override
|
|
@@ -154,18 +157,20 @@ public class EntityHorseSkeleton extends EntityHorseAbstract {
|
|
|
|
if (itemstack.getItem() instanceof ItemMonsterEgg) {
|
|
return super.a(entityhuman, enumhand);
|
|
- } else if (!this.isTamed()) {
|
|
+ // Purpur start - allow riding babies
|
|
+ } else if (!this.isTamed() && !this.isBaby()) {
|
|
return false;
|
|
- } else if (this.isBaby()) {
|
|
- return super.a(entityhuman, enumhand);
|
|
- } else if (entityhuman.isSneaking()) {
|
|
+ //} else if (this.isBaby()) {
|
|
+ // return super.a(entityhuman, enumhand);
|
|
+ // Purpur end
|
|
+ } else if (entityhuman.isSneaking() && !this.isBaby()) { // Purpur - don't open inventory on babies
|
|
this.e(entityhuman);
|
|
return true;
|
|
} else if (this.isVehicle()) {
|
|
return super.a(entityhuman, enumhand);
|
|
} else {
|
|
if (!itemstack.isEmpty()) {
|
|
- if (itemstack.getItem() == Items.SADDLE && !this.eq()) {
|
|
+ if (!this.isBaby() && itemstack.getItem() == Items.SADDLE && !this.isSaddled()) { // Purpur - don't open inventory on babies
|
|
this.e(entityhuman);
|
|
return true;
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/EntityHorseZombie.java b/src/main/java/net/minecraft/server/EntityHorseZombie.java
|
|
index 1160929e1..e25511ef1 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityHorseZombie.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityHorseZombie.java
|
|
@@ -51,18 +51,20 @@ public class EntityHorseZombie extends EntityHorseAbstract {
|
|
|
|
if (itemstack.getItem() instanceof ItemMonsterEgg) {
|
|
return super.a(entityhuman, enumhand);
|
|
- } else if (!this.isTamed()) {
|
|
+ // Purpur start - allow riding babies
|
|
+ } else if (!this.isTamed() && !this.isBaby()) {
|
|
return false;
|
|
- } else if (this.isBaby()) {
|
|
- return super.a(entityhuman, enumhand);
|
|
- } else if (entityhuman.isSneaking()) {
|
|
+ //} else if (this.isBaby()) {
|
|
+ // return super.a(entityhuman, enumhand);
|
|
+ // Purpur end
|
|
+ } else if (entityhuman.isSneaking() && !this.isBaby()) { // Purpur - don't open inventory on babies
|
|
this.e(entityhuman);
|
|
return true;
|
|
} else if (this.isVehicle()) {
|
|
return super.a(entityhuman, enumhand);
|
|
} else {
|
|
if (!itemstack.isEmpty()) {
|
|
- if (!this.eq() && itemstack.getItem() == Items.SADDLE) {
|
|
+ if (!this.isBaby() && itemstack.getItem() == Items.SADDLE && !this.isSaddled()) { // Purpur - don't open inventory on babies
|
|
this.e(entityhuman);
|
|
return true;
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
|
|
index e811a2917..f25c394e3 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
|
@@ -347,9 +347,21 @@ public abstract class EntityHuman extends EntityLiving {
|
|
this.activeContainer = this.defaultContainer;
|
|
}
|
|
|
|
+ // Purpur start
|
|
+ boolean mounting = false;
|
|
+
|
|
+ @Override
|
|
+ public void setSneaking(boolean sneaking) {
|
|
+ if (this.mounting && !sneaking) {
|
|
+ this.mounting = false;
|
|
+ }
|
|
+ super.setSneaking(sneaking);
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
@Override
|
|
public void passengerTick() {
|
|
- if (!this.world.isClientSide && this.isSneaking() && this.isPassenger()) {
|
|
+ if (this.isSneaking() && this.isPassenger() && !this.mounting) { // Purpur
|
|
this.stopRiding();
|
|
this.setSneaking(false);
|
|
} else {
|
|
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
|
|
index a0c089477..db5284f48 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
|
@@ -492,6 +492,7 @@ public abstract class EntityInsentient extends EntityLiving {
|
|
this.bb = f;
|
|
}
|
|
|
|
+ public void setSpeed(float speed) { o(speed); } // Purpur - OBFHELPER
|
|
@Override
|
|
public void o(float f) {
|
|
super.o(f);
|
|
@@ -1359,4 +1360,42 @@ public abstract class EntityInsentient extends EntityLiving {
|
|
public boolean a(Item item) {
|
|
return this.getItemInMainHand().getItem() == item || this.getItemInOffHand().getItem() == item;
|
|
}
|
|
+
|
|
+ // Purpur start
|
|
+ public boolean hasRidePermission(EntityHuman entityhuman) {
|
|
+ return entityhuman.getBukkitEntity().hasPermission("allow.ride." + getEntityType().getName());
|
|
+ }
|
|
+
|
|
+ public boolean tryRide(EntityHuman entityhuman, EnumHand enumhand) {
|
|
+ if (enumhand != EnumHand.MAIN_HAND) {
|
|
+ return false;
|
|
+ }
|
|
+ if (!entityhuman.isSneaking()) {
|
|
+ return false;
|
|
+ }
|
|
+ if (!passengers.isEmpty() || entityhuman.isPassenger()) {
|
|
+ return false;
|
|
+ }
|
|
+ if (!hasRidePermission(entityhuman)) {
|
|
+ entityhuman.getBukkitEntity().sendMessage("You cannot mount that mob");
|
|
+ return false;
|
|
+ }
|
|
+ return mountTo(entityhuman);
|
|
+ }
|
|
+
|
|
+ public boolean mountTo(EntityHuman entityhuman) {
|
|
+ entityhuman.mounting = true;
|
|
+ entityhuman.yaw = this.yaw;
|
|
+ entityhuman.pitch = this.pitch;
|
|
+ if (entityhuman.startRiding(this)) {
|
|
+ entityhuman.setJumping(false); // fixes jump on mount
|
|
+ return true;
|
|
+ }
|
|
+ return entityhuman.mounting = false;
|
|
+ }
|
|
+
|
|
+ public boolean onSpacebar() {
|
|
+ return false;
|
|
+ }
|
|
+ // Purpur end
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/EntityIronGolem.java b/src/main/java/net/minecraft/server/EntityIronGolem.java
|
|
index 7aebc90af..d9d77ab44 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityIronGolem.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityIronGolem.java
|
|
@@ -9,6 +9,11 @@ public class EntityIronGolem extends EntityGolem {
|
|
public EntityIronGolem(EntityTypes<? extends EntityIronGolem> entitytypes, World world) {
|
|
super(entitytypes, world);
|
|
this.K = 1.0F;
|
|
+ // Purpur start
|
|
+ this.moveController = new net.pl3x.purpur.controller.ControllerMoveWASD(this);
|
|
+ this.lookController = new net.pl3x.purpur.controller.ControllerLookWASD(this);
|
|
+ this.canBeRiddenInWater = true;
|
|
+ // Purpur end
|
|
}
|
|
|
|
@Override
|
|
@@ -175,4 +180,11 @@ public class EntityIronGolem extends EntityGolem {
|
|
return SpawnerCreature.a((IBlockAccess) iworldreader, blockposition2, iblockdata1, iblockdata1.p()) && SpawnerCreature.a((IBlockAccess) iworldreader, blockposition, iworldreader.getType(blockposition), FluidTypes.EMPTY.i()) && iworldreader.i(this);
|
|
}
|
|
}
|
|
+
|
|
+ // Purpur start - processInteract
|
|
+ @Override
|
|
+ public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
|
+ return super.a(entityhuman, enumhand) || tryRide(entityhuman, enumhand);
|
|
+ }
|
|
+ // Purpur end
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
index b27a9efcc..40264185a 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
@@ -88,9 +88,9 @@ public abstract class EntityLiving extends Entity {
|
|
protected int aY; protected int getKillCount() { return this.aY; } // Paper - OBFHELPER
|
|
public float lastDamage;
|
|
protected boolean jumping;
|
|
- public float bb;
|
|
- public float bc;
|
|
- public float bd;
|
|
+ public float bb; public float getStrafe() { return bb; } public void setStrafe(float strafe) { bb = strafe; } // Purpur - OBFHELPER
|
|
+ public float bc; public float getVertical() { return bc; } public void setVertical(float vertical) { bc = vertical; } // Purpur - OBFHELPER
|
|
+ public float bd; public float getForward() { return bd; } public void setForward(float forward) { bd = forward; } // Purpur - OBFHELPER
|
|
public float be;
|
|
protected int bf;
|
|
protected double bg;
|
|
@@ -369,10 +369,19 @@ public abstract class EntityLiving extends Entity {
|
|
return this.isBaby() ? 0.5F : 1.0F;
|
|
}
|
|
|
|
+ // Purpur start
|
|
+ protected boolean canBeRiddenInWater = false;
|
|
+
|
|
+ public void setCanBeRiddenInWater(boolean canBeRiddenInWater) {
|
|
+ this.canBeRiddenInWater = canBeRiddenInWater;
|
|
+ }
|
|
+
|
|
+ public boolean canBeRiddenInWater() { return be(); }
|
|
@Override
|
|
public boolean be() {
|
|
- return false;
|
|
+ return canBeRiddenInWater;
|
|
}
|
|
+ // Purpur end
|
|
|
|
protected void cn() {
|
|
++this.deathTicks;
|
|
@@ -2027,7 +2036,7 @@ public abstract class EntityLiving extends Entity {
|
|
return 0.42F;
|
|
}
|
|
|
|
- protected void jump() {
|
|
+ public void jump() { // Purpur - protected -> public
|
|
float f;
|
|
|
|
if (this.hasEffect(MobEffects.JUMP)) {
|
|
@@ -2256,10 +2265,12 @@ public abstract class EntityLiving extends Entity {
|
|
return this.onGround ? this.da() * (0.21600002F / (f * f * f)) : this.aO;
|
|
}
|
|
|
|
+ public float getSpeed() { return da(); } // Purpur - OBFHELPER
|
|
public float da() {
|
|
return this.bD;
|
|
}
|
|
|
|
+ public void setSpeed(float speed) { o(speed); } // Purpur - OBFHELPER
|
|
public void o(float f) {
|
|
this.bD = f;
|
|
}
|
|
@@ -2683,6 +2694,12 @@ public abstract class EntityLiving extends Entity {
|
|
this.fallDistance = 0.0F;
|
|
}
|
|
|
|
+ // Purpur start
|
|
+ public boolean isJumping() {
|
|
+ return jumping;
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
public void setJumping(boolean flag) {
|
|
this.jumping = flag;
|
|
}
|
|
@@ -2735,6 +2752,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/EntityLlama.java b/src/main/java/net/minecraft/server/EntityLlama.java
|
|
index f8a8da637..6870fb875 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityLlama.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityLlama.java
|
|
@@ -16,6 +16,29 @@ public class EntityLlama extends EntityHorseChestedAbstract implements IRangedEn
|
|
|
|
public EntityLlama(EntityTypes<? extends EntityLlama> entitytypes, World world) {
|
|
super(entitytypes, world);
|
|
+ // Purpur start
|
|
+ this.moveController = new net.pl3x.purpur.controller.ControllerMoveWASD(this) {
|
|
+ @Override
|
|
+ protected void tick(EntityHuman rider) {
|
|
+ if (EntityLlama.this.isSaddled()) {
|
|
+ super.tick(rider);
|
|
+ } else {
|
|
+ super.tick();
|
|
+ }
|
|
+ }
|
|
+ };
|
|
+ this.lookController = new net.pl3x.purpur.controller.ControllerLookWASD(this) {
|
|
+ @Override
|
|
+ protected void tick(EntityHuman rider) {
|
|
+ if (EntityLlama.this.isSaddled()) {
|
|
+ super.tick(rider);
|
|
+ } else {
|
|
+ super.tick();
|
|
+ }
|
|
+ }
|
|
+ };
|
|
+ this.canBeRiddenInWater = true;
|
|
+ // Purpur end
|
|
}
|
|
|
|
public void setStrength(int i) {
|
|
@@ -371,6 +394,18 @@ public class EntityLlama extends EntityHorseChestedAbstract implements IRangedEn
|
|
}
|
|
}
|
|
|
|
+ // Purpur start
|
|
+ @Override
|
|
+ public boolean isLeashed() {
|
|
+ return getRider() != null || super.isLeashed();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public Entity getLeashHolder() {
|
|
+ return getRider() != null ? getRider() : super.getLeashHolder();
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
public void eG() {
|
|
if (this.bN != null) {
|
|
this.bN.bO = null;
|
|
@@ -385,7 +420,7 @@ public class EntityLlama extends EntityHorseChestedAbstract implements IRangedEn
|
|
}
|
|
|
|
public boolean eH() {
|
|
- return this.bO != null;
|
|
+ return getRider() != null || this.bO != null; // Purpur
|
|
}
|
|
|
|
public boolean eI() {
|
|
diff --git a/src/main/java/net/minecraft/server/EntityMushroomCow.java b/src/main/java/net/minecraft/server/EntityMushroomCow.java
|
|
index d2de3589a..9aa7a8adb 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityMushroomCow.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityMushroomCow.java
|
|
@@ -18,6 +18,11 @@ public class EntityMushroomCow extends EntityCow {
|
|
public EntityMushroomCow(EntityTypes<? extends EntityMushroomCow> entitytypes, World world) {
|
|
super(entitytypes, world);
|
|
this.bC = Blocks.MYCELIUM;
|
|
+ // Purpur start
|
|
+ this.moveController = new net.pl3x.purpur.controller.ControllerMoveWASD(this);
|
|
+ this.lookController = new net.pl3x.purpur.controller.ControllerLookWASD(this);
|
|
+ this.canBeRiddenInWater = true;
|
|
+ // Purpur end
|
|
}
|
|
|
|
@Override
|
|
@@ -40,6 +45,12 @@ public class EntityMushroomCow extends EntityCow {
|
|
|
|
@Override
|
|
public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
|
+ // Purpur start - processInteract
|
|
+ return processInteract(entityhuman, enumhand) || tryRide(entityhuman, enumhand);
|
|
+ }
|
|
+
|
|
+ public boolean processInteract(EntityHuman entityhuman, EnumHand enumhand) {
|
|
+ // Purpur end
|
|
ItemStack itemstack = entityhuman.b(enumhand);
|
|
|
|
if (itemstack.getItem() == Items.BOWL && this.getAge() >= 0 && !entityhuman.abilities.canInstantlyBuild) {
|
|
diff --git a/src/main/java/net/minecraft/server/EntityOcelot.java b/src/main/java/net/minecraft/server/EntityOcelot.java
|
|
index 1713bead2..3200ac91b 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityOcelot.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityOcelot.java
|
|
@@ -14,6 +14,11 @@ public class EntityOcelot extends EntityAnimal {
|
|
public EntityOcelot(EntityTypes<? extends EntityOcelot> entitytypes, World world) {
|
|
super(entitytypes, world);
|
|
this.dV();
|
|
+ // Purpur start
|
|
+ this.moveController = new net.pl3x.purpur.controller.ControllerMoveWASD(this);
|
|
+ this.lookController = new net.pl3x.purpur.controller.ControllerLookWASD(this);
|
|
+ this.canBeRiddenInWater = true;
|
|
+ // Purpur end
|
|
}
|
|
|
|
private boolean isTrusting() {
|
|
@@ -127,6 +132,12 @@ public class EntityOcelot extends EntityAnimal {
|
|
|
|
@Override
|
|
public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
|
+ // Purpur start - processInteract
|
|
+ return processInteract(entityhuman, enumhand) || tryRide(entityhuman, enumhand);
|
|
+ }
|
|
+
|
|
+ public boolean processInteract(EntityHuman entityhuman, EnumHand enumhand) {
|
|
+ // Purpur end
|
|
ItemStack itemstack = entityhuman.b(enumhand);
|
|
|
|
if ((this.bD == null || this.bD.h()) && !this.isTrusting() && this.i(itemstack) && entityhuman.h((Entity) this) < 9.0D) {
|
|
diff --git a/src/main/java/net/minecraft/server/EntityPhantom.java b/src/main/java/net/minecraft/server/EntityPhantom.java
|
|
index 6aa116f4b..15f6d612d 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityPhantom.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityPhantom.java
|
|
@@ -22,6 +22,7 @@ public class EntityPhantom extends EntityFlying implements IMonster {
|
|
this.f = 5;
|
|
this.moveController = new EntityPhantom.g(this);
|
|
this.lookController = new EntityPhantom.f(this);
|
|
+ this.canBeRiddenInWater = false; // Purpur
|
|
}
|
|
|
|
@Override
|
|
@@ -106,7 +107,7 @@ public class EntityPhantom extends EntityFlying implements IMonster {
|
|
|
|
@Override
|
|
public void movementTick() {
|
|
- if (this.isAlive() && this.dS()) {
|
|
+ if (this.isAlive() && getRider() == null && this.isInDaylight()) { // Purpur - do not set fire if being ridden
|
|
this.setOnFire(8);
|
|
}
|
|
|
|
@@ -227,6 +228,11 @@ public class EntityPhantom extends EntityFlying implements IMonster {
|
|
// Paper end
|
|
|
|
// Purpur start
|
|
+ @Override
|
|
+ public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
|
+ return super.a(entityhuman, enumhand) || tryRide(entityhuman, enumhand);
|
|
+ }
|
|
+
|
|
class FindCrystalGoal extends PathfinderGoal {
|
|
private final EntityPhantom phantom;
|
|
private EntityEnderCrystal crystal;
|
|
@@ -605,14 +611,23 @@ public class EntityPhantom extends EntityFlying implements IMonster {
|
|
}
|
|
}
|
|
|
|
- class f extends ControllerLook {
|
|
+ class f extends net.pl3x.purpur.controller.ControllerLookWASD { // Purpur
|
|
|
|
public f(EntityInsentient entityinsentient) {
|
|
super(entityinsentient);
|
|
}
|
|
|
|
@Override
|
|
- public void a() {}
|
|
+ // Purpur start
|
|
+ public void tick(EntityHuman rider) {
|
|
+ setYawPitch(rider.yaw, -rider.pitch * 0.75F);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void tick() {
|
|
+ // do nothing
|
|
+ }
|
|
+ // Purpur end
|
|
}
|
|
|
|
class d extends EntityAIBodyControl {
|
|
@@ -628,7 +643,7 @@ public class EntityPhantom extends EntityFlying implements IMonster {
|
|
}
|
|
}
|
|
|
|
- class g extends ControllerMove {
|
|
+ class g extends net.pl3x.purpur.controller.ControllerMoveWASDFlying { // Purpur
|
|
|
|
private float j = 0.1F;
|
|
|
|
@@ -636,8 +651,19 @@ public class EntityPhantom extends EntityFlying implements IMonster {
|
|
super(entityinsentient);
|
|
}
|
|
|
|
+ // Purpur start
|
|
@Override
|
|
- public void a() {
|
|
+ public void tick(EntityHuman rider) {
|
|
+ if (!EntityPhantom.this.onGround) {
|
|
+ // phantom is always in motion when flying
|
|
+ // TODO - FIX THIS - rider.setForward(1.0F);
|
|
+ }
|
|
+ super.tick(rider);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void tick() {
|
|
+ // Purpur end
|
|
if (EntityPhantom.this.positionChanged) {
|
|
EntityPhantom.this.yaw += 180.0F;
|
|
this.j = 0.1F;
|
|
diff --git a/src/main/java/net/minecraft/server/EntityPig.java b/src/main/java/net/minecraft/server/EntityPig.java
|
|
index 616075569..50906c5bd 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityPig.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityPig.java
|
|
@@ -18,6 +18,11 @@ public class EntityPig extends EntityAnimal {
|
|
|
|
public EntityPig(EntityTypes<? extends EntityPig> entitytypes, World world) {
|
|
super(entitytypes, world);
|
|
+ // Purpur start
|
|
+ this.moveController = new net.pl3x.purpur.controller.ControllerMoveWASD(this);
|
|
+ this.lookController = new net.pl3x.purpur.controller.ControllerLookWASD(this);
|
|
+ this.canBeRiddenInWater = true;
|
|
+ // Purpur end
|
|
}
|
|
|
|
@Override
|
|
@@ -111,6 +116,12 @@ public class EntityPig extends EntityAnimal {
|
|
|
|
@Override
|
|
public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
|
+ // Purpur start - processInteract
|
|
+ return processInteract(entityhuman, enumhand) || tryRide(entityhuman, enumhand);
|
|
+ }
|
|
+
|
|
+ public boolean processInteract(EntityHuman entityhuman, EnumHand enumhand) {
|
|
+ // Purpur end
|
|
if (!super.a(entityhuman, enumhand)) {
|
|
ItemStack itemstack = entityhuman.b(enumhand);
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityPolarBear.java b/src/main/java/net/minecraft/server/EntityPolarBear.java
|
|
index 182a3195e..7458f3ff6 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityPolarBear.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityPolarBear.java
|
|
@@ -14,6 +14,11 @@ public class EntityPolarBear extends EntityAnimal {
|
|
|
|
public EntityPolarBear(EntityTypes<? extends EntityPolarBear> entitytypes, World world) {
|
|
super(entitytypes, world);
|
|
+ // Purpur start
|
|
+ this.moveController = new net.pl3x.purpur.controller.ControllerMoveWASD(this);
|
|
+ this.lookController = new net.pl3x.purpur.controller.ControllerLookWASD(this);
|
|
+ this.canBeRiddenInWater = true;
|
|
+ // Purpur end
|
|
}
|
|
|
|
@Override
|
|
@@ -154,6 +159,13 @@ public class EntityPolarBear extends EntityAnimal {
|
|
return 0.98F;
|
|
}
|
|
|
|
+ // Purpur start - processInteract
|
|
+ @Override
|
|
+ public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
|
+ return super.a(entityhuman, enumhand) || tryRide(entityhuman, enumhand);
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
@Override
|
|
public GroupDataEntity prepare(GeneratorAccess generatoraccess, DifficultyDamageScaler difficultydamagescaler, EnumMobSpawn enummobspawn, @Nullable GroupDataEntity groupdataentity, @Nullable NBTTagCompound nbttagcompound) {
|
|
if (groupdataentity instanceof EntityPolarBear.b) {
|
|
diff --git a/src/main/java/net/minecraft/server/EntityRabbit.java b/src/main/java/net/minecraft/server/EntityRabbit.java
|
|
index f6fa87158..bd0679e74 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityRabbit.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityRabbit.java
|
|
@@ -59,7 +59,7 @@ public class EntityRabbit extends EntityAnimal {
|
|
}
|
|
|
|
@Override
|
|
- protected void jump() {
|
|
+ public void jump() { // Purpur - protected -> public
|
|
super.jump();
|
|
double d0 = this.moveController.c();
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntitySheep.java b/src/main/java/net/minecraft/server/EntitySheep.java
|
|
index f0cd951ac..d52a320a6 100644
|
|
--- a/src/main/java/net/minecraft/server/EntitySheep.java
|
|
+++ b/src/main/java/net/minecraft/server/EntitySheep.java
|
|
@@ -55,6 +55,11 @@ public class EntitySheep extends EntityAnimal {
|
|
|
|
public EntitySheep(EntityTypes<? extends EntitySheep> entitytypes, World world) {
|
|
super(entitytypes, world);
|
|
+ // Purpur start
|
|
+ this.moveController = new net.pl3x.purpur.controller.ControllerMoveWASD(this);
|
|
+ this.lookController = new net.pl3x.purpur.controller.ControllerLookWASD(this);
|
|
+ this.canBeRiddenInWater = true;
|
|
+ // Purpur end
|
|
}
|
|
|
|
@Override
|
|
@@ -144,6 +149,12 @@ public class EntitySheep extends EntityAnimal {
|
|
|
|
@Override
|
|
public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
|
+ // Purpur start - processInteract
|
|
+ return processInteract(entityhuman, enumhand) || tryRide(entityhuman, enumhand);
|
|
+ }
|
|
+
|
|
+ public boolean processInteract(EntityHuman entityhuman, EnumHand enumhand) {
|
|
+ // Purpur end
|
|
ItemStack itemstack = entityhuman.b(enumhand);
|
|
|
|
if (itemstack.getItem() == Items.SHEARS && !this.isSheared() && !this.isBaby()) {
|
|
diff --git a/src/main/java/net/minecraft/server/EntitySilverfish.java b/src/main/java/net/minecraft/server/EntitySilverfish.java
|
|
index d823c6b6d..e0a52dbe9 100644
|
|
--- a/src/main/java/net/minecraft/server/EntitySilverfish.java
|
|
+++ b/src/main/java/net/minecraft/server/EntitySilverfish.java
|
|
@@ -10,6 +10,11 @@ public class EntitySilverfish extends EntityMonster {
|
|
|
|
public EntitySilverfish(EntityTypes<? extends EntitySilverfish> entitytypes, World world) {
|
|
super(entitytypes, world);
|
|
+ // Purpur start
|
|
+ this.moveController = new net.pl3x.purpur.controller.ControllerMoveWASD(this);
|
|
+ this.lookController = new net.pl3x.purpur.controller.ControllerLookWASD(this);
|
|
+ this.canBeRiddenInWater = true;
|
|
+ // Purpur end
|
|
}
|
|
|
|
@Override
|
|
@@ -117,6 +122,13 @@ public class EntitySilverfish extends EntityMonster {
|
|
return EnumMonsterType.ARTHROPOD;
|
|
}
|
|
|
|
+ // Purpur start - processInteract
|
|
+ @Override
|
|
+ public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
|
+ return super.a(entityhuman, enumhand) || tryRide(entityhuman, enumhand);
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
static class PathfinderGoalSilverfishHideInBlock extends PathfinderGoalRandomStroll {
|
|
|
|
private EnumDirection h;
|
|
diff --git a/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java b/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java
|
|
index 85157e80d..4317d9703 100644
|
|
--- a/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java
|
|
+++ b/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java
|
|
@@ -24,6 +24,11 @@ public abstract class EntitySkeletonAbstract extends EntityMonster implements IR
|
|
protected EntitySkeletonAbstract(EntityTypes<? extends EntitySkeletonAbstract> entitytypes, World world) {
|
|
super(entitytypes, world);
|
|
this.dV();
|
|
+ // Purpur start
|
|
+ this.moveController = new net.pl3x.purpur.controller.ControllerMoveWASD(this);
|
|
+ this.lookController = new net.pl3x.purpur.controller.ControllerLookWASD(this);
|
|
+ this.canBeRiddenInWater = true;
|
|
+ // Purpur end
|
|
}
|
|
|
|
@Override
|
|
@@ -199,4 +204,11 @@ public abstract class EntitySkeletonAbstract extends EntityMonster implements IR
|
|
public double aN() {
|
|
return -0.6D;
|
|
}
|
|
+
|
|
+ // Purpur start - processInteract
|
|
+ @Override
|
|
+ public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
|
+ return super.a(entityhuman, enumhand) || tryRide(entityhuman, enumhand);
|
|
+ }
|
|
+ // Purpur end
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/EntitySlime.java b/src/main/java/net/minecraft/server/EntitySlime.java
|
|
index d720d0fae..e4f7797ed 100644
|
|
--- a/src/main/java/net/minecraft/server/EntitySlime.java
|
|
+++ b/src/main/java/net/minecraft/server/EntitySlime.java
|
|
@@ -316,7 +316,7 @@ public class EntitySlime extends EntityInsentient implements IMonster {
|
|
}
|
|
|
|
@Override
|
|
- protected void jump() {
|
|
+ public void jump() { // Purpur - protected -> public
|
|
Vec3D vec3d = this.getMot();
|
|
|
|
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 c13dfc6cc..9997ef494 100644
|
|
--- a/src/main/java/net/minecraft/server/EntitySnowman.java
|
|
+++ b/src/main/java/net/minecraft/server/EntitySnowman.java
|
|
@@ -13,6 +13,11 @@ public class EntitySnowman extends EntityGolem implements IRangedEntity {
|
|
|
|
public EntitySnowman(EntityTypes<? extends EntitySnowman> entitytypes, World world) {
|
|
super(entitytypes, world);
|
|
+ // Purpur start
|
|
+ this.moveController = new net.pl3x.purpur.controller.ControllerMoveWASD(this);
|
|
+ this.lookController = new net.pl3x.purpur.controller.ControllerLookWASD(this);
|
|
+ this.canBeRiddenInWater = true;
|
|
+ // Purpur end
|
|
}
|
|
|
|
@Override
|
|
@@ -74,6 +79,7 @@ public class EntitySnowman extends EntityGolem implements IRangedEntity {
|
|
return;
|
|
}
|
|
|
|
+ if (getRider() != null) return; // Purpur - don't leave snow trail when being ridden
|
|
IBlockData iblockdata = Blocks.SNOW.getBlockData();
|
|
|
|
for (int l = 0; l < 4; ++l) {
|
|
@@ -111,6 +117,12 @@ public class EntitySnowman extends EntityGolem implements IRangedEntity {
|
|
|
|
@Override
|
|
protected boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
|
+ // Purpur start - processInteract
|
|
+ return processInteract(entityhuman, enumhand) || tryRide(entityhuman, enumhand);
|
|
+ }
|
|
+
|
|
+ public boolean processInteract(EntityHuman entityhuman, EnumHand enumhand) {
|
|
+ // Purpur end
|
|
ItemStack itemstack = entityhuman.b(enumhand);
|
|
|
|
if (this.hasPumpkin()) { if (itemstack.getItem() == Items.SHEARS) { // Purpur
|
|
diff --git a/src/main/java/net/minecraft/server/EntitySpider.java b/src/main/java/net/minecraft/server/EntitySpider.java
|
|
index b560a8969..3089314a8 100644
|
|
--- a/src/main/java/net/minecraft/server/EntitySpider.java
|
|
+++ b/src/main/java/net/minecraft/server/EntitySpider.java
|
|
@@ -9,6 +9,11 @@ public class EntitySpider extends EntityMonster {
|
|
|
|
public EntitySpider(EntityTypes<? extends EntitySpider> entitytypes, World world) {
|
|
super(entitytypes, world);
|
|
+ // Purpur start
|
|
+ this.moveController = new net.pl3x.purpur.controller.ControllerMoveWASD(this);
|
|
+ this.lookController = new net.pl3x.purpur.controller.ControllerLookWASD(this);
|
|
+ this.canBeRiddenInWater = true;
|
|
+ // Purpur end
|
|
}
|
|
|
|
@Override
|
|
@@ -115,6 +120,13 @@ public class EntitySpider extends EntityMonster {
|
|
this.datawatcher.set(EntitySpider.b, b0);
|
|
}
|
|
|
|
+ // Purpur start - processInteract
|
|
+ @Override
|
|
+ public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
|
+ return super.a(entityhuman, enumhand) || tryRide(entityhuman, enumhand);
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
@Nullable
|
|
@Override
|
|
public GroupDataEntity prepare(GeneratorAccess generatoraccess, DifficultyDamageScaler difficultydamagescaler, EnumMobSpawn enummobspawn, @Nullable GroupDataEntity groupdataentity, @Nullable NBTTagCompound nbttagcompound) {
|
|
diff --git a/src/main/java/net/minecraft/server/EntitySquid.java b/src/main/java/net/minecraft/server/EntitySquid.java
|
|
index 77c0ed42f..8dff2065c 100644
|
|
--- a/src/main/java/net/minecraft/server/EntitySquid.java
|
|
+++ b/src/main/java/net/minecraft/server/EntitySquid.java
|
|
@@ -21,6 +21,7 @@ public class EntitySquid extends EntityWaterAnimal {
|
|
super(entitytypes, world);
|
|
//this.random.setSeed((long) this.getId()); // Paper
|
|
this.bF = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
|
|
+ this.canBeRiddenInWater = true; // Purpur
|
|
}
|
|
|
|
@Override
|
|
@@ -174,6 +175,7 @@ public class EntitySquid extends EntityWaterAnimal {
|
|
return this.locY > this.world.spigotConfig.squidSpawnRangeMin && this.locY < maxHeight; // Spigot // Paper
|
|
}
|
|
|
|
+ public void setMovementVector(float x, float y, float z) { a(x, y, z); } // Purpur - OBFHELPER
|
|
public void a(float f, float f1, float f2) {
|
|
this.bH = f;
|
|
this.bI = f1;
|
|
@@ -184,6 +186,13 @@ public class EntitySquid extends EntityWaterAnimal {
|
|
return this.bH != 0.0F || this.bI != 0.0F || this.bJ != 0.0F;
|
|
}
|
|
|
|
+ // Purpur start - processInteract
|
|
+ @Override
|
|
+ public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
|
+ return super.a(entityhuman, enumhand) || tryRide(entityhuman, enumhand);
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
class a extends PathfinderGoal {
|
|
|
|
private int b;
|
|
@@ -258,6 +267,39 @@ public class EntitySquid extends EntityWaterAnimal {
|
|
|
|
@Override
|
|
public void e() {
|
|
+ // Purpur start
|
|
+ EntityHuman rider = this.b.getRider();
|
|
+ if (rider != null) {
|
|
+ EntitySquid squid = this.b;
|
|
+ if (rider.isJumping()) {
|
|
+ squid.onSpacebar();
|
|
+ }
|
|
+ float forward = rider.getForward();
|
|
+ float strafe = rider.getStrafe();
|
|
+ float speed = (float) squid.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue() * 5F;
|
|
+ if (forward < 0.0F) {
|
|
+ speed *= -0.5;
|
|
+ }
|
|
+ org.bukkit.util.Vector dir = rider.getBukkitEntity().getEyeLocation().getDirection().normalize().multiply(speed / 20.0F);
|
|
+ if (strafe != 0.0F) {
|
|
+ if (forward == 0.0F) {
|
|
+ dir.setY(0);
|
|
+ rotateVectorAroundY(dir, strafe > 0.0F ? -90 : 90);
|
|
+ } else if (forward < 0.0F) {
|
|
+ rotateVectorAroundY(dir, strafe > 0.0F ? 45 : -45);
|
|
+ } else {
|
|
+ rotateVectorAroundY(dir, strafe > 0.0F ? -45 : 45);
|
|
+ }
|
|
+ }
|
|
+ if (forward != 0.0F || strafe != 0.0F) {
|
|
+ squid.setMovementVector((float) dir.getX(), (float) dir.getY(), (float) dir.getZ());
|
|
+ } else {
|
|
+ squid.setMovementVector(0.0F, 0.0F, 0.0F);
|
|
+ }
|
|
+ return;
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
int i = this.b.cv();
|
|
|
|
if (i > 100) {
|
|
@@ -272,5 +314,17 @@ public class EntitySquid extends EntityWaterAnimal {
|
|
}
|
|
|
|
}
|
|
+
|
|
+ // Purpur start
|
|
+ private void rotateVectorAroundY(org.bukkit.util.Vector vector, double degrees) {
|
|
+ double rad = Math.toRadians(degrees);
|
|
+ double cos = Math.cos(rad);
|
|
+ double sine = Math.sin(rad);
|
|
+ double x = vector.getX();
|
|
+ double z = vector.getZ();
|
|
+ vector.setX(cos * x - sine * z);
|
|
+ vector.setZ(sine * x + cos * z);
|
|
+ }
|
|
+ // Purpur end
|
|
}
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/EntityTameableAnimal.java b/src/main/java/net/minecraft/server/EntityTameableAnimal.java
|
|
index 70bf06b94..2f41d8ade 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityTameableAnimal.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityTameableAnimal.java
|
|
@@ -127,6 +127,12 @@ public abstract class EntityTameableAnimal extends EntityAnimal {
|
|
this.datawatcher.set(EntityTameableAnimal.bA, Optional.ofNullable(uuid));
|
|
}
|
|
|
|
+ // Purpur start
|
|
+ public boolean isOwner(EntityHuman entityhuman) {
|
|
+ return entityhuman != null && entityhuman.getUniqueID() == getOwnerUUID();
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
public void tame(EntityHuman entityhuman) {
|
|
this.setTamed(true);
|
|
this.setOwnerUUID(entityhuman.getUniqueID());
|
|
diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java
|
|
index 483c97692..181e92980 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityTypes.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityTypes.java
|
|
@@ -255,6 +255,12 @@ public class EntityTypes<T extends Entity> {
|
|
return this.ba;
|
|
}
|
|
|
|
+ // Purpur start
|
|
+ public String getName() {
|
|
+ return IRegistry.ENTITY_TYPE.getKey(this).getKey();
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
public String e() {
|
|
if (this.be == null) {
|
|
this.be = SystemUtils.a("entity", IRegistry.ENTITY_TYPE.getKey(this));
|
|
diff --git a/src/main/java/net/minecraft/server/EntityWolf.java b/src/main/java/net/minecraft/server/EntityWolf.java
|
|
index 4167ce8f8..245d36084 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityWolf.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityWolf.java
|
|
@@ -29,6 +29,11 @@ public class EntityWolf extends EntityTameableAnimal {
|
|
public EntityWolf(EntityTypes<? extends EntityWolf> entitytypes, World world) {
|
|
super(entitytypes, world);
|
|
this.setTamed(false);
|
|
+ // Purpur start
|
|
+ this.moveController = new net.pl3x.purpur.controller.ControllerMoveWASD(this);
|
|
+ this.lookController = new net.pl3x.purpur.controller.ControllerLookWASD(this);
|
|
+ this.canBeRiddenInWater = true;
|
|
+ // Purpur end
|
|
}
|
|
|
|
@Override
|
|
@@ -275,6 +280,12 @@ public class EntityWolf extends EntityTameableAnimal {
|
|
|
|
@Override
|
|
public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
|
+ // Purpur start - processInteract
|
|
+ return processInteract(entityhuman, enumhand) || ((!isTamed() || isOwner(entityhuman)) && tryRide(entityhuman, enumhand));
|
|
+ }
|
|
+
|
|
+ public boolean processInteract(EntityHuman entityhuman, EnumHand enumhand) {
|
|
+ // Purpur end
|
|
ItemStack itemstack = entityhuman.b(enumhand);
|
|
Item item = itemstack.getItem();
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
|
|
index b06235d46..f013cfe5b 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityZombie.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
|
|
@@ -36,6 +36,11 @@ public class EntityZombie extends EntityMonster {
|
|
public EntityZombie(EntityTypes<? extends EntityZombie> entitytypes, World world) {
|
|
super(entitytypes, world);
|
|
this.bD = new PathfinderGoalBreakDoor(this, EntityZombie.bC);
|
|
+ // Purpur start
|
|
+ this.moveController = new net.pl3x.purpur.controller.ControllerMoveWASD(this);
|
|
+ this.lookController = new net.pl3x.purpur.controller.ControllerLookWASD(this);
|
|
+ this.canBeRiddenInWater = true;
|
|
+ // Purpur end
|
|
}
|
|
|
|
public EntityZombie(World world) {
|
|
@@ -460,6 +465,13 @@ public class EntityZombie extends EntityMonster {
|
|
return itemstack.getItem() == Items.EGG && this.isBaby() && this.isPassenger() ? false : super.g(itemstack);
|
|
}
|
|
|
|
+ // Purpur start - processInteract
|
|
+ @Override
|
|
+ public boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
|
+ return super.a(entityhuman, enumhand) || tryRide(entityhuman, enumhand);
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
@Nullable
|
|
@Override
|
|
public GroupDataEntity prepare(GeneratorAccess generatoraccess, DifficultyDamageScaler difficultydamagescaler, EnumMobSpawn enummobspawn, @Nullable GroupDataEntity groupdataentity, @Nullable NBTTagCompound nbttagcompound) {
|
|
diff --git a/src/main/java/net/pl3x/purpur/controller/ControllerLookWASD.java b/src/main/java/net/pl3x/purpur/controller/ControllerLookWASD.java
|
|
new file mode 100644
|
|
index 000000000..851ab80e4
|
|
--- /dev/null
|
|
+++ b/src/main/java/net/pl3x/purpur/controller/ControllerLookWASD.java
|
|
@@ -0,0 +1,46 @@
|
|
+package net.pl3x.purpur.controller;
|
|
+
|
|
+import net.minecraft.server.ControllerLook;
|
|
+import net.minecraft.server.EntityHuman;
|
|
+import net.minecraft.server.EntityInsentient;
|
|
+
|
|
+public class ControllerLookWASD extends ControllerLook {
|
|
+ protected final EntityInsentient entity;
|
|
+ private float yawOffset = 0;
|
|
+ private float pitchOffset = 0;
|
|
+
|
|
+ public ControllerLookWASD(EntityInsentient entity) {
|
|
+ super(entity);
|
|
+ this.entity = entity;
|
|
+ }
|
|
+
|
|
+ // tick
|
|
+ @Override
|
|
+ public void a() {
|
|
+ if (entity.getRider() != null) {
|
|
+ tick(entity.getRider());
|
|
+ } else {
|
|
+ tick();
|
|
+ }
|
|
+ }
|
|
+
|
|
+ protected void tick() {
|
|
+ super.a(); // tick
|
|
+ }
|
|
+
|
|
+ protected void tick(EntityHuman rider) {
|
|
+ setYawPitch(rider.yaw, rider.pitch);
|
|
+ }
|
|
+
|
|
+ public void setYawPitch(float yaw, float pitch) {
|
|
+ entity.lastYaw = entity.yaw = (yaw + yawOffset) % 360.0F;
|
|
+ entity.setRenderYawOffset(entity.lastYaw);
|
|
+ entity.setHeadRotation(entity.lastYaw);
|
|
+ entity.pitch = (pitch + pitchOffset) % 360.0F;
|
|
+ }
|
|
+
|
|
+ public void setOffsets(float yaw, float pitch) {
|
|
+ yawOffset = yaw;
|
|
+ pitchOffset = pitch;
|
|
+ }
|
|
+}
|
|
diff --git a/src/main/java/net/pl3x/purpur/controller/ControllerMoveWASD.java b/src/main/java/net/pl3x/purpur/controller/ControllerMoveWASD.java
|
|
new file mode 100644
|
|
index 000000000..4f7dec9bc
|
|
--- /dev/null
|
|
+++ b/src/main/java/net/pl3x/purpur/controller/ControllerMoveWASD.java
|
|
@@ -0,0 +1,77 @@
|
|
+package net.pl3x.purpur.controller;
|
|
+
|
|
+import net.minecraft.server.ControllerMove;
|
|
+import net.minecraft.server.EntityHuman;
|
|
+import net.minecraft.server.EntityInsentient;
|
|
+import net.minecraft.server.GenericAttributes;
|
|
+
|
|
+public class ControllerMoveWASD extends ControllerMove {
|
|
+ protected final EntityInsentient entity;
|
|
+
|
|
+ public ControllerMoveWASD(EntityInsentient entity) {
|
|
+ super(entity);
|
|
+ this.entity = entity;
|
|
+ }
|
|
+
|
|
+ // isUpdating
|
|
+ @Override
|
|
+ public boolean b() {
|
|
+ return entity.getRider() != null || super.b();
|
|
+ }
|
|
+
|
|
+ // tick
|
|
+ @Override
|
|
+ public void a() {
|
|
+ if (entity.getRider() != null) {
|
|
+ tick(entity.getRider());
|
|
+ } else {
|
|
+ tick();
|
|
+ }
|
|
+ }
|
|
+
|
|
+ protected void tick() {
|
|
+ super.a(); // tick
|
|
+ }
|
|
+
|
|
+ protected void tick(EntityHuman rider) {
|
|
+ float forward = rider.getForward() * 0.5F;
|
|
+ float strafe = rider.getStrafe() * 0.25F;
|
|
+
|
|
+ if (forward <= 0.0F) {
|
|
+ forward *= 0.5F;
|
|
+ }
|
|
+
|
|
+ float yaw = rider.yaw;
|
|
+ if (strafe != 0) {
|
|
+ if (forward == 0) {
|
|
+ yaw += strafe > 0 ? -90 : 90;
|
|
+ forward = Math.abs(strafe * 2);
|
|
+ } else {
|
|
+ yaw += strafe > 0 ? -30 : 30;
|
|
+ strafe /= 2;
|
|
+ if (forward < 0) {
|
|
+ yaw += strafe > 0 ? -110 : 110;
|
|
+ forward *= -1;
|
|
+ }
|
|
+ }
|
|
+ } else if (forward < 0) {
|
|
+ yaw -= 180;
|
|
+ forward *= -1;
|
|
+ }
|
|
+
|
|
+ ((ControllerLookWASD) entity.getControllerLook()).setOffsets(yaw - rider.yaw, 0);
|
|
+
|
|
+ if (rider.isJumping()) {
|
|
+ //RidableSpacebarEvent event = new RidableSpacebarEvent(entity);
|
|
+ if (/*event.callEvent() && !event.isHandled() &&*/ !entity.onSpacebar() && entity.onGround) {
|
|
+ entity.jump();
|
|
+ }
|
|
+ }
|
|
+
|
|
+ entity.setSpeed((float) (e = entity.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue()));
|
|
+ entity.setForward(forward);
|
|
+
|
|
+ f = entity.getForward();
|
|
+ g = entity.getStrafe();
|
|
+ }
|
|
+}
|
|
diff --git a/src/main/java/net/pl3x/purpur/controller/ControllerMoveWASDFlying.java b/src/main/java/net/pl3x/purpur/controller/ControllerMoveWASDFlying.java
|
|
new file mode 100644
|
|
index 000000000..1a5a0c04c
|
|
--- /dev/null
|
|
+++ b/src/main/java/net/pl3x/purpur/controller/ControllerMoveWASDFlying.java
|
|
@@ -0,0 +1,58 @@
|
|
+package net.pl3x.purpur.controller;
|
|
+
|
|
+import net.minecraft.server.EntityHuman;
|
|
+import net.minecraft.server.EntityInsentient;
|
|
+import net.minecraft.server.GenericAttributes;
|
|
+
|
|
+public class ControllerMoveWASDFlying extends ControllerMoveWASD {
|
|
+ protected final float groundSpeedModifier;
|
|
+ private final double maxY;
|
|
+ private int tooHighCooldown = 0;
|
|
+
|
|
+ public ControllerMoveWASDFlying(EntityInsentient entity) {
|
|
+ this(entity, 1.0F, 256D);
|
|
+ }
|
|
+
|
|
+ public ControllerMoveWASDFlying(EntityInsentient entity, float groundSpeedModifier, double maxY) {
|
|
+ super(entity);
|
|
+ this.groundSpeedModifier = groundSpeedModifier;
|
|
+ this.maxY = maxY;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void tick(EntityHuman rider) {
|
|
+ float forward = Math.max(0.0F, rider.getForward());
|
|
+ float vertical = forward == 0.0F ? 0.0F : -(rider.pitch / 45.0F);
|
|
+ float strafe = rider.getStrafe();
|
|
+
|
|
+ if (rider.isJumping()) {
|
|
+ //RidableSpacebarEvent event = new RidableSpacebarEvent(ridable);
|
|
+ //Bukkit.getPluginManager().callEvent(event);
|
|
+ //if (!event.isCancelled() && !event.isHandled()) {
|
|
+ entity.onSpacebar();
|
|
+ //}
|
|
+ }
|
|
+
|
|
+ if (entity.locY >= maxY || --tooHighCooldown > 0) {
|
|
+ tooHighCooldown = 60;
|
|
+ entity.setMot(entity.getMot().add(0.0D, -0.05D, 0.0D));
|
|
+ vertical = 0.0F;
|
|
+ }
|
|
+
|
|
+ float speed = (float) (e = entity.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue());
|
|
+
|
|
+ if (entity.onGround) {
|
|
+ speed *= groundSpeedModifier; // TODO = fix this!
|
|
+ }
|
|
+
|
|
+ entity.setNoGravity(forward > 0);
|
|
+
|
|
+ entity.setSpeed(speed);
|
|
+ entity.setVertical(vertical);
|
|
+ entity.setStrafe(strafe);
|
|
+ entity.setForward(forward);
|
|
+
|
|
+ f = entity.getForward();
|
|
+ g = entity.getStrafe();
|
|
+ }
|
|
+}
|
|
diff --git a/src/main/java/net/pl3x/purpur/controller/ControllerMoveWASDWater.java b/src/main/java/net/pl3x/purpur/controller/ControllerMoveWASDWater.java
|
|
new file mode 100644
|
|
index 000000000..74ff48259
|
|
--- /dev/null
|
|
+++ b/src/main/java/net/pl3x/purpur/controller/ControllerMoveWASDWater.java
|
|
@@ -0,0 +1,42 @@
|
|
+package net.pl3x.purpur.controller;
|
|
+
|
|
+import net.minecraft.server.EntityHuman;
|
|
+import net.minecraft.server.EntityInsentient;
|
|
+import net.minecraft.server.GenericAttributes;
|
|
+
|
|
+public class ControllerMoveWASDWater extends ControllerMoveWASD {
|
|
+ public ControllerMoveWASDWater(EntityInsentient entity) {
|
|
+ super(entity);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ protected void tick(EntityHuman rider) {
|
|
+ float forward = rider.getForward();
|
|
+ float strafe = rider.getStrafe() * 0.5F; // strafe slower by default
|
|
+ float vertical = -(rider.pitch / 90);
|
|
+
|
|
+ if (forward == 0.0F) {
|
|
+ // strafe slower if not moving forward
|
|
+ strafe *= 0.5F;
|
|
+ // do not move vertically if not moving forward
|
|
+ vertical = 0.0F;
|
|
+ } else if (forward < 0.0F) {
|
|
+ // water animals can't swim backwards
|
|
+ forward = 0.0F;
|
|
+ vertical = 0.0F;
|
|
+ }
|
|
+
|
|
+ if (rider.isJumping()) {
|
|
+ entity.onSpacebar();
|
|
+ }
|
|
+
|
|
+ entity.setSpeed((float) (e = entity.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue()) * 0.1F);
|
|
+
|
|
+ entity.setForward(forward);
|
|
+ entity.setStrafe(strafe);
|
|
+ entity.setVertical(vertical);
|
|
+
|
|
+ f = entity.getForward();
|
|
+ g = entity.getStrafe();
|
|
+ }
|
|
+}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
index 640faccfd..2390baa75 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
@@ -697,5 +697,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|
public void setSafeFallDistance(float safeFallDistance) {
|
|
getHandle().safeFallDistance = safeFallDistance;
|
|
}
|
|
+
|
|
+ @Override
|
|
+ public boolean canBeRiddenInWater() {
|
|
+ return getHandle().canBeRiddenInWater();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setCanBeRiddenInWater(boolean canBeRiddenInWater) {
|
|
+ getHandle().setCanBeRiddenInWater(canBeRiddenInWater);
|
|
+ }
|
|
// Purpur end
|
|
}
|
|
--
|
|
2.20.1
|
|
|