mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-21 10:27:44 +01:00
[ci skip] inline fqn imports
This commit is contained in:
@@ -5,77 +5,42 @@ 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 9602e59cbebeedc85ea75d2a41d3e74f0ff45b46..3c1217d36522b1fd3d1a099d3a12d99016f34c4b 100644
|
||||
index 9602e59cbebeedc85ea75d2a41d3e74f0ff45b46..ca53c5b45c119dce1c713dbf931251f89c90cb8d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Giant.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Giant.java
|
||||
@@ -1,11 +1,34 @@
|
||||
package net.minecraft.world.entity.monster;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
+import net.minecraft.nbt.CompoundTag;
|
||||
+import net.minecraft.world.Difficulty;
|
||||
+import net.minecraft.world.DifficultyInstance;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
+import net.minecraft.world.entity.EquipmentSlot;
|
||||
+import net.minecraft.world.entity.MobSpawnType;
|
||||
+import net.minecraft.world.entity.SpawnGroupData;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
+import net.minecraft.world.entity.ai.goal.FloatGoal;
|
||||
+import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal;
|
||||
+import net.minecraft.world.entity.ai.goal.MeleeAttackGoal;
|
||||
+import net.minecraft.world.entity.ai.goal.MoveTowardsRestrictionGoal;
|
||||
+import net.minecraft.world.entity.ai.goal.RandomLookAroundGoal;
|
||||
+import net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal;
|
||||
+import net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal;
|
||||
+import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal;
|
||||
+import net.minecraft.world.entity.animal.IronGolem;
|
||||
+import net.minecraft.world.entity.animal.Turtle;
|
||||
+import net.minecraft.world.entity.npc.Villager;
|
||||
+import net.minecraft.world.entity.player.Player;
|
||||
+import net.minecraft.world.item.ItemStack;
|
||||
+import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.LevelReader;
|
||||
+import net.minecraft.world.level.ServerLevelAccessor;
|
||||
+
|
||||
+import javax.annotation.Nullable;
|
||||
|
||||
public class Giant extends Monster {
|
||||
public Giant(EntityType<? extends Giant> type, Level world) {
|
||||
@@ -30,8 +53,23 @@ public class Giant extends Monster {
|
||||
@@ -30,8 +30,23 @@ public class Giant extends Monster {
|
||||
|
||||
@Override
|
||||
protected void registerGoals() {
|
||||
- this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this));
|
||||
- this.targetSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this));
|
||||
+ if (level().purpurConfig.giantHaveAI) {
|
||||
+ this.goalSelector.addGoal(0, new 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(7, new WaterAvoidingRandomStrollGoal(this, 1.0D));
|
||||
+ this.goalSelector.addGoal(8, new LookAtPlayerGoal(this, Player.class, 16.0F));
|
||||
+ this.goalSelector.addGoal(8, new RandomLookAroundGoal(this));
|
||||
+ this.goalSelector.addGoal(5, new MoveTowardsRestrictionGoal(this, 1.0D));
|
||||
+ this.goalSelector.addGoal(7, new net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal(this, 1.0D));
|
||||
+ this.goalSelector.addGoal(8, new net.minecraft.world.entity.ai.goal.LookAtPlayerGoal(this, net.minecraft.world.entity.player.Player.class, 16.0F));
|
||||
+ this.goalSelector.addGoal(8, new net.minecraft.world.entity.ai.goal.RandomLookAroundGoal(this));
|
||||
+ this.goalSelector.addGoal(5, new net.minecraft.world.entity.ai.goal.MoveTowardsRestrictionGoal(this, 1.0D));
|
||||
+ if (level().purpurConfig.giantHaveHostileAI) {
|
||||
+ this.goalSelector.addGoal(2, new MeleeAttackGoal(this, 1.0D, false));
|
||||
+ this.goalSelector.addGoal(2, new net.minecraft.world.entity.ai.goal.MeleeAttackGoal(this, 1.0D, false));
|
||||
+ this.targetSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this));
|
||||
+ this.targetSelector.addGoal(1, new HurtByTargetGoal(this).setAlertOthers(ZombifiedPiglin.class));
|
||||
+ this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, true));
|
||||
+ this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, Villager.class, false));
|
||||
+ this.targetSelector.addGoal(4, new NearestAttackableTargetGoal<>(this, IronGolem.class, true));
|
||||
+ this.targetSelector.addGoal(5, new NearestAttackableTargetGoal<>(this, Turtle.class, true));
|
||||
+ this.targetSelector.addGoal(1, new net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal(this).setAlertOthers(ZombifiedPiglin.class));
|
||||
+ this.targetSelector.addGoal(2, new net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal<>(this, net.minecraft.world.entity.player.Player.class, true));
|
||||
+ this.targetSelector.addGoal(3, new net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal<>(this, net.minecraft.world.entity.npc.Villager.class, false));
|
||||
+ this.targetSelector.addGoal(4, new net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal<>(this, net.minecraft.world.entity.animal.IronGolem.class, true));
|
||||
+ this.targetSelector.addGoal(5, new net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal<>(this, net.minecraft.world.entity.animal.Turtle.class, true));
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -47,8 +85,34 @@ public class Giant extends Monster {
|
||||
@@ -47,8 +62,34 @@ 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);
|
||||
}
|
||||
|
||||
+ @Override
|
||||
+ public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, MobSpawnType spawnReason, @Nullable SpawnGroupData entityData) {
|
||||
+ SpawnGroupData groupData = super.finalizeSpawn(world, difficulty, spawnReason, entityData);
|
||||
+ public net.minecraft.world.entity.SpawnGroupData finalizeSpawn(net.minecraft.world.level.ServerLevelAccessor world, net.minecraft.world.DifficultyInstance difficulty, net.minecraft.world.entity.MobSpawnType spawnReason, @javax.annotation.Nullable net.minecraft.world.entity.SpawnGroupData entityData) {
|
||||
+ net.minecraft.world.entity.SpawnGroupData groupData = super.finalizeSpawn(world, difficulty, spawnReason, entityData);
|
||||
+ if (groupData == null) {
|
||||
+ populateDefaultEquipmentSlots(this.random, difficulty);
|
||||
+ populateDefaultEquipmentEnchantments(this.random, difficulty);
|
||||
@@ -84,11 +49,11 @@ index 9602e59cbebeedc85ea75d2a41d3e74f0ff45b46..3c1217d36522b1fd3d1a099d3a12d990
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ protected void populateDefaultEquipmentSlots(net.minecraft.util.RandomSource random, DifficultyInstance difficulty) {
|
||||
+ protected void populateDefaultEquipmentSlots(net.minecraft.util.RandomSource random, net.minecraft.world.DifficultyInstance difficulty) {
|
||||
+ super.populateDefaultEquipmentSlots(this.random, difficulty);
|
||||
+ // TODO make configurable
|
||||
+ if (random.nextFloat() < (level().getDifficulty() == Difficulty.HARD ? 0.1F : 0.05F)) {
|
||||
+ this.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(Items.IRON_SWORD));
|
||||
+ if (random.nextFloat() < (level().getDifficulty() == net.minecraft.world.Difficulty.HARD ? 0.1F : 0.05F)) {
|
||||
+ this.setItemSlot(net.minecraft.world.entity.EquipmentSlot.MAINHAND, new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.IRON_SWORD));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
|
||||
Reference in New Issue
Block a user