now it will be hell

This commit is contained in:
Ben Kerllenevich
2022-06-08 13:25:16 -04:00
parent ed5b0fda9e
commit 856416cca4
9 changed files with 45 additions and 22 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 c1c5e884f00398032196ee71b55b348fcfce21ce..0d26d2388cc1963df9bc361b31a572c12e2f8709 100644
index c1c5e884f00398032196ee71b55b348fcfce21ce..ed032918fb33d60c2d60d4db9275dddf88dd72d9 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 @@
@@ -87,15 +87,15 @@ index c1c5e884f00398032196ee71b55b348fcfce21ce..0d26d2388cc1963df9bc361b31a572c1
+ 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) {
+ populateDefaultEquipmentSlots(difficulty);
+ populateDefaultEquipmentEnchantments(difficulty);
+ populateDefaultEquipmentSlots(this.random, difficulty);
+ populateDefaultEquipmentEnchantments(this.random, difficulty);
+ }
+ return groupData;
+ }
+
+ @Override
+ protected void populateDefaultEquipmentSlots(DifficultyInstance difficulty) {
+ super.populateDefaultEquipmentSlots(difficulty);
+ protected void populateDefaultEquipmentSlots(net.minecraft.util.RandomSource random, 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));