mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 08:27:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@b4192fd fix NPE from changes in e4358b82171 PaperMC/Paper@5b6445a Revert "fix NPE from changes in e4358b82171" PaperMC/Paper@323c087 Revert "#686: Fix contains for default section generating real sections" PaperMC/Paper@c837002 Fix client world difficulty sync issue (#7035) PaperMC/Paper@a4782f7 [ci skip] fixup indent PaperMC/Paper@83aee0f [ci skip] Clarify setSize consequences for Slimes (#7036) PaperMC/Paper@7c8fdc1 Add dropped hunk from mid-tick tasks (#7034) PaperMC/Paper@fd263ef Fix empty/null chunk section check in LevelChunk#getBlockData, rename… (#7039) PaperMC/Paper@b8d486c Create workflow to add new PRs to the PR Queue project (#6918) PaperMC/Paper@a50e273 Include axolotls in affected entities for water splash potions (#7024) PaperMC/Paper@af95df8 Port Actually unload POI data from Tuinity 1.16 (#7044) PaperMC/Paper@04897b1 [ci skip] Revert "Create workflow to add new PRs to the PR Queue project (#6918)" (#7046) PaperMC/Paper@b4a77a8 Updated Upstream (Bukkit/CraftBukkit) (#7045) PaperMC/Paper@0e25db2 Fix mis-placed processEnchantOrder from 1.18 update (#7052) PaperMC/Paper@53d026e Fix unused EntitySectionStorage#getEntities(AABB, Consumer) method being broken PaperMC/Paper@772e880 Fix light propagation in high y sections PaperMC/Paper@33ea869 Bump Starlight light version PaperMC/Paper@74fd151 Fix entity equipment on cancellation of EntityDeathEvent (#5740) PaperMC/Paper@758e2a7 Fix bad ticking checks for blocks PaperMC/Paper@0e91b6a Return 0 for light values if a dimenion does not have them PaperMC/Paper@188a8df Fix ChunkSnapshot#isSectionEmpty(int) PaperMC/Paper@bbc7451 Fix issue with snapshotted biomes in last commit PaperMC/Paper@b475c6a Backport log4j fix PaperMC/Paper@4e355c4 Updated Upstream (CraftBukkit) PaperMC/Paper@dce79f3 Update Log4J (#7069)
69 lines
4.8 KiB
Diff
69 lines
4.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
|
Date: Mon, 30 Aug 2021 22:14:39 -0500
|
|
Subject: [PATCH] Dolphins naturally aggressive to players chance
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
|
|
index 49e5a753aae7d72102ee700f3d8309f2f488cc12..022441af276cd9facba1ee4013d9d367db26711d 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
|
|
@@ -75,6 +75,7 @@ public class Dolphin extends WaterAnimal {
|
|
return !entityitem.hasPickUpDelay() && entityitem.isAlive() && entityitem.isInWater();
|
|
};
|
|
private int spitCooldown; // Purpur
|
|
+ private boolean isNaturallyAggressiveToPlayers; // Purpur
|
|
|
|
public Dolphin(EntityType<? extends Dolphin> type, Level world) {
|
|
super(type, world);
|
|
@@ -165,6 +166,7 @@ public class Dolphin extends WaterAnimal {
|
|
public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, MobSpawnType spawnReason, @Nullable SpawnGroupData entityData, @Nullable CompoundTag entityNbt) {
|
|
this.setAirSupply(this.getMaxAirSupply());
|
|
this.setXRot(0.0F);
|
|
+ this.isNaturallyAggressiveToPlayers = level.purpurConfig.dolphinNaturallyAggressiveToPlayersChance > 0.0D && random.nextDouble() <= level.purpurConfig.dolphinNaturallyAggressiveToPlayersChance; // Purpur
|
|
return super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityNbt);
|
|
}
|
|
|
|
@@ -235,18 +237,20 @@ public class Dolphin extends WaterAnimal {
|
|
this.goalSelector.addGoal(0, new BreathAirGoal(this));
|
|
this.goalSelector.addGoal(0, new TryFindWaterGoal(this));
|
|
this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur
|
|
+ this.goalSelector.addGoal(1, new MeleeAttackGoal(this, 1.2000000476837158D, true)); // Purpur
|
|
this.goalSelector.addGoal(1, new Dolphin.DolphinSwimToTreasureGoal(this));
|
|
this.goalSelector.addGoal(2, new Dolphin.DolphinSwimWithPlayerGoal(this, 4.0D));
|
|
this.goalSelector.addGoal(4, new RandomSwimmingGoal(this, 1.0D, 10));
|
|
this.goalSelector.addGoal(4, new RandomLookAroundGoal(this));
|
|
this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F));
|
|
this.goalSelector.addGoal(5, new DolphinJumpGoal(this, 10));
|
|
- this.goalSelector.addGoal(6, new MeleeAttackGoal(this, 1.2000000476837158D, true));
|
|
+ //this.goalSelector.addGoal(6, new MeleeAttackGoal(this, 1.2000000476837158D, true)); // Purpur - moved up
|
|
this.goalSelector.addGoal(8, new Dolphin.PlayWithItemsGoal());
|
|
this.goalSelector.addGoal(8, new FollowBoatGoal(this));
|
|
this.goalSelector.addGoal(9, new AvoidEntityGoal<>(this, Guardian.class, 8.0F, 1.0D, 1.0D));
|
|
this.targetSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur
|
|
this.targetSelector.addGoal(1, (new HurtByTargetGoal(this, new Class[]{Guardian.class})).setAlertOthers());
|
|
+ this.targetSelector.addGoal(2, new net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, target -> isNaturallyAggressiveToPlayers)); // Purpur
|
|
}
|
|
|
|
public static AttributeSupplier.Builder createAttributes() {
|
|
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
index d04d0105d2d04a93ab09b390e85f9d7bdfdbbf4e..c0538bf713edcc9166b9a8558112bab3f2cfa831 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
@@ -1169,6 +1169,7 @@ public class PurpurWorldConfig {
|
|
public double dolphinMaxHealth = 10.0D;
|
|
public boolean dolphinDisableTreasureSearching = false;
|
|
public boolean dolphinTakeDamageFromWater = false;
|
|
+ public double dolphinNaturallyAggressiveToPlayersChance = 0.0D;
|
|
private void dolphinSettings() {
|
|
dolphinRidable = getBoolean("mobs.dolphin.ridable", dolphinRidable);
|
|
dolphinSpitCooldown = getInt("mobs.dolphin.spit.cooldown", dolphinSpitCooldown);
|
|
@@ -1182,6 +1183,7 @@ public class PurpurWorldConfig {
|
|
dolphinMaxHealth = getDouble("mobs.dolphin.attributes.max_health", dolphinMaxHealth);
|
|
dolphinDisableTreasureSearching = getBoolean("mobs.dolphin.disable-treasure-searching", dolphinDisableTreasureSearching);
|
|
dolphinTakeDamageFromWater = getBoolean("mobs.dolphin.takes-damage-from-water", dolphinTakeDamageFromWater);
|
|
+ dolphinNaturallyAggressiveToPlayersChance = getDouble("mobs.dolphin.naturally-aggressive-to-players-chance", dolphinNaturallyAggressiveToPlayersChance);
|
|
}
|
|
|
|
public boolean donkeyRidableInWater = false;
|