mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 08:27:43 +01:00
Make fish ridable
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
From a1a7384376a7c067a41ce83576b440e7e2163642 Mon Sep 17 00:00:00 2001
|
||||
From 6c445241a0b405492e77193cc149910a7cd0554c 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
|
||||
@@ -14,6 +14,7 @@ Subject: [PATCH] Integrate ridables
|
||||
.../net/minecraft/server/EntityDrowned.java | 38 ++++++++-
|
||||
.../net/minecraft/server/EntityEnderman.java | 15 ++++
|
||||
.../net/minecraft/server/EntityEndermite.java | 15 ++++
|
||||
.../java/net/minecraft/server/EntityFish.java | 28 ++++++-
|
||||
.../net/minecraft/server/EntityHorse.java | 10 ++-
|
||||
.../minecraft/server/EntityHorseAbstract.java | 4 +-
|
||||
.../server/EntityHorseChestedAbstract.java | 18 +++--
|
||||
@@ -43,7 +44,7 @@ Subject: [PATCH] Integrate ridables
|
||||
.../purpur/controller/ControllerMoveWASD.java | 77 +++++++++++++++++++
|
||||
.../controller/ControllerMoveWASDWater.java | 42 ++++++++++
|
||||
.../craftbukkit/entity/CraftLivingEntity.java | 12 +++
|
||||
39 files changed, 676 insertions(+), 34 deletions(-)
|
||||
40 files changed, 701 insertions(+), 37 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/ControllerMoveWASDWater.java
|
||||
@@ -233,7 +234,7 @@ index 945a75dd..588bba0a 100644
|
||||
|
||||
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 8bf15a68..68133d47 100644
|
||||
index 8bf15a68..5ef1796b 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityDolphin.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityDolphin.java
|
||||
@@ -18,6 +18,7 @@ public class EntityDolphin extends EntityWaterAnimal {
|
||||
@@ -249,7 +250,7 @@ index 8bf15a68..68133d47 100644
|
||||
|
||||
protected boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
||||
+ // Purpur start - processInteract
|
||||
+ if (super.a(entityhuman, enumhand)) {
|
||||
+ if (processInteract(entityhuman, enumhand)) {
|
||||
+ return true; // vanilla action handled
|
||||
+ }
|
||||
+ return tryRide(entityhuman, enumhand);
|
||||
@@ -418,6 +419,73 @@ index 9a22e202..8e8d4cbc 100644
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityFish.java b/src/main/java/net/minecraft/server/EntityFish.java
|
||||
index 5da2d72a..58277bfe 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityFish.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityFish.java
|
||||
@@ -7,6 +7,10 @@ public abstract class EntityFish extends EntityWaterAnimal implements IAnimal {
|
||||
public EntityFish(EntityTypes<?> 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
|
||||
}
|
||||
|
||||
public float getHeadHeight() {
|
||||
@@ -73,7 +77,7 @@ public abstract class EntityFish extends EntityWaterAnimal implements IAnimal {
|
||||
|
||||
public void a(float f, float f1, float f2) {
|
||||
if (this.cP() && this.isInWater()) {
|
||||
- this.a(f, f1, f2, 0.01F);
|
||||
+ this.a(f, f1, f2, this.getSpeed()); // Purpur
|
||||
this.move(EnumMoveType.SELF, this.motX, this.motY, this.motZ);
|
||||
this.motX *= 0.8999999761581421D;
|
||||
this.motY *= 0.8999999761581421D;
|
||||
@@ -101,6 +105,15 @@ public abstract class EntityFish extends EntityWaterAnimal implements IAnimal {
|
||||
}
|
||||
|
||||
protected boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
||||
+ // Purpur start - processInteract
|
||||
+ if (processInteract(entityhuman, enumhand)) {
|
||||
+ return true; // vanilla action handled
|
||||
+ }
|
||||
+ return 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()) {
|
||||
@@ -145,7 +158,7 @@ public abstract class EntityFish extends EntityWaterAnimal implements IAnimal {
|
||||
return SoundEffects.ENTITY_FISH_SWIM;
|
||||
}
|
||||
|
||||
- static class a extends ControllerMove {
|
||||
+ static class a extends net.pl3x.purpur.controller.ControllerMoveWASDWater { // Purpur
|
||||
|
||||
private final EntityFish i;
|
||||
|
||||
@@ -154,7 +167,16 @@ public abstract class EntityFish extends EntityWaterAnimal implements IAnimal {
|
||||
this.i = entityfish;
|
||||
}
|
||||
|
||||
- public void a() {
|
||||
+ // Purpur start
|
||||
+ @Override
|
||||
+ public void tick(EntityHuman rider) {
|
||||
+ super.tick(rider);
|
||||
+ this.i.motY += 0.005D;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void tick() {
|
||||
+ // Purpur end
|
||||
if (this.i.a(TagsFluid.WATER)) {
|
||||
this.i.motY += 0.005D;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityHorse.java b/src/main/java/net/minecraft/server/EntityHorse.java
|
||||
index 1b9425f3..ff7f1a61 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityHorse.java
|
||||
|
||||
Reference in New Issue
Block a user