Files
Purpur/patches/server/0093-Flying-squids-Oh-my.patch
granny 639bcbd780 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@f9c7f2a Begin switching to JSpecify annotations (#11448)
PaperMC/Paper@e3c8a8e Add PlayerInsertLecternBookEvent [1.20 port] (#7305)
PaperMC/Paper@b410fe8 Configurable per-world void damage offset/damage(#11436)
PaperMC/Paper@ea00be3 Do not NPE on uuid resolution in player profile (#11449)
PaperMC/Paper@ba3c29b Finish converting all events to jspecify annotations
PaperMC/Paper@e7e1ab5 Finish converting most of the undeprecated api to jspecify
PaperMC/Paper@69ffbec Fix hex color check
PaperMC/Paper@709f0f2 Use components properly in ProfileWhitelistVerifyEvent (#11456)
PaperMC/Paper@fb76840 [ci skip] Add section on nullability annotations (#11461)
PaperMC/Paper@7cd4f2c Check if leash tag has a uuid
2024-10-03 17:08:59 -07:00

94 lines
4.9 KiB
Diff

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/src/main/java/net/minecraft/world/entity/GlowSquid.java b/src/main/java/net/minecraft/world/entity/GlowSquid.java
index 8211c152e6f4232e82e452b08047e4579465d770..4cd57672c548950cb4e0aa97af75ecca84be6823 100644
--- a/src/main/java/net/minecraft/world/entity/GlowSquid.java
+++ b/src/main/java/net/minecraft/world/entity/GlowSquid.java
@@ -41,6 +41,11 @@ public class GlowSquid extends Squid {
this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.glowSquidMaxHealth);
}
+ @Override
+ public boolean canFly() {
+ return this.level().purpurConfig.glowSquidsCanFly;
+ }
+
@Override
protected ParticleOptions getInkParticle() {
return ParticleTypes.GLOW_SQUID_INK;
diff --git a/src/main/java/net/minecraft/world/entity/animal/Squid.java b/src/main/java/net/minecraft/world/entity/animal/Squid.java
index 522dabcf6ec8b19902890718717fc890d430c750..ea80eca266500f93fa9c00962d078ec276814f0a 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Squid.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Squid.java
@@ -79,6 +79,15 @@ public class Squid extends WaterAnimal {
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));
@@ -151,6 +160,7 @@ public class Squid extends WaterAnimal {
}
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;
@@ -358,7 +368,7 @@ public class Squid extends WaterAnimal {
int i = this.squid.getNoActionTime();
if (i > 100) {
this.squid.setMovementVector(0.0F, 0.0F, 0.0F);
- } 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);
float g = Mth.cos(f) * 0.2F;
float h = -0.1F + this.squid.getRandom().nextFloat() * 0.2F;
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 51485b123545d11f7327aea9b6d76cb1fe1f3b97..0c852bdc84dbb3fc9855dc69269daac2e2dfe305 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -967,11 +967,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;
@@ -1658,6 +1660,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);
@@ -1670,6 +1673,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;