mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-20 01:47:42 +01:00
port Giants AI settings patch
This commit is contained in:
@@ -5,15 +5,16 @@ Subject: [PATCH] Giants AI settings
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/net/minecraft/world/entity/monster/Giant.java b/net/minecraft/world/entity/monster/Giant.java
|
diff --git a/net/minecraft/world/entity/monster/Giant.java b/net/minecraft/world/entity/monster/Giant.java
|
||||||
index 4a13274a863345650ca0c3f98d6b2735221c778a..adc90a306fc9023f4a1cdfe9f58c39726086c849 100644
|
index 13021800af7cc9263ef4f393f9cfbda5061a32ae..73da18c4b54e250c434fd75971ef0a8f7c8cf6a3 100644
|
||||||
--- a/net/minecraft/world/entity/monster/Giant.java
|
--- a/net/minecraft/world/entity/monster/Giant.java
|
||||||
+++ b/net/minecraft/world/entity/monster/Giant.java
|
+++ b/net/minecraft/world/entity/monster/Giant.java
|
||||||
@@ -30,8 +30,23 @@ public class Giant extends Monster {
|
@@ -30,8 +30,25 @@ public class Giant extends Monster {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerGoals() {
|
protected void registerGoals() {
|
||||||
- this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this));
|
- this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this));
|
||||||
- this.targetSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this));
|
- this.targetSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this));
|
||||||
|
+ // Purpur start - Giants AI settings
|
||||||
+ if (level().purpurConfig.giantHaveAI) {
|
+ if (level().purpurConfig.giantHaveAI) {
|
||||||
+ this.goalSelector.addGoal(0, new net.minecraft.world.entity.ai.goal.FloatGoal(this));
|
+ this.goalSelector.addGoal(0, new net.minecraft.world.entity.ai.goal.FloatGoal(this));
|
||||||
+ this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this));
|
+ this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this));
|
||||||
@@ -31,13 +32,15 @@ index 4a13274a863345650ca0c3f98d6b2735221c778a..adc90a306fc9023f4a1cdfe9f58c3972
|
|||||||
+ this.targetSelector.addGoal(5, new net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal<>(this, net.minecraft.world.entity.animal.Turtle.class, true));
|
+ this.targetSelector.addGoal(5, new net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal<>(this, net.minecraft.world.entity.animal.Turtle.class, true));
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
|
+ // Purpur end - Giants AI settings
|
||||||
}
|
}
|
||||||
// Purpur end - Ridables
|
// Purpur end - Ridables
|
||||||
|
|
||||||
@@ -48,8 +63,34 @@ public class Giant extends Monster {
|
@@ -49,8 +66,36 @@ public class Giant extends Monster {
|
||||||
return Monster.createMonsterAttributes().add(Attributes.MAX_HEALTH, 100.0).add(Attributes.MOVEMENT_SPEED, 0.5).add(Attributes.ATTACK_DAMAGE, 50.0);
|
return Monster.createMonsterAttributes().add(Attributes.MAX_HEALTH, 100.0).add(Attributes.MOVEMENT_SPEED, 0.5).add(Attributes.ATTACK_DAMAGE, 50.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ // Purpur - Giants AI settings
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public net.minecraft.world.entity.SpawnGroupData finalizeSpawn(net.minecraft.world.level.ServerLevelAccessor world, net.minecraft.world.DifficultyInstance difficulty, net.minecraft.world.entity.EntitySpawnReason spawnReason, @org.jetbrains.annotations.Nullable net.minecraft.world.entity.SpawnGroupData entityData) {
|
+ public net.minecraft.world.entity.SpawnGroupData finalizeSpawn(net.minecraft.world.level.ServerLevelAccessor world, net.minecraft.world.DifficultyInstance difficulty, net.minecraft.world.entity.EntitySpawnReason spawnReason, @org.jetbrains.annotations.Nullable net.minecraft.world.entity.SpawnGroupData entityData) {
|
||||||
+ net.minecraft.world.entity.SpawnGroupData groupData = super.finalizeSpawn(world, difficulty, spawnReason, entityData);
|
+ net.minecraft.world.entity.SpawnGroupData groupData = super.finalizeSpawn(world, difficulty, spawnReason, entityData);
|
||||||
@@ -63,36 +66,11 @@ index 4a13274a863345650ca0c3f98d6b2735221c778a..adc90a306fc9023f4a1cdfe9f58c3972
|
|||||||
+ // 1.0 makes bottom of feet about as high as their waist when they jump
|
+ // 1.0 makes bottom of feet about as high as their waist when they jump
|
||||||
+ return level().purpurConfig.giantJumpHeight;
|
+ return level().purpurConfig.giantJumpHeight;
|
||||||
+ }
|
+ }
|
||||||
|
+ // Purpur end - Giants AI settings
|
||||||
+
|
+
|
||||||
@Override
|
@Override
|
||||||
public float getWalkTargetValue(BlockPos pos, LevelReader world) {
|
public float getWalkTargetValue(BlockPos pos, LevelReader level) {
|
||||||
- return world.getPathfindingCostFromLightLevels(pos);
|
- return level.getPathfindingCostFromLightLevels(pos);
|
||||||
+ return super.getWalkTargetValue(pos, world); // Purpur - fix light requirements for natural spawns
|
+ return super.getWalkTargetValue(pos, level); // Purpur - Giants AI settings - fix light requirements for natural spawns
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
||||||
index f6186c65468953756da9c381c6ee712115a244f7..3c3df7767bc97882f53f32de1b4a350f73b16f23 100644
|
|
||||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
||||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
||||||
@@ -635,6 +635,10 @@ public class PurpurWorldConfig {
|
|
||||||
public double giantAttackDamage = 50.0D;
|
|
||||||
public double giantMaxHealth = 100.0D;
|
|
||||||
public double giantScale = 1.0D;
|
|
||||||
+ public float giantStepHeight = 2.0F;
|
|
||||||
+ public float giantJumpHeight = 1.0F;
|
|
||||||
+ 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);
|
|
||||||
@@ -652,6 +656,10 @@ public class PurpurWorldConfig {
|
|
||||||
}
|
|
||||||
giantMaxHealth = getDouble("mobs.giant.attributes.max_health", giantMaxHealth);
|
|
||||||
giantScale = Mth.clamp(getDouble("mobs.giant.attributes.scale", giantScale), 0.0625D, 16.0D);
|
|
||||||
+ giantStepHeight = (float) getDouble("mobs.giant.step-height", giantStepHeight);
|
|
||||||
+ giantJumpHeight = (float) getDouble("mobs.giant.jump-height", giantJumpHeight);
|
|
||||||
+ giantHaveAI = getBoolean("mobs.giant.have-ai", giantHaveAI);
|
|
||||||
+ giantHaveHostileAI = getBoolean("mobs.giant.have-hostile-ai", giantHaveHostileAI);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean glowSquidRidable = false;
|
|
||||||
@@ -621,6 +621,10 @@ public class PurpurWorldConfig {
|
|||||||
public double giantAttackDamage = 50.0D;
|
public double giantAttackDamage = 50.0D;
|
||||||
public double giantMaxHealth = 100.0D;
|
public double giantMaxHealth = 100.0D;
|
||||||
public double giantScale = 1.0D;
|
public double giantScale = 1.0D;
|
||||||
|
public float giantStepHeight = 2.0F;
|
||||||
|
public float giantJumpHeight = 1.0F;
|
||||||
|
public boolean giantHaveAI = false;
|
||||||
|
public boolean giantHaveHostileAI = false;
|
||||||
private void giantSettings() {
|
private void giantSettings() {
|
||||||
giantRidable = getBoolean("mobs.giant.ridable", giantRidable);
|
giantRidable = getBoolean("mobs.giant.ridable", giantRidable);
|
||||||
giantRidableInWater = getBoolean("mobs.giant.ridable-in-water", giantRidableInWater);
|
giantRidableInWater = getBoolean("mobs.giant.ridable-in-water", giantRidableInWater);
|
||||||
@@ -638,6 +642,10 @@ public class PurpurWorldConfig {
|
|||||||
}
|
}
|
||||||
giantMaxHealth = getDouble("mobs.giant.attributes.max_health", giantMaxHealth);
|
giantMaxHealth = getDouble("mobs.giant.attributes.max_health", giantMaxHealth);
|
||||||
giantScale = Mth.clamp(getDouble("mobs.giant.attributes.scale", giantScale), 0.0625D, 16.0D);
|
giantScale = Mth.clamp(getDouble("mobs.giant.attributes.scale", giantScale), 0.0625D, 16.0D);
|
||||||
|
giantStepHeight = (float) getDouble("mobs.giant.step-height", giantStepHeight);
|
||||||
|
giantJumpHeight = (float) getDouble("mobs.giant.jump-height", giantJumpHeight);
|
||||||
|
giantHaveAI = getBoolean("mobs.giant.have-ai", giantHaveAI);
|
||||||
|
giantHaveHostileAI = getBoolean("mobs.giant.have-hostile-ai", giantHaveHostileAI);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean glowSquidRidable = false;
|
public boolean glowSquidRidable = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user