mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
93 lines
4.6 KiB
Diff
93 lines
4.6 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 cb79d2c958fbd34f8c8818e7e1c0db8887dd15ba..b6df98797757462f35c306aa4c6ea1585a9a6ddc 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/GlowSquid.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/GlowSquid.java
|
|
@@ -43,6 +43,11 @@ public class GlowSquid extends Squid {
|
|
public void initAttributes() {
|
|
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;
|
|
+ }
|
|
// Purpur end
|
|
|
|
@Override
|
|
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 709aaa9dc834d91219ce1087d8f89ef5bf3d915c..4850960c7c4f38c7d81b8945f8c87504d5ccd0d0 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/Squid.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/Squid.java
|
|
@@ -86,6 +86,15 @@ public class Squid extends WaterAnimal {
|
|
// Stops squids from floating just over the water
|
|
return super.getAxisForFluidCheck().offsetY(level.purpurConfig.squidOffsetWaterCheck);
|
|
}
|
|
+
|
|
+ public boolean canFly() {
|
|
+ return this.level.purpurConfig.squidsCanFly;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean isInWater() {
|
|
+ return this.wasTouchingWater || canFly();
|
|
+ }
|
|
// Purpur end
|
|
|
|
@Override
|
|
@@ -160,6 +169,7 @@ public class Squid extends WaterAnimal {
|
|
}
|
|
|
|
if (this.isInWaterOrBubble()) {
|
|
+ if (canFly()) setNoGravity(!wasTouchingWater); // Purpur
|
|
if (this.tentacleMovement < 3.1415927F) {
|
|
float f = this.tentacleMovement / 3.1415927F;
|
|
|
|
@@ -319,7 +329,7 @@ public class Squid extends WaterAnimal {
|
|
|
|
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() * 6.2831855F;
|
|
float f1 = Mth.cos(f) * 0.2F;
|
|
float f2 = -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 50ea7f241d1eedb74104073fbcec7376d7afbb56..e752e9364c5f42e67e961854cef0a55c86eb4984 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
@@ -909,10 +909,12 @@ public class PurpurWorldConfig {
|
|
public boolean glowSquidRidable = false;
|
|
public boolean glowSquidControllable = true;
|
|
public double glowSquidMaxHealth = 10.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);
|
|
+ glowSquidsCanFly = getBoolean("mobs.glow_squid.can-fly", glowSquidsCanFly);
|
|
}
|
|
|
|
public boolean goatRidable = false;
|
|
@@ -1533,6 +1535,7 @@ public class PurpurWorldConfig {
|
|
public double squidMaxHealth = 10.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);
|
|
@@ -1544,6 +1547,7 @@ public class PurpurWorldConfig {
|
|
squidMaxHealth = getDouble("mobs.squid.attributes.max_health", squidMaxHealth);
|
|
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;
|