This commit is contained in:
BillyGalbreath
2021-06-19 01:49:53 -05:00
parent df6e24a868
commit e488d274fe
90 changed files with 1507 additions and 348 deletions

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Giants AI settings
diff --git a/src/main/java/net/minecraft/world/entity/monster/Giant.java b/src/main/java/net/minecraft/world/entity/monster/Giant.java
index 8be06ef6e876219cb8130938fabe7ec6c99cf408..4f0449ed1acdcc85a659973e5c40c6c62868ecf2 100644
index a8ffdc8810152d77668aad7bad15a00c4d194d4c..91e28c414545d2bbb4e2f22c516d0f683e8b04ec 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Giant.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Giant.java
@@ -1,13 +1,36 @@
@@ -45,12 +45,25 @@ index 8be06ef6e876219cb8130938fabe7ec6c99cf408..4f0449ed1acdcc85a659973e5c40c6c6
public class Giant extends Monster {
public Giant(EntityType<? extends Giant> type, Level world) {
@@ -28,8 +51,56 @@ public class Giant extends Monster {
@@ -26,18 +49,59 @@ public class Giant extends Monster {
return level.purpurConfig.giantRidableInWater;
}
@Override
protected void registerGoals() {
- @Override
- protected void registerGoals() {
- this.goalSelector.addGoal(0, new net.pl3x.purpur.entity.ai.HasRider(this));
- this.targetSelector.addGoal(0, new net.pl3x.purpur.entity.ai.HasRider(this));
- }
-
@Override
protected void initAttributes() {
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.giantMaxHealth);
this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(this.level.purpurConfig.giantMovementSpeed);
this.getAttribute(Attributes.ATTACK_DAMAGE).setBaseValue(this.level.purpurConfig.giantAttackDamage);
}
+
+ @Override
+ protected void registerGoals() {
+ if (level.purpurConfig.giantHaveAI) {
+ this.goalSelector.addGoal(0, new FloatGoal(this));
+ this.goalSelector.addGoal(0, new net.pl3x.purpur.entity.ai.HasRider(this));
@@ -71,13 +84,6 @@ index 8be06ef6e876219cb8130938fabe7ec6c99cf408..4f0449ed1acdcc85a659973e5c40c6c6
+ }
+
+ @Override
+ protected void initAttributes() {
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.giantMaxHealth);
+ this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(this.level.purpurConfig.giantMovementSpeed);
+ this.getAttribute(Attributes.ATTACK_DAMAGE).setBaseValue(this.level.purpurConfig.giantAttackDamage);
+ }
+
+ @Override
+ public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, MobSpawnType spawnReason, @Nullable SpawnGroupData entityData, @Nullable CompoundTag entityNbt) {
+ SpawnGroupData groupData = super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityNbt);
+ if (groupData == null) {
@@ -101,10 +107,11 @@ index 8be06ef6e876219cb8130938fabe7ec6c99cf408..4f0449ed1acdcc85a659973e5c40c6c6
+ // make giants jump as high as everything else relative to their size
+ // 1.0 makes bottom of feet about as high as their waist when they jump
+ return level.purpurConfig.giantJumpHeight;
}
+ }
// Purpur end
@@ -44,6 +115,6 @@ public class Giant extends Monster {
@Override
@@ -51,6 +115,6 @@ public class Giant extends Monster {
@Override
public float getWalkTargetValue(BlockPos pos, LevelReader world) {
@@ -113,35 +120,28 @@ index 8be06ef6e876219cb8130938fabe7ec6c99cf408..4f0449ed1acdcc85a659973e5c40c6c6
}
}
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 85ca45d162518096748631037ddde30dd8f87563..11470cb1acf37a2d7017d5b5ae73fcb075993f4d 100644
index 96202520c0f42db814fdb60ffb77dd0cdef12410..25db072223e7833c470b0023861df376af19831b 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -305,9 +305,28 @@ public class PurpurWorldConfig {
public boolean giantRidable = false;
public boolean giantRidableInWater = false;
@@ -427,6 +427,10 @@ public class PurpurWorldConfig {
public double giantMovementSpeed = 0.5D;
public double giantAttackDamage = 50.0D;
public double giantMaxHealth = 100.0D;
+ public float giantStepHeight = 2.0F;
+ public float giantJumpHeight = 1.0F;
+ public double giantMovementSpeed = 0.5D;
+ public double giantAttackDamage = 50.0D;
+ public boolean giantHaveAI = false;
+ public boolean giantHaveHostileAI = false;
+ public double giantMaxHealth = 100.0D;
private void giantSettings() {
giantRidable = getBoolean("mobs.giant.ridable", giantRidable);
giantRidableInWater = getBoolean("mobs.giant.ridable-in-water", giantRidableInWater);
@@ -442,6 +446,10 @@ public class PurpurWorldConfig {
set("mobs.giant.attributes.max_health", oldValue);
}
giantMaxHealth = getDouble("mobs.giant.attributes.max_health", giantMaxHealth);
+ giantStepHeight = (float) getDouble("mobs.giant.step-height", giantStepHeight);
+ giantJumpHeight = (float) getDouble("mobs.giant.jump-height", giantJumpHeight);
+ 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);
+ if (PurpurConfig.version < 8) {
+ double oldValue = getDouble("mobs.giant.max-health", giantMaxHealth);
+ set("mobs.giant.attributes.max-health", oldValue);
+ set("mobs.giant.max-health", null);
+ }
+ giantMaxHealth = getDouble("mobs.giant.attributes.max-health", giantMaxHealth);
}
public boolean glowSquidRidable = false;