mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Upstream has released updates that appears to apply and compile correctly Paper Changes: 55e2de5c6 Improve per player mob spawning (#3971) 42433c262 Updated Upstream (Bukkit/CraftBukkit) (#3980) e5ede546a Fix IDE Debug JVM Flag for 1.16 (#3983) 2712c6888 [Auto] Updated Upstream (Bukkit/CraftBukkit) 0901ffd04 Use title packet for actionbar methods (#3959) 2e11235d1 Expand MaterialTags (#3964) cc25ae47c Amend last commit to fix decompile error forgot to commit f503db37c Fix AdvancementDataPlayer leak due from quitting early in login 282763b88 Fix SPIGOT-5885 Unable to disable advancements 9b93d122e Fix SPIGOT-5824 Bukkit world-container is not used bede4d304 Load config files early on Tuinity Changes: b0673b3 Merge dev/optimise-notify into ver/1.16 d3dc35c Name craft scheduler threads according to the plugin using them
189 lines
9.3 KiB
Diff
189 lines
9.3 KiB
Diff
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/src/main/java/net/minecraft/server/AttributeMapBase.java b/src/main/java/net/minecraft/server/AttributeMapBase.java
|
|
index c57e23e16..92aa104dc 100644
|
|
--- a/src/main/java/net/minecraft/server/AttributeMapBase.java
|
|
+++ b/src/main/java/net/minecraft/server/AttributeMapBase.java
|
|
@@ -41,6 +41,7 @@ public class AttributeMapBase {
|
|
}).collect(Collectors.toList());
|
|
}
|
|
|
|
+ @Nullable public AttributeModifiable getAttribute(AttributeBase attributebase) { return a(attributebase); } // Purpur - OBFHELPER
|
|
@Nullable
|
|
public AttributeModifiable a(AttributeBase attributebase) {
|
|
return (AttributeModifiable) this.b.computeIfAbsent(attributebase, (attributebase1) -> {
|
|
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
|
index ebbd81a2d..b39cc82bf 100644
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
|
@@ -136,7 +136,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
|
public double D;
|
|
public double E;
|
|
public double F;
|
|
- public float G; public final float getStepHeight() { return this.G; } // Tuinity - OBFHELPER
|
|
+ public float G; public final float getStepHeight() { return this.G; } public void setStepHeight(float stepHeight) { this.G = stepHeight; } // Tuinity - OBFHELPER // Purpur - OBFHELPER
|
|
public boolean noclip;
|
|
public float I;
|
|
protected final Random random;
|
|
diff --git a/src/main/java/net/minecraft/server/EntityGiantZombie.java b/src/main/java/net/minecraft/server/EntityGiantZombie.java
|
|
index 37618126f..143041003 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityGiantZombie.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityGiantZombie.java
|
|
@@ -4,9 +4,68 @@ public class EntityGiantZombie extends EntityMonster {
|
|
|
|
public EntityGiantZombie(EntityTypes<? extends EntityGiantZombie> entitytypes, World world) {
|
|
super(entitytypes, world);
|
|
- this.safeFallDistance = 10.0F; // Purpur
|
|
+ // Purpur start
|
|
+ this.safeFallDistance = 10.0F;
|
|
+ setStepHeight(world.purpurConfig.giantStepHeight);
|
|
+ // Purpur end
|
|
}
|
|
|
|
+ // Purpur start
|
|
+ @Override
|
|
+ protected void initPathfinder() {
|
|
+ if (world.purpurConfig.giantHaveAI) {
|
|
+ this.goalSelector.a(0, new PathfinderGoalFloat(this));
|
|
+ this.goalSelector.a(7, new PathfinderGoalRandomStrollLand(this, 1.0D));
|
|
+ this.goalSelector.a(8, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 16.0F));
|
|
+ this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this));
|
|
+ this.goalSelector.a(5, new PathfinderGoalMoveTowardsRestriction(this, 1.0D));
|
|
+ if (world.purpurConfig.giantHaveHostileAI) {
|
|
+ this.goalSelector.a(2, new PathfinderGoalMeleeAttack(this, 1.0D, false));
|
|
+ this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this).a(EntityPigZombie.class));
|
|
+ this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, true));
|
|
+ this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityVillager.class, false));
|
|
+ this.targetSelector.a(4, new PathfinderGoalNearestAttackableTarget<>(this, EntityIronGolem.class, true));
|
|
+ this.targetSelector.a(5, new PathfinderGoalNearestAttackableTarget<>(this, EntityTurtle.class, true));
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ protected void initAttributes(World world) {
|
|
+ if (world != null) {
|
|
+ getAttributeMap().getAttribute(GenericAttributes.MAX_HEALTH).setValue(world.purpurConfig.giantMaxHealth);
|
|
+ getAttributeMap().getAttribute(GenericAttributes.MOVEMENT_SPEED).setValue(world.purpurConfig.giantMovementSpeed);
|
|
+ getAttributeMap().getAttribute(GenericAttributes.ATTACK_DAMAGE).setValue(world.purpurConfig.giantAttackDamage);
|
|
+ }
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public GroupDataEntity prepare(GeneratorAccess world, DifficultyDamageScaler difficulty, EnumMobSpawn enummobspawn, GroupDataEntity groupDataEntity, NBTTagCompound nbt) {
|
|
+ GroupDataEntity groupData = super.prepare(world, difficulty, enummobspawn, groupDataEntity, nbt);
|
|
+ if (groupData == null) {
|
|
+ setEquipmentBasedOnDifficulty(difficulty);
|
|
+ setEnchantmentBasedOnDifficulty(difficulty);
|
|
+ }
|
|
+ return groupData;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ protected void setEquipmentBasedOnDifficulty(DifficultyDamageScaler difficulty) {
|
|
+ super.setEquipmentBasedOnDifficulty(difficulty);
|
|
+ // TODO make configurable
|
|
+ if (random.nextFloat() < (world.getDifficulty() == EnumDifficulty.HARD ? 0.1F : 0.05F)) {
|
|
+ setSlot(EnumItemSlot.MAINHAND, new ItemStack(Items.IRON_SWORD));
|
|
+ }
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public float getJumpHeight() {
|
|
+ // 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 world.purpurConfig.giantJumpHeight;
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
@Override
|
|
protected float b(EntityPose entitypose, EntitySize entitysize) {
|
|
return 10.440001F;
|
|
@@ -18,6 +77,6 @@ public class EntityGiantZombie extends EntityMonster {
|
|
|
|
@Override
|
|
public float a(BlockPosition blockposition, IWorldReader iworldreader) {
|
|
- return iworldreader.y(blockposition) - 0.5F;
|
|
+ return super.a(blockposition, iworldreader); // Purpur - fix light requirements for natural spawns
|
|
}
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
|
|
index 605bbf017..93714e5d9 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
|
@@ -939,6 +939,7 @@ public abstract class EntityInsentient extends EntityLiving {
|
|
return f;
|
|
}
|
|
|
|
+ protected void setEquipmentBasedOnDifficulty(DifficultyDamageScaler difficultydamagescaler) { a(difficultydamagescaler); } // Purpur - OBFHELPER
|
|
protected void a(DifficultyDamageScaler difficultydamagescaler) {
|
|
if (this.random.nextFloat() < 0.15F * difficultydamagescaler.d()) {
|
|
int i = this.random.nextInt(2);
|
|
@@ -1046,6 +1047,7 @@ public abstract class EntityInsentient extends EntityLiving {
|
|
}
|
|
}
|
|
|
|
+ protected void setEnchantmentBasedOnDifficulty(DifficultyDamageScaler difficultydamagescaler) { b(difficultydamagescaler); } // Purpur - OBFHELPER
|
|
protected void b(DifficultyDamageScaler difficultydamagescaler) {
|
|
float f = difficultydamagescaler.d();
|
|
|
|
@@ -1078,10 +1080,12 @@ public abstract class EntityInsentient extends EntityLiving {
|
|
} else {
|
|
this.setLeftHanded(false);
|
|
}
|
|
-
|
|
+ initAttributes(world.getMinecraftWorld()); // Purpur
|
|
return groupdataentity;
|
|
}
|
|
|
|
+ protected void initAttributes(World world) {} // Purpur
|
|
+
|
|
public boolean es() {
|
|
return false;
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
index af1fea428..337e58148 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
@@ -2147,7 +2147,7 @@ public abstract class EntityLiving extends Entity {
|
|
this.enderTeleportTo(vec3d.x, vec3d.y, vec3d.z);
|
|
}
|
|
|
|
- protected float dI() {
|
|
+ protected float dI() { return getJumpHeight(); } public float getJumpHeight() { // Purpur - OBFHELPER
|
|
return 0.42F * this.getBlockJumpFactor();
|
|
}
|
|
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
index 88e271574..b1aca6526 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -106,6 +106,23 @@ public class PurpurWorldConfig {
|
|
turtleEggsBreakFromMinecarts = getBoolean("blocks.turtle_egg.break-from-minecarts", turtleEggsBreakFromMinecarts);
|
|
}
|
|
|
|
+ public float giantStepHeight = 2.0F;
|
|
+ public float giantJumpHeight = 1.0F;
|
|
+ public double giantMaxHealth = 100.0D;
|
|
+ public double giantMovementSpeed = 0.5D;
|
|
+ public double giantAttackDamage = 50.0D;
|
|
+ public boolean giantHaveAI = false;
|
|
+ public boolean giantHaveHostileAI = false;
|
|
+ private void giantSettings() {
|
|
+ giantStepHeight = (float) getDouble("mobs.giant.step-height", giantStepHeight);
|
|
+ giantJumpHeight = (float) getDouble("mobs.giant.jump-height", giantJumpHeight);
|
|
+ giantMaxHealth = getDouble("mobs.giant.max-health", giantMaxHealth);
|
|
+ giantMovementSpeed = getDouble("mobs.giant.movement-speed", giantMovementSpeed);
|
|
+ giantAttackDamage = getDouble("mobs.giant.attack-damage", giantAttackDamage);
|
|
+ giantHaveAI = getBoolean("mobs.giant.have-ai", giantHaveAI);
|
|
+ giantHaveHostileAI = getBoolean("mobs.giant.have-hostile-ai", giantHaveHostileAI);
|
|
+ }
|
|
+
|
|
public int villagerBrainTicks = 1;
|
|
public boolean villagerUseBrainTicksOnlyWhenLagging = true;
|
|
private void villagerSettings() {
|