mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 01:17:42 +01:00
Merge in Tuinity patches
This commit is contained in:
129
patches/server/0011-Give-giants-AI.patch
Normal file
129
patches/server/0011-Give-giants-AI.patch
Normal file
@@ -0,0 +1,129 @@
|
||||
From dace65f4318c5f01cbec9bedb20ff439dd433269 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] Give giants AI
|
||||
|
||||
---
|
||||
.../minecraft/server/EntityGiantZombie.java | 47 +++++++++++++++++--
|
||||
.../minecraft/server/EntityInsentient.java | 2 +
|
||||
.../net/pl3x/purpur/PurpurWorldConfig.java | 10 ++++
|
||||
3 files changed, 55 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityGiantZombie.java b/src/main/java/net/minecraft/server/EntityGiantZombie.java
|
||||
index ff8a41a53..4296aaa07 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityGiantZombie.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityGiantZombie.java
|
||||
@@ -23,6 +23,45 @@ public class EntityGiantZombie extends EntityMonster {
|
||||
return world.purpurConfig.giantRequireShiftToMount;
|
||||
}
|
||||
|
||||
+ protected void initPathfinder() {
|
||||
+ if (world.purpurConfig.giantHaveAI) {
|
||||
+ this.goalSelector.a(0, new PathfinderGoalFloat(this));
|
||||
+ this.goalSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur
|
||||
+ this.goalSelector.a(7, new PathfinderGoalRandomStrollLand(this, 1.0D));
|
||||
+ this.goalSelector.a(8, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 16.0F));
|
||||
+ this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this));
|
||||
+ this.goalSelector.a(5, new PathfinderGoalMoveTowardsRestriction(this, 1.0D));
|
||||
+ if (world.purpurConfig.giantHaveHostileAI) {
|
||||
+ this.goalSelector.a(2, new PathfinderGoalMeleeAttack(this, 1.0D, false));
|
||||
+ this.targetSelector.a(0, new net.pl3x.purpur.pathfinder.PathfinderGoalHasRider(this)); // Purpur
|
||||
+ this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this).a(EntityPigZombie.class));
|
||||
+ this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, true));
|
||||
+ this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityVillager.class, false));
|
||||
+ this.targetSelector.a(4, new PathfinderGoalNearestAttackableTarget<>(this, EntityIronGolem.class, true));
|
||||
+ this.targetSelector.a(5, new PathfinderGoalNearestAttackableTarget<>(this, EntityTurtle.class, true));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @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);
|
||||
+ // TODO make configurable
|
||||
+ if (random.nextFloat() < (world.getDifficulty() == EnumDifficulty.HARD ? 0.1F : 0.05F)) {
|
||||
+ setSlot(EnumItemSlot.MAINHAND, new ItemStack(Items.IRON_SWORD));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
@Override
|
||||
public float getJumpHeight() {
|
||||
// make giants jump as high as everything else relative to their size
|
||||
@@ -39,13 +78,13 @@ public class EntityGiantZombie extends EntityMonster {
|
||||
@Override
|
||||
protected void initAttributes() {
|
||||
super.initAttributes();
|
||||
- this.getAttributeInstance(GenericAttributes.MAX_HEALTH).setValue(100.0D);
|
||||
- this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).setValue(0.5D);
|
||||
- this.getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).setValue(50.0D);
|
||||
+ this.getAttributeInstance(GenericAttributes.MAX_HEALTH).setValue(world.purpurConfig.giantMaxHealth); // Purpur
|
||||
+ this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).setValue(world.purpurConfig.giantMovementSpeed); // Purpur
|
||||
+ this.getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).setValue(world.purpurConfig.giantAttackDamage); // Purpur
|
||||
}
|
||||
|
||||
@Override
|
||||
public float a(BlockPosition blockposition, IWorldReader iworldreader) {
|
||||
- return iworldreader.w(blockposition) - 0.5F;
|
||||
+ 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 240bbee36..3ef4f8db4 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
@@ -874,6 +874,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);
|
||||
@@ -981,6 +982,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/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index ad96353af..22a8f2da3 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -249,12 +249,22 @@ public class PurpurWorldConfig {
|
||||
public boolean giantRequireShiftToMount = true;
|
||||
public float giantStepHeight = 2.0F;
|
||||
public float giantJumpHeight = 1.0F;
|
||||
+ public double giantMaxHealth = 100.0D;
|
||||
+ public double giantMovementSpeed = 0.5D;
|
||||
+ public double giantAttackDamage = 50.0D;
|
||||
+ public boolean giantHaveAI = false;
|
||||
+ public boolean giantHaveHostileAI = false;
|
||||
private void giantSettings() {
|
||||
giantRidable = getBoolean("mobs.giant.ridable", giantRidable);
|
||||
giantRidableInWater = getBoolean("mobs.giant.ridable-in-water", giantRidableInWater);
|
||||
giantRequireShiftToMount = getBoolean("mobs.giant.require-shift-to-mount", giantRequireShiftToMount);
|
||||
giantStepHeight = (float) getDouble("mobs.giant.step-height", giantStepHeight);
|
||||
giantJumpHeight = (float) getDouble("mobs.giant.jump-height", giantJumpHeight);
|
||||
+ giantMaxHealth = getDouble("mobs.giant.max-health", giantMaxHealth);
|
||||
+ giantMovementSpeed = getDouble("mobs.giant.movement-speed", giantMovementSpeed);
|
||||
+ giantAttackDamage = getDouble("mobs.giant.attack-damage", giantAttackDamage);
|
||||
+ giantHaveAI = getBoolean("mobs.giant.have-ai", giantHaveAI);
|
||||
+ giantHaveHostileAI = getBoolean("mobs.giant.have-hostile-ai", giantHaveHostileAI);
|
||||
}
|
||||
|
||||
public boolean guardianRidable = false;
|
||||
--
|
||||
2.24.0
|
||||
|
||||
Reference in New Issue
Block a user