mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Flying squids! Oh my!
This commit is contained in:
committed by
granny
parent
45acfd3f2a
commit
6f8ae53ef5
@@ -1,93 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Sun, 4 Oct 2020 12:00:42 -0500
|
||||
Subject: [PATCH] Flying squids! Oh my!
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/GlowSquid.java b/net/minecraft/world/entity/GlowSquid.java
|
||||
index 66a5c485ed2d29d0079ae714c2dd7b01aab11d86..d556642fd07492aa52bfc0a2432ab3d16fe4f866 100644
|
||||
--- a/net/minecraft/world/entity/GlowSquid.java
|
||||
+++ b/net/minecraft/world/entity/GlowSquid.java
|
||||
@@ -44,6 +44,11 @@ public class GlowSquid extends Squid {
|
||||
this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.glowSquidMaxHealth);
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
+ @Override
|
||||
+ public boolean canFly() {
|
||||
+ return this.level().purpurConfig.glowSquidsCanFly;
|
||||
+ }
|
||||
+
|
||||
@Override
|
||||
protected ParticleOptions getInkParticle() {
|
||||
return ParticleTypes.GLOW_SQUID_INK;
|
||||
diff --git a/net/minecraft/world/entity/animal/Squid.java b/net/minecraft/world/entity/animal/Squid.java
|
||||
index 490fa58d09d58cefb1adef1ba11823ba14fa2855..d976fca9b9764f9298bc9aa2e28b6f0feed1939f 100644
|
||||
--- a/net/minecraft/world/entity/animal/Squid.java
|
||||
+++ b/net/minecraft/world/entity/animal/Squid.java
|
||||
@@ -85,6 +85,15 @@ public class Squid extends AgeableWaterCreature {
|
||||
return super.getAxisForFluidCheck().offsetY(level().purpurConfig.squidOffsetWaterCheck);
|
||||
}
|
||||
|
||||
+ public boolean canFly() {
|
||||
+ return this.level().purpurConfig.squidsCanFly;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isInWater() {
|
||||
+ return this.wasTouchingWater || canFly();
|
||||
+ }
|
||||
+
|
||||
@Override
|
||||
protected void registerGoals() {
|
||||
this.goalSelector.addGoal(0, new Squid.SquidRandomMovementGoal(this));
|
||||
@@ -163,6 +172,7 @@ public class Squid extends AgeableWaterCreature {
|
||||
}
|
||||
|
||||
if (this.isInWaterOrBubble()) {
|
||||
+ if (canFly()) setNoGravity(!wasTouchingWater); // Purpur
|
||||
if (this.tentacleMovement < (float) Math.PI) {
|
||||
float f = this.tentacleMovement / (float) Math.PI;
|
||||
this.tentacleAngle = Mth.sin(f * f * (float) Math.PI) * (float) Math.PI * 0.25F;
|
||||
@@ -375,7 +385,7 @@ public class Squid extends AgeableWaterCreature {
|
||||
int i = this.squid.getNoActionTime();
|
||||
if (i > 100) {
|
||||
this.squid.movementVector = Vec3.ZERO;
|
||||
- } else if (this.squid.getRandom().nextInt(reducedTickDelay(50)) == 0 || !this.squid.wasTouchingWater || !this.squid.hasMovementVector()) {
|
||||
+ } else if (this.squid.getRandom().nextInt(reducedTickDelay(50)) == 0 || !this.squid.isInWater() || !this.squid.hasMovementVector()) { // Purpur
|
||||
float f = this.squid.getRandom().nextFloat() * (float) (Math.PI * 2);
|
||||
this.squid.movementVector = new Vec3(
|
||||
(double)(Mth.cos(f) * 0.2F), (double)(-0.1F + this.squid.getRandom().nextFloat() * 0.2F), (double)(Mth.sin(f) * 0.2F)
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index f6771afafe3e9e672059f504982e90449492449c..fea279b9fbd7f989bf26f0fc1254b1ecb8ac4342 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -946,11 +946,13 @@ public class PurpurWorldConfig {
|
||||
public boolean glowSquidControllable = true;
|
||||
public double glowSquidMaxHealth = 10.0D;
|
||||
public double glowSquidScale = 1.0D;
|
||||
+ public boolean glowSquidsCanFly = false;
|
||||
private void glowSquidSettings() {
|
||||
glowSquidRidable = getBoolean("mobs.glow_squid.ridable", glowSquidRidable);
|
||||
glowSquidControllable = getBoolean("mobs.glow_squid.controllable", glowSquidControllable);
|
||||
glowSquidMaxHealth = getDouble("mobs.glow_squid.attributes.max_health", glowSquidMaxHealth);
|
||||
glowSquidScale = Mth.clamp(getDouble("mobs.glow_squid.attributes.scale", glowSquidScale), 0.0625D, 16.0D);
|
||||
+ glowSquidsCanFly = getBoolean("mobs.glow_squid.can-fly", glowSquidsCanFly);
|
||||
}
|
||||
|
||||
public boolean goatRidable = false;
|
||||
@@ -1637,6 +1639,7 @@ public class PurpurWorldConfig {
|
||||
public double squidScale = 1.0D;
|
||||
public boolean squidImmuneToEAR = true;
|
||||
public double squidOffsetWaterCheck = 0.0D;
|
||||
+ public boolean squidsCanFly = false;
|
||||
private void squidSettings() {
|
||||
squidRidable = getBoolean("mobs.squid.ridable", squidRidable);
|
||||
squidControllable = getBoolean("mobs.squid.controllable", squidControllable);
|
||||
@@ -1649,6 +1652,7 @@ public class PurpurWorldConfig {
|
||||
squidScale = Mth.clamp(getDouble("mobs.squid.attributes.scale", squidScale), 0.0625D, 16.0D);
|
||||
squidImmuneToEAR = getBoolean("mobs.squid.immune-to-EAR", squidImmuneToEAR);
|
||||
squidOffsetWaterCheck = getDouble("mobs.squid.water-offset-check", squidOffsetWaterCheck);
|
||||
+ squidsCanFly = getBoolean("mobs.squid.can-fly", squidsCanFly);
|
||||
}
|
||||
|
||||
public boolean spiderRidable = false;
|
||||
@@ -153,12 +153,12 @@ index f7e17ca9f5011503827f7141d62e556c1cc72fcf..25adb04858ad55dc80a2967e49b3dc0d
|
||||
+ // Purpur end - Ridables
|
||||
}
|
||||
diff --git a/net/minecraft/world/entity/GlowSquid.java b/net/minecraft/world/entity/GlowSquid.java
|
||||
index efee812785240c1ab1fd47514cfb236a3548f9cf..666455fff2b391b637cf1c07091e88100c5e1308 100644
|
||||
index 95d78dcdb6777df73898694367ee17b1cb76d7a2..d0313fd5368baa53ec511c8c07fc78a1f1ecec4e 100644
|
||||
--- a/net/minecraft/world/entity/GlowSquid.java
|
||||
+++ b/net/minecraft/world/entity/GlowSquid.java
|
||||
@@ -25,6 +25,19 @@ public class GlowSquid extends Squid {
|
||||
super(entityType, level);
|
||||
@@ -32,6 +32,19 @@ public class GlowSquid extends Squid {
|
||||
}
|
||||
// Purpur end - Flying squids! Oh my!
|
||||
|
||||
+ // Purpur start - Ridables
|
||||
+ @Override
|
||||
@@ -1761,12 +1761,12 @@ index ac07260c01513fae5a8b9f1fe0f7f2bf113c6c3c..7bd5d82a11dda36389913925406a8a2c
|
||||
}
|
||||
|
||||
diff --git a/net/minecraft/world/entity/animal/Squid.java b/net/minecraft/world/entity/animal/Squid.java
|
||||
index 9800f8e3627b37cb655a41aada876bceed313291..33c5831272e92802299ed817f4d5d8abfdd412fb 100644
|
||||
index df58ed15ca22f297f2ce087dc80df7cf9811233d..dee371381817a992d249f62977ad7bd6eb8d5873 100644
|
||||
--- a/net/minecraft/world/entity/animal/Squid.java
|
||||
+++ b/net/minecraft/world/entity/animal/Squid.java
|
||||
@@ -58,9 +58,32 @@ public class Squid extends AgeableWaterCreature {
|
||||
@@ -69,9 +69,32 @@ public class Squid extends AgeableWaterCreature {
|
||||
}
|
||||
// Purpur end - Stop squids floating on top of water
|
||||
// Purpur end - Flying squids! Oh my!
|
||||
|
||||
+ // Purpur start - Ridables
|
||||
+ @Override
|
||||
@@ -1797,7 +1797,7 @@ index 9800f8e3627b37cb655a41aada876bceed313291..33c5831272e92802299ed817f4d5d8ab
|
||||
this.goalSelector.addGoal(1, new Squid.SquidFleeGoal());
|
||||
}
|
||||
|
||||
@@ -315,6 +338,37 @@ public class Squid extends AgeableWaterCreature {
|
||||
@@ -327,6 +350,37 @@ public class Squid extends AgeableWaterCreature {
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Configurable entity base attributes
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/GlowSquid.java b/net/minecraft/world/entity/GlowSquid.java
|
||||
index 666455fff2b391b637cf1c07091e88100c5e1308..a53d662e2c78b002320956b9c7e39ccb44826113 100644
|
||||
index d0313fd5368baa53ec511c8c07fc78a1f1ecec4e..898b1e01026ec1f44cfe60e9f18a997c86e30594 100644
|
||||
--- a/net/minecraft/world/entity/GlowSquid.java
|
||||
+++ b/net/minecraft/world/entity/GlowSquid.java
|
||||
@@ -38,6 +38,13 @@ public class GlowSquid extends Squid {
|
||||
@@ -45,6 +45,13 @@ public class GlowSquid extends Squid {
|
||||
}
|
||||
// Purpur end - Ridables
|
||||
|
||||
@@ -441,10 +441,10 @@ index 7bd5d82a11dda36389913925406a8a2c8e86abf6..d52082d991f6a2ce9d6909610785643d
|
||||
protected void registerGoals() {
|
||||
this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur - Ridables
|
||||
diff --git a/net/minecraft/world/entity/animal/Squid.java b/net/minecraft/world/entity/animal/Squid.java
|
||||
index 33c5831272e92802299ed817f4d5d8abfdd412fb..f45fa36679a93374d5d0c29ca0f75b74e949020d 100644
|
||||
index dee371381817a992d249f62977ad7bd6eb8d5873..739b9df3c1c39a3207caa42d6aed7f4ff1741d42 100644
|
||||
--- a/net/minecraft/world/entity/animal/Squid.java
|
||||
+++ b/net/minecraft/world/entity/animal/Squid.java
|
||||
@@ -80,6 +80,14 @@ public class Squid extends AgeableWaterCreature {
|
||||
@@ -91,6 +91,14 @@ public class Squid extends AgeableWaterCreature {
|
||||
}
|
||||
// Purpur end - Ridables
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
--- a/net/minecraft/world/entity/GlowSquid.java
|
||||
+++ b/net/minecraft/world/entity/GlowSquid.java
|
||||
@@ -25,6 +_,13 @@
|
||||
super(entityType, level);
|
||||
}
|
||||
|
||||
+ // Purpur start - Flying squids! Oh my!
|
||||
+ @Override
|
||||
+ public boolean canFly() {
|
||||
+ return this.level().purpurConfig.glowSquidsCanFly;
|
||||
+ }
|
||||
+ // Purpur end - Flying squids! Oh my!
|
||||
+
|
||||
@Override
|
||||
protected ParticleOptions getInkParticle() {
|
||||
return ParticleTypes.GLOW_SQUID_INK;
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/animal/Squid.java
|
||||
+++ b/net/minecraft/world/entity/animal/Squid.java
|
||||
@@ -50,6 +_,14 @@
|
||||
@@ -50,6 +_,25 @@
|
||||
this.tentacleSpeed = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,35 @@
|
||||
+ return super.getAxisForFluidCheck().offsetY(level().purpurConfig.squidOffsetWaterCheck);
|
||||
+ }
|
||||
+ // Purpur end - Stop squids floating on top of water
|
||||
+
|
||||
+ // Purpur start - Flying squids! Oh my!
|
||||
+ public boolean canFly() {
|
||||
+ return this.level().purpurConfig.squidsCanFly;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isInWater() {
|
||||
+ return this.wasTouchingWater || canFly();
|
||||
+ }
|
||||
+ // Purpur end - Flying squids! Oh my!
|
||||
+
|
||||
@Override
|
||||
protected void registerGoals() {
|
||||
this.goalSelector.addGoal(0, new Squid.SquidRandomMovementGoal(this));
|
||||
@@ -127,6 +_,7 @@
|
||||
}
|
||||
|
||||
if (this.isInWaterOrBubble()) {
|
||||
+ if (canFly()) setNoGravity(!wasTouchingWater); // Purpur - Flying squids! Oh my!
|
||||
if (this.tentacleMovement < (float) Math.PI) {
|
||||
float f = this.tentacleMovement / (float) Math.PI;
|
||||
this.tentacleAngle = Mth.sin(f * f * (float) Math.PI) * (float) Math.PI * 0.25F;
|
||||
@@ -310,7 +_,7 @@
|
||||
int noActionTime = this.squid.getNoActionTime();
|
||||
if (noActionTime > 100) {
|
||||
this.squid.movementVector = Vec3.ZERO;
|
||||
- } else if (this.squid.getRandom().nextInt(reducedTickDelay(50)) == 0 || !this.squid.wasTouchingWater || !this.squid.hasMovementVector()) {
|
||||
+ } else if (this.squid.getRandom().nextInt(reducedTickDelay(50)) == 0 || !this.squid.isInWater() || !this.squid.hasMovementVector()) { // Purpur - Flying squids! Oh my!
|
||||
float f = this.squid.getRandom().nextFloat() * (float) (Math.PI * 2);
|
||||
this.squid.movementVector = new Vec3(Mth.cos(f) * 0.2F, -0.1F + this.squid.getRandom().nextFloat() * 0.2F, Mth.sin(f) * 0.2F);
|
||||
}
|
||||
|
||||
@@ -937,11 +937,13 @@ public class PurpurWorldConfig {
|
||||
public boolean glowSquidControllable = true;
|
||||
public double glowSquidMaxHealth = 10.0D;
|
||||
public double glowSquidScale = 1.0D;
|
||||
public boolean glowSquidsCanFly = false;
|
||||
private void glowSquidSettings() {
|
||||
glowSquidRidable = getBoolean("mobs.glow_squid.ridable", glowSquidRidable);
|
||||
glowSquidControllable = getBoolean("mobs.glow_squid.controllable", glowSquidControllable);
|
||||
glowSquidMaxHealth = getDouble("mobs.glow_squid.attributes.max_health", glowSquidMaxHealth);
|
||||
glowSquidScale = Mth.clamp(getDouble("mobs.glow_squid.attributes.scale", glowSquidScale), 0.0625D, 16.0D);
|
||||
glowSquidsCanFly = getBoolean("mobs.glow_squid.can-fly", glowSquidsCanFly);
|
||||
}
|
||||
|
||||
public boolean goatRidable = false;
|
||||
@@ -1628,6 +1630,7 @@ public class PurpurWorldConfig {
|
||||
public double squidScale = 1.0D;
|
||||
public boolean squidImmuneToEAR = true;
|
||||
public double squidOffsetWaterCheck = 0.0D;
|
||||
public boolean squidsCanFly = false;
|
||||
private void squidSettings() {
|
||||
squidRidable = getBoolean("mobs.squid.ridable", squidRidable);
|
||||
squidControllable = getBoolean("mobs.squid.controllable", squidControllable);
|
||||
@@ -1640,6 +1643,7 @@ public class PurpurWorldConfig {
|
||||
squidScale = Mth.clamp(getDouble("mobs.squid.attributes.scale", squidScale), 0.0625D, 16.0D);
|
||||
squidImmuneToEAR = getBoolean("mobs.squid.immune-to-EAR", squidImmuneToEAR);
|
||||
squidOffsetWaterCheck = getDouble("mobs.squid.water-offset-check", squidOffsetWaterCheck);
|
||||
squidsCanFly = getBoolean("mobs.squid.can-fly", squidsCanFly);
|
||||
}
|
||||
|
||||
public boolean spiderRidable = false;
|
||||
|
||||
Reference in New Issue
Block a user