Files
Purpur/patches/server/0108-Flying-squids-Oh-my.patch
William Blake Galbreath 69c7c31f9a Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
26c37d99d5 create random seeds for features using SecureRandom
589bf2f1bf Upgrade gson to 2.8.8 (Closes #6370)
0a6103597b Get entity default attributes (#6449)
40057019e0 Correctly inflate villager activation bounding box (#6798)
e5f9241d15 Left handed API (#6775)
40ee63496c Add advancement display API (#6175)
9d570042ed Add ItemFactory#getMonsterEgg API (#6772)
55ca459515 rename method to getSpawnEgg
bb397ba74c Add critical damage API (#6275)
f47aeafe00 Add Horse Animation API (#5599)
7a0886180f AT & Mapping fixes (#6809)
5553432644 docs: Update gradle instructions for Java 16 (#6811) [ci skip]
a1f49e4c60 Fix command suggestion leak (#6592)
9472d38f3c Fix method name for Critical damage (#6813)
2021-10-21 10:58:20 -05:00

92 lines
4.3 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 8c76074289954aae933dd41184f1f0d346bc6c8b..a2343002ec47df867537d42dcf374df448b591aa 100644
--- a/src/main/java/net/minecraft/world/entity/GlowSquid.java
+++ b/src/main/java/net/minecraft/world/entity/GlowSquid.java
@@ -34,6 +34,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 af13adb96a083c83b7b847770a85e32bd0eafa4b..bde5ee9f4a307608db5f58f24a0c8da736e96d20 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Squid.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Squid.java
@@ -85,6 +85,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
@@ -159,6 +168,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;
@@ -320,7 +330,7 @@ public class Squid extends WaterAnimal {
if (i > 100) {
this.squid.setMovementVector(0.0F, 0.0F, 0.0F);
- } else if (this.squid.getRandom().nextInt(50) == 0 || !this.squid.wasTouchingWater || !this.squid.hasMovementVector()) {
+ } else if (this.squid.getRandom().nextInt(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 2109f3d8c532f21da732d2d9b375c7f7c03e1ae6..f4bae9da725ac4cbafe81d45035b5fcd176f1702 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -833,9 +833,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;
@@ -1391,6 +1393,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) {
@@ -1401,6 +1404,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;