mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
92 lines
4.4 KiB
Diff
92 lines
4.4 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 ec261673ac444fd5de9c8556cde5d7887098aee0..ca2bf36120ba09ed27ad7b1064431f9feffa3420 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/GlowSquid.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/GlowSquid.java
|
|
@@ -38,6 +38,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 82d657e431a5a2317e5be80f3b2898a5c7371a42..9a99904bd761df5861f68533279ebde39644b4f8 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/Squid.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/Squid.java
|
|
@@ -82,6 +82,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
|
|
@@ -156,6 +165,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;
|
|
|
|
@@ -312,7 +322,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/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
index d67c6a67e2c632b36ac28746195efd1cea1077d3..e2b3e7849b5e1a2a18a05a36e6947dd15d1811b4 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -807,9 +807,11 @@ public class PurpurWorldConfig {
|
|
|
|
public boolean glowSquidRidable = false;
|
|
public double glowSquidMaxHealth = 10.0D;
|
|
+ public boolean glowSquidsCanFly = false;
|
|
private void glowSquidSettings() {
|
|
glowSquidRidable = getBoolean("mobs.glow_squid.ridable", glowSquidRidable);
|
|
glowSquidMaxHealth = getDouble("mobs.glow_squid.attributes.max_health", glowSquidMaxHealth);
|
|
+ glowSquidsCanFly = getBoolean("mobs.glow_squid.can-fly", glowSquidsCanFly);
|
|
}
|
|
|
|
public boolean goatRidable = false;
|
|
@@ -1365,6 +1367,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);
|
|
if (PurpurConfig.version < 10) {
|
|
@@ -1375,6 +1378,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;
|