This commit is contained in:
BillyGalbreath
2021-06-19 16:49:03 -05:00
parent 526a0beb38
commit fe831e6e7f
10 changed files with 299 additions and 304 deletions

View File

@@ -1,7 +1,7 @@
group=net.pl3x.purpur group=net.pl3x.purpur
version=1.17-R0.1-SNAPSHOT version=1.17-R0.1-SNAPSHOT
packageVersion=1_17_R1 packageVersion=1_17_R1
paperCommit=3d43c5e50077ac7fa1e68cf7a7add0ac77768a61 paperCommit=bc4b23e389a80d3f5228688060cf1f610f58ea43
org.gradle.parallel=true org.gradle.parallel=true
org.gradle.jvmargs=-Xmx3G org.gradle.jvmargs=-Xmx3G

View File

@@ -1,124 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <blake.galbreath@gmail.com>
Date: Sun, 22 Nov 2020 20:13:27 -0600
Subject: [PATCH] Kelp weeping and twisting vines configurable max growth age
diff --git a/src/main/java/net/minecraft/world/level/block/BlockGrowingTop.java b/src/main/java/net/minecraft/world/level/block/BlockGrowingTop.java
index 546c7877647bac41753a600bd25c630a0510be56..3d6a1131a138114424b683a81d04478e92d05544 100644
--- a/src/main/java/net/minecraft/world/level/block/BlockGrowingTop.java
+++ b/src/main/java/net/minecraft/world/level/block/BlockGrowingTop.java
@@ -30,7 +30,7 @@ public abstract class BlockGrowingTop extends BlockGrowingAbstract implements IB
@Override
public IBlockData a(GeneratorAccess generatoraccess) {
- return (IBlockData) this.getBlockData().set(BlockGrowingTop.d, generatoraccess.getRandom().nextInt(25));
+ return (IBlockData) this.getBlockData().set(BlockGrowingTop.d, generatoraccess.getRandom().nextInt(getMaxGrowthAge(generatoraccess.getMinecraftWorld()))); // Purpur
}
@Override
@@ -40,9 +40,11 @@ public abstract class BlockGrowingTop extends BlockGrowingAbstract implements IB
public abstract double getGrowthModifier(WorldServer worldserver); // Purpur
+ public abstract int getMaxGrowthAge(WorldServer worldserver); // Purpur
+
@Override
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
- if ((Integer) iblockdata.get(BlockGrowingTop.d) < 25 && random.nextDouble() < (100.0D / getGrowthModifier(worldserver)) * this.e) { // Spigot // Purpur
+ if ((Integer) iblockdata.get(BlockGrowingTop.d) < getMaxGrowthAge(worldserver) && random.nextDouble() < (100.0D / getGrowthModifier(worldserver)) * this.e) { // Spigot // Purpur
BlockPosition blockposition1 = blockposition.shift(this.a);
if (this.h(worldserver.getType(blockposition1))) {
@@ -87,13 +89,13 @@ public abstract class BlockGrowingTop extends BlockGrowingAbstract implements IB
@Override
public void a(WorldServer worldserver, Random random, BlockPosition blockposition, IBlockData iblockdata) {
BlockPosition blockposition1 = blockposition.shift(this.a);
- int i = Math.min((Integer) iblockdata.get(BlockGrowingTop.d) + 1, 25);
+ int i = Math.min((Integer) iblockdata.get(BlockGrowingTop.d) + 1, getMaxGrowthAge(worldserver)); // Purpur
int j = this.a(random);
for (int k = 0; k < j && this.h(worldserver.getType(blockposition1)); ++k) {
worldserver.setTypeUpdate(blockposition1, (IBlockData) iblockdata.set(BlockGrowingTop.d, i));
blockposition1 = blockposition1.shift(this.a);
- i = Math.min(i + 1, 25);
+ i = Math.min(i + 1, getMaxGrowthAge(worldserver)); // Purpur
}
}
diff --git a/src/main/java/net/minecraft/world/level/block/BlockKelp.java b/src/main/java/net/minecraft/world/level/block/BlockKelp.java
index 27f1cbe8786d7c37d62193a21baf0a2bdc6f0294..90ad39d40e4f979126d80c70df292e01e07ed793 100644
--- a/src/main/java/net/minecraft/world/level/block/BlockKelp.java
+++ b/src/main/java/net/minecraft/world/level/block/BlockKelp.java
@@ -72,5 +72,9 @@ public class BlockKelp extends BlockGrowingTop implements IFluidContainer {
public double getGrowthModifier(WorldServer worldserver) {
return worldserver.spigotConfig.kelpModifier;
}
+
+ public int getMaxGrowthAge(WorldServer worldserver) {
+ return worldserver.purpurConfig.kelpMaxGrowthAge;
+ }
// Purpur end
}
diff --git a/src/main/java/net/minecraft/world/level/block/BlockTwistingVines.java b/src/main/java/net/minecraft/world/level/block/BlockTwistingVines.java
index 3a8d08a1ee8f066cea36e6acff492e5af62993c5..d95151d50d2652e5f1b215267c898402f0b28829 100644
--- a/src/main/java/net/minecraft/world/level/block/BlockTwistingVines.java
+++ b/src/main/java/net/minecraft/world/level/block/BlockTwistingVines.java
@@ -34,5 +34,9 @@ public class BlockTwistingVines extends BlockGrowingTop {
public double getGrowthModifier(WorldServer worldserver) {
return worldserver.purpurConfig.twistingVinesGrowthModifier;
}
+
+ public int getMaxGrowthAge(WorldServer worldserver) {
+ return worldserver.purpurConfig.twistingVinesMaxGrowthAge;
+ }
// Purpur end
}
diff --git a/src/main/java/net/minecraft/world/level/block/BlockWeepingVines.java b/src/main/java/net/minecraft/world/level/block/BlockWeepingVines.java
index 198bd8857571872ed3f7437529c330dceeb825db..a71f97e87ee7210f3246e542dd768403905f7679 100644
--- a/src/main/java/net/minecraft/world/level/block/BlockWeepingVines.java
+++ b/src/main/java/net/minecraft/world/level/block/BlockWeepingVines.java
@@ -34,5 +34,9 @@ public class BlockWeepingVines extends BlockGrowingTop {
public double getGrowthModifier(WorldServer worldserver) {
return worldserver.purpurConfig.weepingVinesGrowthModifier;
}
+
+ public int getMaxGrowthAge(WorldServer worldserver) {
+ return worldserver.purpurConfig.weepingVinesMaxGrowthAge;
+ }
// Purpur end
}
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 17bbe2ceea016bcb00dc5542bea47e083e723ea5..221b6d3c98afe1c72481a922ac7eeff9801d8c2f 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -424,6 +424,11 @@ public class PurpurWorldConfig {
furnaceInfiniteFuel = getBoolean("blocks.furnace.infinite-fuel", furnaceInfiniteFuel);
}
+ public int kelpMaxGrowthAge = 25;
+ private void kelpSettings() {
+ kelpMaxGrowthAge = getInt("blocks.kelp.max-growth-age", kelpMaxGrowthAge);
+ }
+
public boolean lavaInfinite = false;
public int lavaInfiniteRequiredSources = 2;
public int lavaSpeedNether = 10;
@@ -478,13 +483,17 @@ public class PurpurWorldConfig {
}
public double twistingVinesGrowthModifier = 0.10D;
+ public int twistingVinesMaxGrowthAge = 25;
private void twistingVinesSettings() {
twistingVinesGrowthModifier = getDouble("blocks.twisting_vines.growth-modifier", twistingVinesGrowthModifier);
+ twistingVinesMaxGrowthAge = getInt("blocks.twisting_vines.max-growth-age", twistingVinesMaxGrowthAge);
}
public double weepingVinesGrowthModifier = 0.10D;
+ public int weepingVinesMaxGrowthAge = 25;
private void weepingVinesSettings() {
weepingVinesGrowthModifier = getDouble("blocks.weeping_vines.growth-modifier", weepingVinesGrowthModifier);
+ weepingVinesMaxGrowthAge = getInt("blocks.weeping_vines.max-growth-age", weepingVinesMaxGrowthAge);
}
public boolean babiesAreRidable = true;

View File

@@ -1,39 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
Date: Sun, 22 Nov 2020 22:17:53 -0800
Subject: [PATCH] Add config for allowing Endermen to despawn even while
holding a block
This should help to reduce the amount of dirt, gravel, grass, and etc.
that Endermen like to randomly place all over the world.
diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java b/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java
index a15dbd76e1d1afae7eb3809ef2e0448d8e2ab8e6..cae2b2139e398dd26e9562636f06e096b3e028ae 100644
--- a/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java
+++ b/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java
@@ -427,7 +427,7 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable {
@Override
public boolean isSpecialPersistence() {
- return super.isSpecialPersistence() || this.getCarried() != null;
+ return super.isSpecialPersistence() || (!this.world.purpurConfig.endermanDespawnEvenWithBlock && this.getCarried() != null); // Purpur
}
static class PathfinderGoalEndermanPickupBlock extends PathfinderGoal {
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 221b6d3c98afe1c72481a922ac7eeff9801d8c2f..3b9898ee7ae0fb826cfc3102d3b84bc5323d163d 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -646,10 +646,12 @@ public class PurpurWorldConfig {
public boolean endermanRidable = false;
public boolean endermanRidableInWater = false;
public boolean endermanAllowGriefing = true;
+ public boolean endermanDespawnEvenWithBlock = false;
private void endermanSettings() {
endermanRidable = getBoolean("mobs.enderman.ridable", endermanRidable);
endermanRidableInWater = getBoolean("mobs.enderman.ridable-in-water", endermanRidableInWater);
endermanAllowGriefing = getBoolean("mobs.enderman.allow-griefing", endermanAllowGriefing);
+ endermanDespawnEvenWithBlock = getBoolean("mobs.enderman.can-despawn-with-held-block", endermanDespawnEvenWithBlock);
}
public boolean endermiteRidable = false;

View File

@@ -1,35 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <blake.galbreath@gmail.com>
Date: Tue, 24 Nov 2020 05:32:02 -0600
Subject: [PATCH] Add configurable snowball damage
diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntitySnowball.java b/src/main/java/net/minecraft/world/entity/projectile/EntitySnowball.java
index 0d3b9c81e47eef645335e49a1d6d88db7338aa4b..6bfd3f57e6c04ed426870d6dbf068bf324f22d6e 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/EntitySnowball.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/EntitySnowball.java
@@ -40,7 +40,7 @@ public class EntitySnowball extends EntityProjectileThrowable {
protected void a(MovingObjectPositionEntity movingobjectpositionentity) {
super.a(movingobjectpositionentity);
Entity entity = movingobjectpositionentity.getEntity();
- int i = entity instanceof EntityBlaze ? 3 : 0;
+ int i = entity.world.purpurConfig.snowballDamage >= 0 ? entity.world.purpurConfig.snowballDamage : entity instanceof EntityBlaze ? 3 : 0; // Purpur
entity.damageEntity(DamageSource.projectile(this, this.getShooter()), (float) i);
}
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 3b9898ee7ae0fb826cfc3102d3b84bc5323d163d..b6a3d73dc0866d98b00f52d65a39646ab001a1f2 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -258,6 +258,11 @@ public class PurpurWorldConfig {
witherSkullDespawnRate = getInt("gameplay-mechanics.projectile-despawn-rates.wither_skull", witherSkullDespawnRate);
}
+ public int snowballDamage = -1;
+ private void snowballSettings() {
+ snowballDamage = getInt("gameplay-mechanics.projectile-damage.snowball", snowballDamage);
+ }
+
public boolean useBetterMending = false;
public boolean boatEjectPlayersOnLand = false;
public boolean disableDropsOnCrammingDeath = false;

View File

@@ -1,83 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <blake.galbreath@gmail.com>
Date: Fri, 27 Nov 2020 10:33:33 -0600
Subject: [PATCH] Zombie break door minimum difficulty option
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalBreakDoor.java b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalBreakDoor.java
index 10ee8a0a717354f50b29e7ebeab0ee2aa7bf42f7..d785066e2a52699c18315f7244d80db6cab0c736 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalBreakDoor.java
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalBreakDoor.java
@@ -3,7 +3,9 @@ package net.minecraft.world.entity.ai.goal;
import java.util.function.Predicate;
import net.minecraft.core.IPosition;
import net.minecraft.world.EnumDifficulty;
+import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityInsentient;
+import net.minecraft.world.entity.monster.EntityZombie;
import net.minecraft.world.level.GameRules;
import net.minecraft.world.level.block.Block;
@@ -18,7 +20,7 @@ public class PathfinderGoalBreakDoor extends PathfinderGoalDoorInteract {
super(entityinsentient);
this.b = -1;
this.c = -1;
- this.g = predicate;
+ this.g = entityinsentient instanceof EntityZombie ? difficulty -> testDifficulty(entity) : predicate; // Purpur
}
public PathfinderGoalBreakDoor(EntityInsentient entityinsentient, int i, Predicate<EnumDifficulty> predicate) {
@@ -87,4 +89,21 @@ public class PathfinderGoalBreakDoor extends PathfinderGoalDoorInteract {
private boolean a(EnumDifficulty enumdifficulty) {
return this.g.test(enumdifficulty);
}
+
+ // Purpur start
+ private boolean testDifficulty(Entity entity) {
+ EnumDifficulty difficulty = entity.world.getDifficulty();
+ switch (entity.world.purpurConfig.zombieBreakDoorMinDifficulty) {
+ case PEACEFUL:
+ return difficulty == EnumDifficulty.HARD || difficulty == EnumDifficulty.NORMAL || difficulty == EnumDifficulty.EASY || difficulty == EnumDifficulty.PEACEFUL;
+ case EASY:
+ return difficulty == EnumDifficulty.HARD || difficulty == EnumDifficulty.NORMAL || difficulty == EnumDifficulty.EASY;
+ case NORMAL:
+ return difficulty == EnumDifficulty.HARD || difficulty == EnumDifficulty.NORMAL;
+ case HARD:
+ default:
+ return difficulty == EnumDifficulty.HARD;
+ }
+ }
+ // Purpur end
}
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index b6a3d73dc0866d98b00f52d65a39646ab001a1f2..1ea011a2fbf6b6d2b7f9ff59e86303d17d130831 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -1,6 +1,7 @@
package net.pl3x.purpur;
import net.minecraft.core.IRegistry;
+import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.level.Explosion;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
@@ -1190,6 +1191,7 @@ public class PurpurWorldConfig {
public double zombieJockeyChance = 0.05D;
public boolean zombieJockeyTryExistingChickens = true;
public boolean zombieAggressiveTowardsVillagerWhenLagging = true;
+ public EnumDifficulty zombieBreakDoorMinDifficulty = EnumDifficulty.HARD;
private void zombieSettings() {
zombieRidable = getBoolean("mobs.zombie.ridable", zombieRidable);
zombieRidableInWater = getBoolean("mobs.zombie.ridable-in-water", zombieRidableInWater);
@@ -1197,6 +1199,11 @@ public class PurpurWorldConfig {
zombieJockeyChance = getDouble("mobs.zombie.jockey.chance", zombieJockeyChance);
zombieJockeyTryExistingChickens = getBoolean("mobs.zombie.jockey.try-existing-chickens", zombieJockeyTryExistingChickens);
zombieAggressiveTowardsVillagerWhenLagging = getBoolean("mobs.zombie.aggressive-towards-villager-when-lagging", zombieAggressiveTowardsVillagerWhenLagging);
+ try {
+ zombieBreakDoorMinDifficulty = EnumDifficulty.valueOf(getString("mobs.zombie.break-door-minimum-difficulty", zombieBreakDoorMinDifficulty.name()));
+ } catch (IllegalArgumentException ignore) {
+ zombieBreakDoorMinDifficulty = EnumDifficulty.HARD;
+ }
}
public boolean zombieHorseCanSwim = false;

View File

@@ -0,0 +1,124 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <blake.galbreath@gmail.com>
Date: Sat, 19 Jun 2021 16:27:24 -0500
Subject: [PATCH] Kelp weeping and twisting vines configurable max growth age
diff --git a/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java b/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java
index 9f1d43ad720750f9d50cc3cfbe1fc9b335cffd0d..1c3284f8bf7923361797a73077af0699fa58db29 100644
--- a/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java
@@ -31,7 +31,7 @@ public abstract class GrowingPlantHeadBlock extends GrowingPlantBlock implements
@Override
public BlockState getStateForPlacement(LevelAccessor world) {
- return (BlockState) this.defaultBlockState().setValue(GrowingPlantHeadBlock.AGE, world.getRandom().nextInt(25));
+ return (BlockState) this.defaultBlockState().setValue(GrowingPlantHeadBlock.AGE, world.getRandom().nextInt(getMaxGrowthAge(world.getMinecraftWorld()))); // Purpur
}
@Override
@@ -41,9 +41,11 @@ public abstract class GrowingPlantHeadBlock extends GrowingPlantBlock implements
public abstract double getGrowthModifier(ServerLevel world); // Purpur
+ public abstract int getMaxGrowthAge(ServerLevel world); // Purpur
+
@Override
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
- if (state.getValue(GrowingPlantHeadBlock.AGE) < 25 && random.nextDouble() < (100.0D / this.getGrowthModifier(world)) * this.growPerTickProbability) { // Spigot // Purpur
+ if (state.getValue(GrowingPlantHeadBlock.AGE) < getMaxGrowthAge(world) && random.nextDouble() < (100.0D / this.getGrowthModifier(world)) * this.growPerTickProbability) { // Spigot // Purpur
BlockPos blockposition1 = pos.relative(this.growthDirection);
if (this.canGrowInto(world.getBlockState(blockposition1))) {
@@ -96,13 +98,13 @@ public abstract class GrowingPlantHeadBlock extends GrowingPlantBlock implements
@Override
public void performBonemeal(ServerLevel world, Random random, BlockPos pos, BlockState state) {
BlockPos blockposition1 = pos.relative(this.growthDirection);
- int i = Math.min((Integer) state.getValue(GrowingPlantHeadBlock.AGE) + 1, 25);
+ int i = Math.min((Integer) state.getValue(GrowingPlantHeadBlock.AGE) + 1, getMaxGrowthAge(world)); // Purpur
int j = this.getBlocksToGrowWhenBonemealed(random);
for (int k = 0; k < j && this.canGrowInto(world.getBlockState(blockposition1)); ++k) {
world.setBlockAndUpdate(blockposition1, (BlockState) state.setValue(GrowingPlantHeadBlock.AGE, i));
blockposition1 = blockposition1.relative(this.growthDirection);
- i = Math.min(i + 1, 25);
+ i = Math.min(i + 1, getMaxGrowthAge(world)); // Purpur
}
}
diff --git a/src/main/java/net/minecraft/world/level/block/KelpBlock.java b/src/main/java/net/minecraft/world/level/block/KelpBlock.java
index 5f9a8dd6b4f7c9285ffcce8bbe0e334a28cc9699..486a62617b594b66341fb9ef2f88c3f328cb943d 100644
--- a/src/main/java/net/minecraft/world/level/block/KelpBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/KelpBlock.java
@@ -69,5 +69,9 @@ public class KelpBlock extends GrowingPlantHeadBlock implements LiquidBlockConta
public double getGrowthModifier(net.minecraft.server.level.ServerLevel world) {
return world.spigotConfig.kelpModifier;
}
+
+ public int getMaxGrowthAge(net.minecraft.server.level.ServerLevel world) {
+ return world.purpurConfig.kelpMaxGrowthAge;
+ }
// Purpur end
}
diff --git a/src/main/java/net/minecraft/world/level/block/TwistingVinesBlock.java b/src/main/java/net/minecraft/world/level/block/TwistingVinesBlock.java
index c877f7e4e55c63d91ce58c15850e279be3e159a7..c8ca3b9da2df89540a80c08042ca9aee28f274ea 100644
--- a/src/main/java/net/minecraft/world/level/block/TwistingVinesBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/TwistingVinesBlock.java
@@ -32,5 +32,9 @@ public class TwistingVinesBlock extends GrowingPlantHeadBlock {
public double getGrowthModifier(net.minecraft.server.level.ServerLevel world) {
return world.purpurConfig.twistingVinesGrowthModifier;
}
+
+ public int getMaxGrowthAge(net.minecraft.server.level.ServerLevel world) {
+ return world.purpurConfig.twistingVinesMaxGrowthAge;
+ }
// Purpur end
}
diff --git a/src/main/java/net/minecraft/world/level/block/WeepingVinesBlock.java b/src/main/java/net/minecraft/world/level/block/WeepingVinesBlock.java
index d2cb1a7e7ea364cb8e2af4c4e756d8e45bc0ca10..bb99dda3c5167f23b2500a1f37cbc1ca285f123a 100644
--- a/src/main/java/net/minecraft/world/level/block/WeepingVinesBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/WeepingVinesBlock.java
@@ -32,5 +32,9 @@ public class WeepingVinesBlock extends GrowingPlantHeadBlock {
public double getGrowthModifier(net.minecraft.server.level.ServerLevel world) {
return world.purpurConfig.weepingVinesGrowthModifier;
}
+
+ public int getMaxGrowthAge(net.minecraft.server.level.ServerLevel world) {
+ return world.purpurConfig.weepingVinesMaxGrowthAge;
+ }
// Purpur end
}
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index f1b0d55f425b3028178323e710991fff481e0ba6..7f78c0b3e5bdcead269c5d169812b3d3d1b3ee33 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -424,6 +424,11 @@ public class PurpurWorldConfig {
lavaSpeedNotNether = getInt("blocks.lava.speed.not-nether", lavaSpeedNotNether);
}
+ public int kelpMaxGrowthAge = 25;
+ private void kelpSettings() {
+ kelpMaxGrowthAge = getInt("blocks.kelp.max-growth-age", kelpMaxGrowthAge);
+ }
+
public boolean respawnAnchorExplode = true;
public double respawnAnchorExplosionPower = 5.0D;
public boolean respawnAnchorExplosionFire = true;
@@ -458,13 +463,17 @@ public class PurpurWorldConfig {
}
public double twistingVinesGrowthModifier = 0.10D;
+ public int twistingVinesMaxGrowthAge = 25;
private void twistingVinesSettings() {
twistingVinesGrowthModifier = getDouble("blocks.twisting_vines.growth-modifier", twistingVinesGrowthModifier);
+ twistingVinesMaxGrowthAge = getInt("blocks.twisting_vines.max-growth-age", twistingVinesMaxGrowthAge);
}
public double weepingVinesGrowthModifier = 0.10D;
+ public int weepingVinesMaxGrowthAge = 25;
private void weepingVinesSettings() {
weepingVinesGrowthModifier = getDouble("blocks.weeping_vines.growth-modifier", weepingVinesGrowthModifier);
+ weepingVinesMaxGrowthAge = getInt("blocks.weeping_vines.max-growth-age", weepingVinesMaxGrowthAge);
}
public boolean babiesAreRidable = true;

View File

@@ -0,0 +1,40 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <blake.galbreath@gmail.com>
Date: Sat, 19 Jun 2021 16:29:26 -0500
Subject: [PATCH] Add config for allowing Endermen to despawn even while
holding a block
diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
index 5ebedd6a156b06e98aded57c817f63429a1ae380..c99d295b999a28dd1eb504179250445d1b61d099 100644
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
@@ -429,7 +429,7 @@ public class EnderMan extends Monster implements NeutralMob {
@Override
public boolean requiresCustomPersistence() {
- return super.requiresCustomPersistence() || this.getCarriedBlock() != null;
+ return super.requiresCustomPersistence() || (!this.level.purpurConfig.endermanDespawnEvenWithBlock && this.getCarriedBlock() != null); // Purpur
}
private static class EndermanFreezeWhenLookedAt extends Goal {
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 7f78c0b3e5bdcead269c5d169812b3d3d1b3ee33..f7b7b4702b60103240405db75907cc3b463b8e20 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -759,6 +759,7 @@ public class PurpurWorldConfig {
public boolean endermanRidableInWater = false;
public double endermanMaxHealth = 40.0D;
public boolean endermanAllowGriefing = true;
+ public boolean endermanDespawnEvenWithBlock = false;
private void endermanSettings() {
endermanRidable = getBoolean("mobs.enderman.ridable", endermanRidable);
endermanRidableInWater = getBoolean("mobs.enderman.ridable-in-water", endermanRidableInWater);
@@ -769,6 +770,7 @@ public class PurpurWorldConfig {
}
endermanMaxHealth = getDouble("mobs.enderman.attributes.max_health", endermanMaxHealth);
endermanAllowGriefing = getBoolean("mobs.enderman.allow-griefing", endermanAllowGriefing);
+ endermanDespawnEvenWithBlock = getBoolean("mobs.enderman.can-despawn-with-held-block", endermanDespawnEvenWithBlock);
}
public boolean endermiteRidable = false;

View File

@@ -1,14 +1,14 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <blake.galbreath@gmail.com> From: BillyGalbreath <blake.galbreath@gmail.com>
Date: Tue, 24 Nov 2020 04:30:46 -0600 Date: Sat, 19 Jun 2021 16:34:42 -0500
Subject: [PATCH] Add critical hit check to EntityDamagedByEntityEvent Subject: [PATCH] Add critical hit check to EntityDamagedByEntityEvent
diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 92c086d276662d2de5c8f136a998384d54390b72..4bb40046f1f21bdfeaf10961001e90b1724e00bb 100644 index 3fd54f7d0f3372d83ccd135db44870fbe926c026..62540f8af27709976e109bd79975a9a5cd11c8d3 100644
--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java --- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -169,6 +169,7 @@ public abstract class EntityHuman extends EntityLiving { @@ -182,6 +182,7 @@ public abstract class Player extends LivingEntity {
// Paper start // Paper start
public boolean affectsSpawning = true; public boolean affectsSpawning = true;
// Paper end // Paper end
@@ -16,50 +16,50 @@ index 92c086d276662d2de5c8f136a998384d54390b72..4bb40046f1f21bdfeaf10961001e90b1
// CraftBukkit start // CraftBukkit start
public boolean fauxSleeping; public boolean fauxSleeping;
@@ -1170,6 +1171,7 @@ public abstract class EntityHuman extends EntityLiving { @@ -1237,6 +1238,7 @@ public abstract class Player extends LivingEntity {
flag2 = flag2 && !world.paperConfig.disablePlayerCrits; // Paper flag2 = flag2 && !level.paperConfig.disablePlayerCrits; // Paper
flag2 = flag2 && !this.isSprinting(); flag2 = flag2 && !this.isSprinting();
if (flag2) { if (flag2) {
+ this.isCritical = true; // Purpur + this.isCritical = true; // Purpur
f *= 1.5F; f *= 1.5F;
} }
@@ -1206,6 +1208,7 @@ public abstract class EntityHuman extends EntityLiving { @@ -1273,6 +1275,7 @@ public abstract class Player extends LivingEntity {
Vec3D vec3d = entity.getMot(); Vec3 vec3d = target.getDeltaMovement();
boolean flag5 = entity.damageEntity(DamageSource.playerAttack(this), f); boolean flag5 = target.hurt(DamageSource.playerAttack(this), f);
+ this.isCritical = false; // Purpur + this.isCritical = false; // Purpur
if (flag5) { if (flag5) {
if (i > 0) { if (i > 0) {
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index c4218281721cf4a5b8f2cad5e12089e3aee89737..c07ff0cc7cae358c3fd772d24c2944cc92e1acff 100644 index d055b5548848c87d9ce8372b6c64df8d081eb779..f8ae2647237027e409e7e111cddce1883dec7bfd 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -962,7 +962,7 @@ public class CraftEventFactory { @@ -952,7 +952,7 @@ public class CraftEventFactory {
} else { } else {
damageCause = DamageCause.ENTITY_EXPLOSION; damageCause = DamageCause.ENTITY_EXPLOSION;
} }
- event = new EntityDamageByEntityEvent(damager.getBukkitEntity(), entity.getBukkitEntity(), damageCause, modifiers, modifierFunctions); - event = new EntityDamageByEntityEvent(damager.getBukkitEntity(), entity.getBukkitEntity(), damageCause, modifiers, modifierFunctions);
+ event = new EntityDamageByEntityEvent(damager.getBukkitEntity(), entity.getBukkitEntity(), damageCause, modifiers, modifierFunctions, damager instanceof HumanEntity && ((EntityHuman)damager).isCritical); // Purpur + event = new EntityDamageByEntityEvent(damager.getBukkitEntity(), entity.getBukkitEntity(), damageCause, modifiers, modifierFunctions, damager instanceof HumanEntity && ((net.minecraft.world.entity.player.Player) damager).isCritical); // Purpur
damager.processClick(EnumHand.MAIN_HAND); // Purpur damager.processClick(InteractionHand.MAIN_HAND); // Purpur
} }
event.setCancelled(cancelled); event.setCancelled(cancelled);
@@ -1042,7 +1042,7 @@ public class CraftEventFactory { @@ -1031,7 +1031,7 @@ public class CraftEventFactory {
} else { } else {
throw new IllegalStateException(String.format("Unhandled damage of %s by %s from %s", entity, damager.getHandle(), source.translationIndex)); throw new IllegalStateException(String.format("Unhandled damage of %s by %s from %s", entity, damager.getHandle(), source.msgId));
} }
- EntityDamageEvent event = new EntityDamageByEntityEvent(damager, entity.getBukkitEntity(), cause, modifiers, modifierFunctions); - EntityDamageEvent event = new EntityDamageByEntityEvent(damager, entity.getBukkitEntity(), cause, modifiers, modifierFunctions);
+ EntityDamageEvent event = new EntityDamageByEntityEvent(damager, entity.getBukkitEntity(), cause, modifiers, modifierFunctions, entityDamage instanceof HumanEntity && ((EntityHuman)entityDamage).isCritical); // Purpur + EntityDamageEvent event = new EntityDamageByEntityEvent(damager, entity.getBukkitEntity(), cause, modifiers, modifierFunctions, entityDamage instanceof HumanEntity && ((net.minecraft.world.entity.player.Player) entityDamage).isCritical); // Purpur
event.setCancelled(cancelled); event.setCancelled(cancelled);
callEvent(event); CraftEventFactory.callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
@@ -1097,7 +1097,7 @@ public class CraftEventFactory { @@ -1088,7 +1088,7 @@ public class CraftEventFactory {
private static EntityDamageEvent callEntityDamageEvent(Entity damager, Entity damagee, DamageCause cause, Map<DamageModifier, Double> modifiers, Map<DamageModifier, Function<? super Double, Double>> modifierFunctions, boolean cancelled) { private static EntityDamageEvent callEntityDamageEvent(Entity damager, Entity damagee, DamageCause cause, Map<DamageModifier, Double> modifiers, Map<DamageModifier, Function<? super Double, Double>> modifierFunctions, boolean cancelled) {
EntityDamageEvent event; EntityDamageEvent event;
if (damager != null) { if (damager != null) {
- event = new EntityDamageByEntityEvent(damager.getBukkitEntity(), damagee.getBukkitEntity(), cause, modifiers, modifierFunctions); - event = new EntityDamageByEntityEvent(damager.getBukkitEntity(), damagee.getBukkitEntity(), cause, modifiers, modifierFunctions);
+ event = new EntityDamageByEntityEvent(damager.getBukkitEntity(), damagee.getBukkitEntity(), cause, modifiers, modifierFunctions, damager instanceof HumanEntity && ((EntityHuman)damager).isCritical); // Purpur + event = new EntityDamageByEntityEvent(damager.getBukkitEntity(), damagee.getBukkitEntity(), cause, modifiers, modifierFunctions, damager instanceof HumanEntity && ((net.minecraft.world.entity.player.Player) damager).isCritical); // Purpur
damager.processClick(EnumHand.MAIN_HAND); // Purpur damager.processClick(InteractionHand.MAIN_HAND); // Purpur
} else { } else {
event = new EntityDamageEvent(damagee.getBukkitEntity(), cause, modifiers, modifierFunctions); event = new EntityDamageEvent(damagee.getBukkitEntity(), cause, modifiers, modifierFunctions);

View File

@@ -0,0 +1,35 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <blake.galbreath@gmail.com>
Date: Sat, 19 Jun 2021 16:37:38 -0500
Subject: [PATCH] Add configurable snowball damage
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Snowball.java b/src/main/java/net/minecraft/world/entity/projectile/Snowball.java
index ed2f039c4042861bcfa2e41d8281eefd37daa9fa..d5d84893c77b4e60a19032d765d76bfd24cbbb2b 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/Snowball.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/Snowball.java
@@ -54,7 +54,7 @@ public class Snowball extends ThrowableItemProjectile {
protected void onHitEntity(EntityHitResult entityHitResult) {
super.onHitEntity(entityHitResult);
Entity entity = entityHitResult.getEntity();
- int i = entity instanceof Blaze ? 3 : 0;
+ int i = entity.level.purpurConfig.snowballDamage >= 0 ? entity.level.purpurConfig.snowballDamage : entity instanceof Blaze ? 3 : 0; // Purpur
entity.hurt(DamageSource.thrown(this, this.getOwner()), (float)i);
}
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index f7b7b4702b60103240405db75907cc3b463b8e20..6b8a664df100b391d897c992d6fa2ceb759b5523 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -270,6 +270,11 @@ public class PurpurWorldConfig {
totemOfUndyingWorksInInventory = getBoolean("gameplay-mechanics.player.totem-of-undying-works-in-inventory", totemOfUndyingWorksInInventory);
}
+ public int snowballDamage = -1;
+ private void snowballSettings() {
+ snowballDamage = getInt("gameplay-mechanics.projectile-damage.snowball", snowballDamage);
+ }
+
public int dragonFireballDespawnRate = -1;
public int eggDespawnRate = -1;
public int enderPearlDespawnRate = -1;

View File

@@ -0,0 +1,77 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <blake.galbreath@gmail.com>
Date: Sat, 19 Jun 2021 16:47:15 -0500
Subject: [PATCH] Zombie break door minimum difficulty option
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java
index fe045f8e35fe2aac51032a67ce52b27a53a8eff0..03bc86c776596ca5964c22adb757115d60980311 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java
@@ -7,6 +7,8 @@ import net.minecraft.world.entity.Mob;
import net.minecraft.world.level.GameRules;
import net.minecraft.world.level.block.Block;
+import static net.minecraft.world.Difficulty.*; // Purpur
+
public class BreakDoorGoal extends DoorInteractGoal {
private static final int DEFAULT_DOOR_BREAK_TIME = 240;
@@ -19,7 +21,7 @@ public class BreakDoorGoal extends DoorInteractGoal {
super(mob);
this.lastBreakProgress = -1;
this.doorBreakTime = -1;
- this.validDifficulties = difficultySufficientPredicate;
+ this.validDifficulties = mob instanceof net.minecraft.world.entity.monster.Zombie ? difficulty -> testDifficulty(mob) : difficultySufficientPredicate; // Purpur
}
public BreakDoorGoal(Mob mob, int maxProgress, Predicate<Difficulty> difficultySufficientPredicate) {
@@ -88,4 +90,16 @@ public class BreakDoorGoal extends DoorInteractGoal {
private boolean isValidDifficulty(Difficulty difficulty) {
return this.validDifficulties.test(difficulty);
}
+
+ // Purpur start
+ private boolean testDifficulty(Mob entity) {
+ Difficulty d = entity.level.getDifficulty();
+ return switch (entity.level.purpurConfig.zombieBreakDoorMinDifficulty) {
+ case PEACEFUL -> d == HARD || d == NORMAL || d == EASY || d == PEACEFUL;
+ case EASY -> d == HARD || d == NORMAL || d == EASY;
+ case NORMAL -> d == HARD || d == NORMAL;
+ default -> d == HARD;
+ };
+ }
+ // Purpur end
}
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 6b8a664df100b391d897c992d6fa2ceb759b5523..ee68bc02ed398ef61a29bee9d5be728ec730133c 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -2,6 +2,7 @@ package net.pl3x.purpur;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceLocation;
+import net.minecraft.world.Difficulty;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Explosion;
@@ -1748,6 +1749,7 @@ public class PurpurWorldConfig {
public double zombieJockeyChance = 0.05D;
public boolean zombieJockeyTryExistingChickens = true;
public boolean zombieAggressiveTowardsVillagerWhenLagging = true;
+ public Difficulty zombieBreakDoorMinDifficulty = Difficulty.HARD;
private void zombieSettings() {
zombieRidable = getBoolean("mobs.zombie.ridable", zombieRidable);
zombieRidableInWater = getBoolean("mobs.zombie.ridable-in-water", zombieRidableInWater);
@@ -1762,6 +1764,11 @@ public class PurpurWorldConfig {
zombieJockeyChance = getDouble("mobs.zombie.jockey.chance", zombieJockeyChance);
zombieJockeyTryExistingChickens = getBoolean("mobs.zombie.jockey.try-existing-chickens", zombieJockeyTryExistingChickens);
zombieAggressiveTowardsVillagerWhenLagging = getBoolean("mobs.zombie.aggressive-towards-villager-when-lagging", zombieAggressiveTowardsVillagerWhenLagging);
+ try {
+ zombieBreakDoorMinDifficulty = Difficulty.valueOf(getString("mobs.zombie.break-door-minimum-difficulty", zombieBreakDoorMinDifficulty.name()));
+ } catch (IllegalArgumentException ignore) {
+ zombieBreakDoorMinDifficulty = Difficulty.HARD;
+ }
}
public boolean zombieHorseRidableInWater = false;