mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Add dolphin spit
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
From c485c84bef3d7371965e13ba58101a79149016c3 Mon Sep 17 00:00:00 2001
|
||||
From b3e0e8e52c442500c89de8a0e66adf5e1fc2e5bb Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Thu, 6 Feb 2020 19:53:59 -0600
|
||||
Subject: [PATCH] Ridables
|
||||
|
||||
---
|
||||
.../net/minecraft/server/AxisAlignedBB.java | 2 +
|
||||
.../server/ControllerLookDolphin.java | 4 +-
|
||||
.../net/minecraft/server/ControllerMove.java | 6 +-
|
||||
.../java/net/minecraft/server/Entity.java | 63 +-
|
||||
.../net/minecraft/server/DamageSource.java | 3 +
|
||||
.../java/net/minecraft/server/Entity.java | 69 +-
|
||||
.../net/minecraft/server/EntityAgeable.java | 2 +-
|
||||
.../java/net/minecraft/server/EntityBat.java | 54 ++
|
||||
.../java/net/minecraft/server/EntityBee.java | 118 +++-
|
||||
@@ -18,7 +20,7 @@ Subject: [PATCH] Ridables
|
||||
.../minecraft/server/EntityComplexPart.java | 7 +
|
||||
.../java/net/minecraft/server/EntityCow.java | 18 +
|
||||
.../net/minecraft/server/EntityCreeper.java | 76 +++
|
||||
.../net/minecraft/server/EntityDolphin.java | 40 +-
|
||||
.../net/minecraft/server/EntityDolphin.java | 78 ++-
|
||||
.../net/minecraft/server/EntityDrowned.java | 24 +-
|
||||
.../minecraft/server/EntityEnderDragon.java | 87 ++-
|
||||
.../net/minecraft/server/EntityEnderman.java | 33 +-
|
||||
@@ -40,7 +42,7 @@ Subject: [PATCH] Ridables
|
||||
.../server/EntityIllagerIllusioner.java | 19 +
|
||||
.../minecraft/server/EntityInsentient.java | 48 +-
|
||||
.../net/minecraft/server/EntityIronGolem.java | 23 +-
|
||||
.../net/minecraft/server/EntityLiving.java | 19 +-
|
||||
.../net/minecraft/server/EntityLiving.java | 21 +-
|
||||
.../net/minecraft/server/EntityLlama.java | 54 +-
|
||||
.../minecraft/server/EntityLlamaTrader.java | 13 +
|
||||
.../net/minecraft/server/EntityMagmaCube.java | 17 +
|
||||
@@ -84,26 +86,50 @@ Subject: [PATCH] Ridables
|
||||
.../server/EntityZombieVillager.java | 17 +
|
||||
.../java/net/minecraft/server/FoodInfo.java | 1 +
|
||||
.../java/net/minecraft/server/ItemDye.java | 1 +
|
||||
.../java/net/minecraft/server/MathHelper.java | 2 +
|
||||
.../net/minecraft/server/PathfinderGoal.java | 1 +
|
||||
.../minecraft/server/PathfinderGoalSwell.java | 5 +-
|
||||
src/main/java/net/minecraft/server/Vec3D.java | 1 +
|
||||
src/main/java/net/minecraft/server/World.java | 6 +
|
||||
.../net/pl3x/purpur/PurpurWorldConfig.java | 585 ++++++++++++++++++
|
||||
.../minecraft/server/ProjectileHelper.java | 1 +
|
||||
src/main/java/net/minecraft/server/Vec3D.java | 3 +
|
||||
src/main/java/net/minecraft/server/World.java | 7 +
|
||||
.../net/pl3x/purpur/PurpurWorldConfig.java | 591 ++++++++++++++++++
|
||||
.../purpur/controller/ControllerLookWASD.java | 75 +++
|
||||
.../purpur/controller/ControllerMoveWASD.java | 86 +++
|
||||
.../controller/ControllerMoveWASDFlying.java | 53 ++
|
||||
.../ControllerMoveWASDFlyingWithSpacebar.java | 61 ++
|
||||
.../controller/ControllerMoveWASDWater.java | 43 ++
|
||||
.../net/pl3x/purpur/entity/DolphinSpit.java | 119 ++++
|
||||
.../pathfinder/PathfinderGoalHasRider.java | 21 +
|
||||
.../craftbukkit/entity/CraftEntity.java | 27 +
|
||||
92 files changed, 3222 insertions(+), 201 deletions(-)
|
||||
97 files changed, 3402 insertions(+), 203 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/ControllerMoveWASDFlyingWithSpacebar.java
|
||||
create mode 100644 src/main/java/net/pl3x/purpur/controller/ControllerMoveWASDWater.java
|
||||
create mode 100644 src/main/java/net/pl3x/purpur/entity/DolphinSpit.java
|
||||
create mode 100644 src/main/java/net/pl3x/purpur/pathfinder/PathfinderGoalHasRider.java
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/AxisAlignedBB.java b/src/main/java/net/minecraft/server/AxisAlignedBB.java
|
||||
index 1a3234bb47..71ac371f40 100644
|
||||
--- a/src/main/java/net/minecraft/server/AxisAlignedBB.java
|
||||
+++ b/src/main/java/net/minecraft/server/AxisAlignedBB.java
|
||||
@@ -104,6 +104,7 @@ public class AxisAlignedBB {
|
||||
return new AxisAlignedBB(d3, d4, d5, d6, d7, d8);
|
||||
}
|
||||
|
||||
+ public AxisAlignedBB expandTowards(Vec3D vec3d) { return a(vec3d); } // Purpur - OBFHELPER
|
||||
public AxisAlignedBB a(Vec3D vec3d) {
|
||||
return this.b(vec3d.x, vec3d.y, vec3d.z);
|
||||
}
|
||||
@@ -155,6 +156,7 @@ public class AxisAlignedBB {
|
||||
return new AxisAlignedBB(d3, d4, d5, d6, d7, d8);
|
||||
}
|
||||
|
||||
+ public AxisAlignedBB expand(double size) { return g(size); } // Purpur - OBFHELPER
|
||||
public AxisAlignedBB g(double d0) {
|
||||
return this.grow(d0, d0, d0);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/ControllerLookDolphin.java b/src/main/java/net/minecraft/server/ControllerLookDolphin.java
|
||||
index 1d9ba04daa..2bade947ee 100644
|
||||
--- a/src/main/java/net/minecraft/server/ControllerLookDolphin.java
|
||||
@@ -142,8 +168,33 @@ index a5c4cbb67f..efe6afde9b 100644
|
||||
protected ControllerMove.Operation h;
|
||||
|
||||
public ControllerMove(EntityInsentient entityinsentient) {
|
||||
diff --git a/src/main/java/net/minecraft/server/DamageSource.java b/src/main/java/net/minecraft/server/DamageSource.java
|
||||
index 816d301f1c..f7344d3aec 100644
|
||||
--- a/src/main/java/net/minecraft/server/DamageSource.java
|
||||
+++ b/src/main/java/net/minecraft/server/DamageSource.java
|
||||
@@ -57,6 +57,7 @@ public class DamageSource {
|
||||
return new EntityDamageSource("mob", entityliving);
|
||||
}
|
||||
|
||||
+ public static DamageSource indirectMobAttack(Entity entity, EntityLiving entityliving) { return a(entity, entityliving); } // Purpur - OBFHELPER
|
||||
public static DamageSource a(Entity entity, EntityLiving entityliving) {
|
||||
return new EntityDamageSourceIndirect("mob", entity, entityliving);
|
||||
}
|
||||
@@ -101,10 +102,12 @@ public class DamageSource {
|
||||
return new DamageSourceNetherBed();
|
||||
}
|
||||
|
||||
+ public boolean isProjectile() { return b(); } // Purpur - OBFHELPER
|
||||
public boolean b() {
|
||||
return this.C;
|
||||
}
|
||||
|
||||
+ public DamageSource setProjectile() { return c(); } // Purpur - OBFHELPER
|
||||
public DamageSource c() {
|
||||
this.C = true;
|
||||
return this;
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 181f1742ac..8343be49d1 100644
|
||||
index 181f1742ac..30fff1a466 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -78,7 +78,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
@@ -182,7 +233,34 @@ index 181f1742ac..8343be49d1 100644
|
||||
private float headHeight;
|
||||
// CraftBukkit start
|
||||
public boolean persist = true;
|
||||
@@ -1384,6 +1384,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
@@ -913,6 +913,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
return vec3d1;
|
||||
}
|
||||
|
||||
+ public static double getHorizontalDistanceSqr(Vec3D vec3d) { return b(vec3d); } // Purpur - OBFHELPER
|
||||
public static double b(Vec3D vec3d) {
|
||||
return vec3d.x * vec3d.x + vec3d.z * vec3d.z;
|
||||
}
|
||||
@@ -1239,6 +1240,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
return flag;
|
||||
}
|
||||
|
||||
+ public boolean isInBubbleColumn() { return l(); } // Purpur - OBFHELPER
|
||||
private boolean l() {
|
||||
return this.world.getType(new BlockPosition(this)).getBlock() == Blocks.BUBBLE_COLUMN;
|
||||
}
|
||||
@@ -1252,8 +1254,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
return this.isInWater() || this.isInRain() || this.l();
|
||||
}
|
||||
|
||||
+ public boolean isInWaterOrBubbleColumn() { return az(); } // Purpur - OBFHELPER
|
||||
public boolean az() {
|
||||
- return this.isInWater() || this.l();
|
||||
+ return this.isInWater() || this.isInBubbleColumn(); // Purpur
|
||||
}
|
||||
|
||||
public boolean aA() {
|
||||
@@ -1384,6 +1387,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
return this.inLava;
|
||||
}
|
||||
|
||||
@@ -190,7 +268,7 @@ index 181f1742ac..8343be49d1 100644
|
||||
public void a(float f, Vec3D vec3d) {
|
||||
Vec3D vec3d1 = a(vec3d, f, this.yaw);
|
||||
|
||||
@@ -2212,7 +2213,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
@@ -2212,7 +2216,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
} else {
|
||||
this.passengers.add(entity);
|
||||
}
|
||||
@@ -205,7 +283,7 @@ index 181f1742ac..8343be49d1 100644
|
||||
}
|
||||
return true; // CraftBukkit
|
||||
}
|
||||
@@ -2247,6 +2254,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
@@ -2247,6 +2257,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
return false;
|
||||
}
|
||||
// Spigot end
|
||||
@@ -218,7 +296,15 @@ index 181f1742ac..8343be49d1 100644
|
||||
this.passengers.remove(entity);
|
||||
entity.j = 60;
|
||||
}
|
||||
@@ -2633,6 +2646,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
@@ -2415,6 +2431,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
this.setFlag(4, flag);
|
||||
}
|
||||
|
||||
+ public boolean isGlowing() { return bt(); } // Purpur - OBFHELPER
|
||||
public boolean bt() {
|
||||
return this.glowing || this.world.isClientSide && this.getFlag(6);
|
||||
}
|
||||
@@ -2633,6 +2650,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
|
||||
public void setHeadRotation(float f) {}
|
||||
|
||||
@@ -226,7 +312,7 @@ index 181f1742ac..8343be49d1 100644
|
||||
public void l(float f) {}
|
||||
|
||||
public boolean bA() {
|
||||
@@ -3478,4 +3492,43 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
@@ -3478,4 +3496,43 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
|
||||
void accept(Entity entity, double d0, double d1, double d2);
|
||||
}
|
||||
@@ -992,10 +1078,31 @@ index 45dfc8104a..48fd8e716b 100644
|
||||
+ // Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityDolphin.java b/src/main/java/net/minecraft/server/EntityDolphin.java
|
||||
index ce78586ea0..e5c914eb14 100644
|
||||
index ce78586ea0..81570b37bb 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityDolphin.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityDolphin.java
|
||||
@@ -23,6 +23,23 @@ public class EntityDolphin extends EntityWaterAnimal {
|
||||
@@ -1,5 +1,12 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
+// Purpur start
|
||||
+import net.pl3x.purpur.entity.DolphinSpit;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
+import org.bukkit.util.Vector;
|
||||
+// Purpur end
|
||||
+
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
@@ -15,6 +22,7 @@ public class EntityDolphin extends EntityWaterAnimal {
|
||||
public static final Predicate<EntityItem> b = (entityitem) -> {
|
||||
return !entityitem.p() && entityitem.isAlive() && entityitem.isInWater();
|
||||
};
|
||||
+ private int spitCooldown; // Purpur
|
||||
|
||||
public EntityDolphin(EntityTypes<? extends EntityDolphin> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -23,6 +31,50 @@ public class EntityDolphin extends EntityWaterAnimal {
|
||||
this.setCanPickupLoot(true);
|
||||
}
|
||||
|
||||
@@ -1014,12 +1121,39 @@ index ce78586ea0..e5c914eb14 100644
|
||||
+ public boolean requireShiftToMount() {
|
||||
+ return world.purpurConfig.dolphinRequireShiftToMount;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean onSpacebar() {
|
||||
+ if (spitCooldown == 0 && hasRider()) {
|
||||
+ spitCooldown = world.purpurConfig.dolphinSpitCooldown;
|
||||
+ if (!hasRider()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ CraftPlayer player = (CraftPlayer) getRider().getBukkitEntity();
|
||||
+ if (!player.hasPermission("allow.special.dolphin")) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ Location loc = player.getEyeLocation();
|
||||
+ loc.setPitch(loc.getPitch() - 10);
|
||||
+ Vector target = loc.getDirection().normalize().multiply(10).add(loc.toVector());
|
||||
+
|
||||
+ DolphinSpit spit = new DolphinSpit(world, this);
|
||||
+ spit.shoot(target.getX() - locX(), target.getY() - locY(), target.getZ() - locZ(), world.purpurConfig.dolphinSpitSpeed, 5.0F);
|
||||
+
|
||||
+ world.addEntity(spit);
|
||||
+ playSound(SoundEffects.ENTITY_DOLPHIN_ATTACK, 1.0F, 1.0F + (random.nextFloat() - random.nextFloat()) * 0.2F);
|
||||
+ return true;
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
@Nullable
|
||||
@Override
|
||||
public GroupDataEntity prepare(GeneratorAccess generatoraccess, DifficultyDamageScaler difficultydamagescaler, EnumMobSpawn enummobspawn, @Nullable GroupDataEntity groupdataentity, @Nullable NBTTagCompound nbttagcompound) {
|
||||
@@ -97,6 +114,7 @@ public class EntityDolphin extends EntityWaterAnimal {
|
||||
@@ -97,6 +149,7 @@ public class EntityDolphin extends EntityWaterAnimal {
|
||||
protected void initPathfinder() {
|
||||
this.goalSelector.a(0, new PathfinderGoalBreath(this));
|
||||
this.goalSelector.a(0, new PathfinderGoalWater(this));
|
||||
@@ -1027,7 +1161,7 @@ index ce78586ea0..e5c914eb14 100644
|
||||
this.goalSelector.a(1, new EntityDolphin.b(this));
|
||||
this.goalSelector.a(2, new EntityDolphin.c(this, 4.0D));
|
||||
this.goalSelector.a(4, new PathfinderGoalRandomSwim(this, 1.0D, 10));
|
||||
@@ -107,6 +125,7 @@ public class EntityDolphin extends EntityWaterAnimal {
|
||||
@@ -107,6 +160,7 @@ public class EntityDolphin extends EntityWaterAnimal {
|
||||
this.goalSelector.a(8, new EntityDolphin.d());
|
||||
this.goalSelector.a(8, new PathfinderGoalFollowBoat(this));
|
||||
this.goalSelector.a(9, new PathfinderGoalAvoidTarget<>(this, EntityGuardian.class, 8.0F, 1.0D, 1.0D));
|
||||
@@ -1035,7 +1169,7 @@ index ce78586ea0..e5c914eb14 100644
|
||||
this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityGuardian.class})).a(new Class[0])); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
@@ -163,7 +182,7 @@ public class EntityDolphin extends EntityWaterAnimal {
|
||||
@@ -163,7 +217,7 @@ public class EntityDolphin extends EntityWaterAnimal {
|
||||
|
||||
@Override
|
||||
protected boolean n(Entity entity) {
|
||||
@@ -1044,7 +1178,17 @@ index ce78586ea0..e5c914eb14 100644
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -459,7 +478,7 @@ public class EntityDolphin extends EntityWaterAnimal {
|
||||
@@ -196,6 +250,9 @@ public class EntityDolphin extends EntityWaterAnimal {
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
+ if (spitCooldown > 0) {
|
||||
+ spitCooldown--;
|
||||
+ }
|
||||
if (!this.isNoAI()) {
|
||||
if (this.ay()) {
|
||||
this.b(2400);
|
||||
@@ -459,7 +516,7 @@ public class EntityDolphin extends EntityWaterAnimal {
|
||||
|
||||
private int b;
|
||||
|
||||
@@ -1053,7 +1197,7 @@ index ce78586ea0..e5c914eb14 100644
|
||||
|
||||
@Override
|
||||
public boolean a() {
|
||||
@@ -527,7 +546,7 @@ public class EntityDolphin extends EntityWaterAnimal {
|
||||
@@ -527,7 +584,7 @@ public class EntityDolphin extends EntityWaterAnimal {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1062,7 +1206,7 @@ index ce78586ea0..e5c914eb14 100644
|
||||
|
||||
private final EntityDolphin i;
|
||||
|
||||
@@ -537,7 +556,20 @@ public class EntityDolphin extends EntityWaterAnimal {
|
||||
@@ -537,7 +594,20 @@ public class EntityDolphin extends EntityWaterAnimal {
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -2337,9 +2481,18 @@ index 7f6a567760..288a043fbd 100644
|
||||
float f1 = 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.2F;
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index ad474500e2..17ff8a9fc3 100644
|
||||
index ad474500e2..4049ab0273 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -75,7 +75,7 @@ public abstract class EntityLiving extends Entity {
|
||||
public int maxNoDamageTicks;
|
||||
public final float aG;
|
||||
public final float aH;
|
||||
- public float aI;
|
||||
+ public float aI; public float getBodyRotation() { return aI; } // Purpur - OBFHELPER
|
||||
public float aJ;
|
||||
public float aK;
|
||||
public float aL;
|
||||
@@ -92,9 +92,9 @@ public abstract class EntityLiving extends Entity {
|
||||
protected int aW; protected int getKillCount() { return this.aW; } // Paper - OBFHELPER
|
||||
public float lastDamage;
|
||||
@@ -4874,6 +5027,26 @@ index da49f6e5ae..7b5d602649 100644
|
||||
public EnumColor d() {
|
||||
return this.b;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/MathHelper.java b/src/main/java/net/minecraft/server/MathHelper.java
|
||||
index c4aa38ddf1..3d52a396e6 100644
|
||||
--- a/src/main/java/net/minecraft/server/MathHelper.java
|
||||
+++ b/src/main/java/net/minecraft/server/MathHelper.java
|
||||
@@ -263,6 +263,7 @@ public class MathHelper {
|
||||
return (d0 - d1) / (d2 - d1);
|
||||
}
|
||||
|
||||
+ public static double atan2(double d0, double d1) { return d(d0, d1); } // Purpur - OBFHELPER
|
||||
public static double d(double d0, double d1) {
|
||||
double d2 = d1 * d1 + d0 * d0;
|
||||
|
||||
@@ -407,6 +408,7 @@ public class MathHelper {
|
||||
return i;
|
||||
}
|
||||
|
||||
+ public static float lerp(float f, float f1, float f2) { return g(f, f1, f2); } // Purpur - OBFHELPER
|
||||
public static float g(float f, float f1, float f2) {
|
||||
return f1 + f * (f2 - f1);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/PathfinderGoal.java b/src/main/java/net/minecraft/server/PathfinderGoal.java
|
||||
index 738c510706..2fddbb3ef1 100644
|
||||
--- a/src/main/java/net/minecraft/server/PathfinderGoal.java
|
||||
@@ -4909,11 +5082,39 @@ index e07c7674a5..3c077b6870 100644
|
||||
if (this.b == null) {
|
||||
this.a.a(-1);
|
||||
} else if (this.a.h((Entity) this.b) > 49.0D) {
|
||||
diff --git a/src/main/java/net/minecraft/server/ProjectileHelper.java b/src/main/java/net/minecraft/server/ProjectileHelper.java
|
||||
index 1b796ba5b3..7dbe3500e9 100644
|
||||
--- a/src/main/java/net/minecraft/server/ProjectileHelper.java
|
||||
+++ b/src/main/java/net/minecraft/server/ProjectileHelper.java
|
||||
@@ -15,6 +15,7 @@ public final class ProjectileHelper {
|
||||
}, entity.getBoundingBox().a(entity.getMot()).g(1.0D));
|
||||
}
|
||||
|
||||
+ public static MovingObjectPosition getHitResult(Entity entity, AxisAlignedBB aabb, Predicate<Entity> predicate, RayTrace.BlockCollisionOption option, boolean flag) { return a(entity, aabb, predicate, option, flag); } // Purpur - OBFHELPER
|
||||
public static MovingObjectPosition a(Entity entity, AxisAlignedBB axisalignedbb, Predicate<Entity> predicate, RayTrace.BlockCollisionOption raytrace_blockcollisionoption, boolean flag) {
|
||||
return a(entity, flag, false, (Entity) null, raytrace_blockcollisionoption, false, predicate, axisalignedbb);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Vec3D.java b/src/main/java/net/minecraft/server/Vec3D.java
|
||||
index 0c7f094e54..212af252be 100644
|
||||
index 0c7f094e54..62a0810062 100644
|
||||
--- a/src/main/java/net/minecraft/server/Vec3D.java
|
||||
+++ b/src/main/java/net/minecraft/server/Vec3D.java
|
||||
@@ -89,6 +89,7 @@ public class Vec3D implements IPosition {
|
||||
@@ -27,6 +27,7 @@ public class Vec3D implements IPosition {
|
||||
return new Vec3D(vec3d.x - this.x, vec3d.y - this.y, vec3d.z - this.z);
|
||||
}
|
||||
|
||||
+ public Vec3D normalize() { return d(); } // Purpur - OBFHELPER
|
||||
public Vec3D d() {
|
||||
double d0 = (double) MathHelper.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
|
||||
|
||||
@@ -81,6 +82,7 @@ public class Vec3D implements IPosition {
|
||||
return d3 * d3 + d4 * d4 + d5 * d5;
|
||||
}
|
||||
|
||||
+ public Vec3D scale(double scale) { return a(scale); } // Purpur - OBFHELPER
|
||||
public Vec3D a(double d0) {
|
||||
return this.d(d0, d0, d0);
|
||||
}
|
||||
@@ -89,6 +91,7 @@ public class Vec3D implements IPosition {
|
||||
return this.d(vec3d.x, vec3d.y, vec3d.z);
|
||||
}
|
||||
|
||||
@@ -4922,10 +5123,18 @@ index 0c7f094e54..212af252be 100644
|
||||
return new Vec3D(this.x * d0, this.y * d1, this.z * d2);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 5afd548aa0..afd5940e77 100644
|
||||
index 5afd548aa0..0cf3a64fcf 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -1601,4 +1601,10 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
@@ -987,6 +987,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
}
|
||||
}
|
||||
|
||||
+ public boolean containsMaterial(AxisAlignedBB aabb, Material mat) { return a(aabb, mat); } // Purpur - OBFHELPER
|
||||
public boolean a(AxisAlignedBB axisalignedbb, Material material) {
|
||||
int i = MathHelper.floor(axisalignedbb.minX);
|
||||
int j = MathHelper.f(axisalignedbb.maxX);
|
||||
@@ -1601,4 +1602,10 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
@Override public BiomeManager d() {
|
||||
return this.biomeManager;
|
||||
}
|
||||
@@ -4937,10 +5146,10 @@ index 5afd548aa0..afd5940e77 100644
|
||||
+ // Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index eda37fa43f..ad96353afd 100644
|
||||
index eda37fa43f..fafbea673e 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -64,4 +64,589 @@ public class PurpurWorldConfig {
|
||||
@@ -64,4 +64,595 @@ public class PurpurWorldConfig {
|
||||
PurpurConfig.config.addDefault("world-settings.default." + path, def);
|
||||
return PurpurConfig.config.getString("world-settings." + worldName + "." + path, PurpurConfig.config.getString("world-settings.default." + path));
|
||||
}
|
||||
@@ -5037,10 +5246,16 @@ index eda37fa43f..ad96353afd 100644
|
||||
+ public boolean dolphinRidable = false;
|
||||
+ public boolean dolphinRidableInWater = false;
|
||||
+ public boolean dolphinRequireShiftToMount = true;
|
||||
+ public int dolphinSpitCooldown = 20;
|
||||
+ public float dolphinSpitSpeed = 1.0F;
|
||||
+ public float dolphinSpitDamage = 2.0F;
|
||||
+ private void dolphinSettings() {
|
||||
+ dolphinRidable = getBoolean("mobs.dolphin.ridable", dolphinRidable);
|
||||
+ dolphinRidableInWater = getBoolean("mobs.dolphin.ridable-in-water", dolphinRidableInWater);
|
||||
+ dolphinRequireShiftToMount = getBoolean("mobs.dolphin.require-shift-to-mount", dolphinRequireShiftToMount);
|
||||
+ dolphinSpitCooldown = getInt("mobs.dolphin.spit.cooldown", dolphinSpitCooldown);
|
||||
+ dolphinSpitSpeed = (float) getDouble("mobs.dolphin.spit.speed", dolphinSpitSpeed);
|
||||
+ dolphinSpitDamage = (float) getDouble("mobs.dolphin.spit.damage", dolphinSpitDamage);
|
||||
+ }
|
||||
+
|
||||
+ public boolean donkeyRidableInWater = false;
|
||||
@@ -5878,6 +6093,131 @@ index 0000000000..e75e580670
|
||||
+ setStrafe(entity.getStrafe());
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/pl3x/purpur/entity/DolphinSpit.java b/src/main/java/net/pl3x/purpur/entity/DolphinSpit.java
|
||||
new file mode 100644
|
||||
index 0000000000..7189cc569f
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/pl3x/purpur/entity/DolphinSpit.java
|
||||
@@ -0,0 +1,119 @@
|
||||
+package net.pl3x.purpur.entity;
|
||||
+
|
||||
+import net.minecraft.server.DamageSource;
|
||||
+import net.minecraft.server.Entity;
|
||||
+import net.minecraft.server.EntityDolphin;
|
||||
+import net.minecraft.server.EntityLiving;
|
||||
+import net.minecraft.server.EntityLlamaSpit;
|
||||
+import net.minecraft.server.EntityTypes;
|
||||
+import net.minecraft.server.IProjectile;
|
||||
+import net.minecraft.server.Material;
|
||||
+import net.minecraft.server.MathHelper;
|
||||
+import net.minecraft.server.MovingObjectPosition;
|
||||
+import net.minecraft.server.MovingObjectPositionEntity;
|
||||
+import net.minecraft.server.NBTTagCompound;
|
||||
+import net.minecraft.server.Packet;
|
||||
+import net.minecraft.server.PacketPlayOutSpawnEntity;
|
||||
+import net.minecraft.server.Particles;
|
||||
+import net.minecraft.server.ProjectileHelper;
|
||||
+import net.minecraft.server.RayTrace;
|
||||
+import net.minecraft.server.Vec3D;
|
||||
+import net.minecraft.server.World;
|
||||
+import net.minecraft.server.WorldServer;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+
|
||||
+public class DolphinSpit extends EntityLlamaSpit implements IProjectile {
|
||||
+ public EntityLiving dolphin;
|
||||
+ public int ticksLived;
|
||||
+
|
||||
+ public DolphinSpit(EntityTypes<? extends EntityLlamaSpit> entitytypes, World world) {
|
||||
+ super(entitytypes, world);
|
||||
+ }
|
||||
+
|
||||
+ public DolphinSpit(World world, EntityDolphin dolphin) {
|
||||
+ this(EntityTypes.LLAMA_SPIT, world);
|
||||
+ this.dolphin = dolphin;
|
||||
+
|
||||
+ setPosition(dolphin.locX() - (double) (dolphin.getWidth() + 1.0F) * 0.5D * (double) MathHelper.sin(dolphin.getBodyRotation() * ((float) Math.PI / 180F)), dolphin.getHeadY() - (double) 0.1F, dolphin.locZ() + (double) (dolphin.getWidth() + 1.0F) * 0.5D * (double) MathHelper.cos(dolphin.getBodyRotation() * ((float) Math.PI / 180F)));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean canSaveToDisk() {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void tick() {
|
||||
+ setFlag(6, isGlowing());
|
||||
+ entityBaseTick();
|
||||
+
|
||||
+ Vec3D mot = getMot();
|
||||
+
|
||||
+ MovingObjectPosition hitResult = ProjectileHelper.getHitResult(this, getBoundingBox().expandTowards(mot).expand(1.0D), (entity) -> !entity.isSpectator() && entity != dolphin && entity != dolphin.getRider(), RayTrace.BlockCollisionOption.OUTLINE, true);
|
||||
+ if (hitResult != null) {
|
||||
+ onHit(hitResult);
|
||||
+ }
|
||||
+
|
||||
+ mot = mot.scale(0.99F);
|
||||
+ setMot(mot);
|
||||
+ setPosition(locX() + mot.x, locY() + mot.y, locZ() + mot.z);
|
||||
+
|
||||
+ for (int i = 0; i < 5; i++) {
|
||||
+ ((WorldServer) world).sendParticles(null, Particles.BUBBLE,
|
||||
+ locX() + random.nextFloat() / 2 - 0.25F,
|
||||
+ locY() + random.nextFloat() / 2 - 0.25F,
|
||||
+ locZ() + random.nextFloat() / 2 - 0.25F,
|
||||
+ 1, 0, 0, 0, 0, true);
|
||||
+ }
|
||||
+
|
||||
+ if (++ticksLived > 20) {
|
||||
+ die();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void shoot(double x, double y, double z, float speed, float inaccuracy) {
|
||||
+ setMot(new Vec3D(x, y, z).normalize().add(
|
||||
+ random.nextGaussian() * (double) 0.0075F * (double) inaccuracy,
|
||||
+ random.nextGaussian() * (double) 0.0075F * (double) inaccuracy,
|
||||
+ random.nextGaussian() * (double) 0.0075F * (double) inaccuracy)
|
||||
+ .scale(speed));
|
||||
+ }
|
||||
+
|
||||
+ public void onHit(MovingObjectPosition rayTrace) {
|
||||
+ CraftEventFactory.callProjectileHitEvent(this, rayTrace);
|
||||
+
|
||||
+ switch (rayTrace.getType()) {
|
||||
+ case BLOCK:
|
||||
+ die();
|
||||
+ break;
|
||||
+ case ENTITY:
|
||||
+ if (dolphin != null) {
|
||||
+ Entity entity = ((MovingObjectPositionEntity) rayTrace).getEntity();
|
||||
+ entity.damageEntity(DamageSource.indirectMobAttack(this, dolphin).setProjectile(), world.purpurConfig.dolphinSpitDamage);
|
||||
+ }
|
||||
+ die();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void a(MovingObjectPosition movingobjectposition) {
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ protected void initDatawatcher() {
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ protected void a(NBTTagCompound nbttagcompound) {
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ protected void b(NBTTagCompound nbttagcompound) {
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Packet<?> L() {
|
||||
+ return new PacketPlayOutSpawnEntity(this);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/pl3x/purpur/pathfinder/PathfinderGoalHasRider.java b/src/main/java/net/pl3x/purpur/pathfinder/PathfinderGoalHasRider.java
|
||||
new file mode 100644
|
||||
index 0000000000..6e50344c07
|
||||
|
||||
Reference in New Issue
Block a user