mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-20 18:07:43 +01:00
all feature patches applied?? that was too easy...
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
From 0000000000000000000000000000000000000000 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] Giants AI settings
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/monster/Giant.java b/net/minecraft/world/entity/monster/Giant.java
|
||||
index e673f488bfab9648075857bc40e1339f974a903c..f5565d314ded2145219debc446c7ddcb93b660e9 100644
|
||||
--- a/net/minecraft/world/entity/monster/Giant.java
|
||||
+++ b/net/minecraft/world/entity/monster/Giant.java
|
||||
@@ -30,8 +30,25 @@ 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));
|
||||
+ // Purpur start - Giants AI settings
|
||||
+ if (level().purpurConfig.giantHaveAI) {
|
||||
+ 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 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 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 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));
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end - Giants AI settings
|
||||
}
|
||||
// Purpur end - Ridables
|
||||
|
||||
@@ -53,8 +70,36 @@ public class Giant extends Monster {
|
||||
.add(Attributes.CAMERA_DISTANCE, 16.0);
|
||||
}
|
||||
|
||||
+ // Purpur - Giants AI settings
|
||||
+ @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) {
|
||||
+ net.minecraft.world.entity.SpawnGroupData groupData = super.finalizeSpawn(world, difficulty, spawnReason, entityData);
|
||||
+ if (groupData == null) {
|
||||
+ populateDefaultEquipmentSlots(this.random, difficulty);
|
||||
+ populateDefaultEquipmentEnchantments(world, this.random, difficulty);
|
||||
+ }
|
||||
+ return groupData;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ 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() == 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));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public float getJumpPower() {
|
||||
+ // 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 - Giants AI settings
|
||||
+
|
||||
@Override
|
||||
public float getWalkTargetValue(BlockPos pos, LevelReader level) {
|
||||
- return level.getPathfindingCostFromLightLevels(pos);
|
||||
+ return super.getWalkTargetValue(pos, level); // Purpur - Giants AI settings - fix light requirements for natural spawns
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user