Allow giants to spawn with armor and weapons

This commit is contained in:
William Blake Galbreath
2019-09-01 13:38:52 -05:00
parent 2cb25ce286
commit 1840cf270d
2 changed files with 52 additions and 13 deletions

View File

@@ -1,15 +1,16 @@
From a709dcbc1a7e628afba4752c839728cf28d876e4 Mon Sep 17 00:00:00 2001
From 3fbc8e4ab09dd097f955a0cdc969c0b0fe94b828 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Sun, 12 May 2019 00:43:12 -0500
Subject: [PATCH] Make giants naturally spawn and have AI
---
.../java/net/minecraft/server/BiomeBase.java | 1 +
.../java/net/minecraft/server/Biomes.java | 25 ++++++++++++++++
.../minecraft/server/EntityGiantZombie.java | 30 +++++++++++++++++--
.../net/minecraft/server/SpawnerCreature.java | 8 +++++
.../java/net/pl3x/purpur/PurpurConfig.java | 7 +++++
5 files changed, 69 insertions(+), 2 deletions(-)
.../java/net/minecraft/server/Biomes.java | 25 ++++++++++
.../minecraft/server/EntityGiantZombie.java | 48 ++++++++++++++++++-
.../minecraft/server/EntityInsentient.java | 2 +
.../net/minecraft/server/SpawnerCreature.java | 8 ++++
.../java/net/pl3x/purpur/PurpurConfig.java | 7 +++
6 files changed, 89 insertions(+), 2 deletions(-)
diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/net/minecraft/server/BiomeBase.java
index a86ece834..fbbb3b7c5 100644
@@ -59,10 +60,10 @@ index f4698a680..b075ee4ec 100644
+ // Purpur end
}
diff --git a/src/main/java/net/minecraft/server/EntityGiantZombie.java b/src/main/java/net/minecraft/server/EntityGiantZombie.java
index 29e7639ad..e69e7a456 100644
index 29e7639ad..be7e6bae4 100644
--- a/src/main/java/net/minecraft/server/EntityGiantZombie.java
+++ b/src/main/java/net/minecraft/server/EntityGiantZombie.java
@@ -21,11 +21,37 @@ public class EntityGiantZombie extends EntityMonster {
@@ -21,11 +21,55 @@ public class EntityGiantZombie extends EntityMonster {
super.initAttributes();
this.getAttributeInstance(GenericAttributes.MAX_HEALTH).setValue(100.0D);
this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).setValue(0.5D);
@@ -94,6 +95,24 @@ index 29e7639ad..e69e7a456 100644
+ // 1.0 makes bottom of feet about as high as their waist when they jump
+ return 1.0F;
+ }
+
+ @Override
+ public GroupDataEntity prepare(GeneratorAccess world, DifficultyDamageScaler difficulty, EnumMobSpawn enummobspawn, GroupDataEntity groupDataEntity, NBTTagCompound nbt) {
+ GroupDataEntity groupData = super.prepare(world, difficulty, enummobspawn, groupDataEntity, nbt);
+ if (groupData == null) {
+ setEquipmentBasedOnDifficulty(difficulty);
+ setEnchantmentBasedOnDifficulty(difficulty);
+ }
+ return groupData;
+ }
+
+ @Override
+ protected void setEquipmentBasedOnDifficulty(DifficultyDamageScaler difficulty) {
+ super.setEquipmentBasedOnDifficulty(difficulty);
+ if (random.nextFloat() < (world.getDifficulty() == EnumDifficulty.HARD ? 0.1F : 0.05F)) {
+ setSlot(EnumItemSlot.MAINHAND, new ItemStack(Items.IRON_SWORD));
+ }
+ }
+ // Purpur end
+
@Override
@@ -102,6 +121,26 @@ index 29e7639ad..e69e7a456 100644
+ return super.a(blockposition, iworldreader); // Purpur - fix light requirements for natural spawns
}
}
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index 47090db89..2a74c3d18 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -850,6 +850,7 @@ public abstract class EntityInsentient extends EntityLiving {
return f;
}
+ protected void setEquipmentBasedOnDifficulty(DifficultyDamageScaler difficultydamagescaler) { a(difficultydamagescaler); } // Purpur - OBFHELPER
protected void a(DifficultyDamageScaler difficultydamagescaler) {
if (this.random.nextFloat() < 0.15F * difficultydamagescaler.d()) {
int i = this.random.nextInt(2);
@@ -957,6 +958,7 @@ public abstract class EntityInsentient extends EntityLiving {
}
}
+ protected void setEnchantmentBasedOnDifficulty(DifficultyDamageScaler difficultydamagescaler) { b(difficultydamagescaler); } // Purpur - OBFHELPER
protected void b(DifficultyDamageScaler difficultydamagescaler) {
float f = difficultydamagescaler.d();
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index 9d4a96ae4..694075cb1 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -122,7 +161,7 @@ index 9d4a96ae4..694075cb1 100644
EntityPositionTypes.Surface entitypositiontypes_surface = EntityPositionTypes.a(entitytypes);
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
index 61adf7d63..7063c6329 100644
index d3409155e..1c8912530 100644
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
@@ -141,6 +141,13 @@ public class PurpurConfig {

View File

@@ -1,4 +1,4 @@
From 55a3b704cb50d08070977ad3a5b6816979a1a571 Mon Sep 17 00:00:00 2001
From eab0c36c7c34e5229de7f94217c5547b8355fe30 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Sun, 25 Aug 2019 00:09:52 -0500
Subject: [PATCH] Dispenser curse of binding protection
@@ -10,10 +10,10 @@ Subject: [PATCH] Dispenser curse of binding protection
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index 47090db89..806dabbbc 100644
index 2a74c3d18..610bf5458 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -895,9 +895,15 @@ public abstract class EntityInsentient extends EntityLiving {
@@ -896,9 +896,15 @@ public abstract class EntityInsentient extends EntityLiving {
}
@@ -52,7 +52,7 @@ index dec03e4ae..ce77b7e33 100644
return this.b;
}
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 2ecf5f9eb..6958866a4 100644
index 8915bc9ea..3ff5dc4a3 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -107,6 +107,11 @@ public class PurpurWorldConfig {