mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-22 19:07:44 +01:00
apply all minecraft feature patches \o/
This commit is contained in:
@@ -0,0 +1,177 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Thu, 26 Mar 2020 21:39:32 -0500
|
||||
Subject: [PATCH] Configurable jockey options
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/monster/Drowned.java b/net/minecraft/world/entity/monster/Drowned.java
|
||||
index 453f9d6e9581165c59b959ea6bccc5387dff91bd..ee13dd20af2730f3051f77fb0e73ce5c8253bd4a 100644
|
||||
--- a/net/minecraft/world/entity/monster/Drowned.java
|
||||
+++ b/net/minecraft/world/entity/monster/Drowned.java
|
||||
@@ -106,6 +106,23 @@ public class Drowned extends Zombie implements RangedAttackMob {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
+ // Purpur start - Configurable jockey options
|
||||
+ @Override
|
||||
+ public boolean jockeyOnlyBaby() {
|
||||
+ return level().purpurConfig.drownedJockeyOnlyBaby;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public double jockeyChance() {
|
||||
+ return level().purpurConfig.drownedJockeyChance;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean jockeyTryExistingChickens() {
|
||||
+ return level().purpurConfig.drownedJockeyTryExistingChickens;
|
||||
+ }
|
||||
+ // Purpur end - Configurable jockey options
|
||||
+
|
||||
@Override
|
||||
protected void addBehaviourGoals() {
|
||||
this.goalSelector.addGoal(1, new Drowned.DrownedGoToWaterGoal(this, 1.0));
|
||||
diff --git a/net/minecraft/world/entity/monster/Husk.java b/net/minecraft/world/entity/monster/Husk.java
|
||||
index 4a617bb6bc3675d8cb42be0b5ae19befd4b3176f..557b2d684936c15299d7082a92ec8b08e7fab9a5 100644
|
||||
--- a/net/minecraft/world/entity/monster/Husk.java
|
||||
+++ b/net/minecraft/world/entity/monster/Husk.java
|
||||
@@ -49,6 +49,23 @@ public class Husk extends Zombie {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
+ // Purpur start - Configurable jockey options
|
||||
+ @Override
|
||||
+ public boolean jockeyOnlyBaby() {
|
||||
+ return level().purpurConfig.huskJockeyOnlyBaby;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public double jockeyChance() {
|
||||
+ return level().purpurConfig.huskJockeyChance;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean jockeyTryExistingChickens() {
|
||||
+ return level().purpurConfig.huskJockeyTryExistingChickens;
|
||||
+ }
|
||||
+ // Purpur end - Configurable jockey options
|
||||
+
|
||||
public static boolean checkHuskSpawnRules(
|
||||
EntityType<Husk> entityType, ServerLevelAccessor level, EntitySpawnReason spawnReason, BlockPos pos, RandomSource random
|
||||
) {
|
||||
diff --git a/net/minecraft/world/entity/monster/Zombie.java b/net/minecraft/world/entity/monster/Zombie.java
|
||||
index 4bad786bee142bd1bc8fc76606829496ce44a455..604653d7748cc0f499071e04d396fef295bbdf9f 100644
|
||||
--- a/net/minecraft/world/entity/monster/Zombie.java
|
||||
+++ b/net/minecraft/world/entity/monster/Zombie.java
|
||||
@@ -128,6 +128,20 @@ public class Zombie extends Monster {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
+ // Purpur start - Configurable jockey options
|
||||
+ public boolean jockeyOnlyBaby() {
|
||||
+ return level().purpurConfig.zombieJockeyOnlyBaby;
|
||||
+ }
|
||||
+
|
||||
+ public double jockeyChance() {
|
||||
+ return level().purpurConfig.zombieJockeyChance;
|
||||
+ }
|
||||
+
|
||||
+ public boolean jockeyTryExistingChickens() {
|
||||
+ return level().purpurConfig.zombieJockeyTryExistingChickens;
|
||||
+ }
|
||||
+ // Purpur end - Configurable jockey options
|
||||
+
|
||||
@Override
|
||||
protected void registerGoals() {
|
||||
this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur - Ridables
|
||||
@@ -557,19 +571,18 @@ public class Zombie extends Monster {
|
||||
}
|
||||
|
||||
if (spawnGroupData instanceof Zombie.ZombieGroupData zombieGroupData) {
|
||||
- if (zombieGroupData.isBaby) {
|
||||
- this.setBaby(true);
|
||||
+ if (!jockeyOnlyBaby() || zombieGroupData.isBaby) { // Purpur - Configurable jockey options
|
||||
+ this.setBaby(zombieGroupData.isBaby); // Purpur - Configurable jockey options
|
||||
if (zombieGroupData.canSpawnJockey) {
|
||||
- if (random.nextFloat() < 0.05) {
|
||||
- List<Chicken> entitiesOfClass = level.getEntitiesOfClass(
|
||||
+ if (random.nextFloat() < jockeyChance()) { // Purpur - Configurable jockey options
|
||||
+ List<Chicken> entitiesOfClass = jockeyTryExistingChickens() ? level.getEntitiesOfClass( // Purpur - Configurable jockey options
|
||||
Chicken.class, this.getBoundingBox().inflate(5.0, 3.0, 5.0), EntitySelector.ENTITY_NOT_BEING_RIDDEN
|
||||
- );
|
||||
+ ) : java.util.Collections.emptyList(); // Purpur - Configurable jockey options
|
||||
if (!entitiesOfClass.isEmpty()) {
|
||||
Chicken chicken = entitiesOfClass.get(0);
|
||||
chicken.setChickenJockey(true);
|
||||
this.startRiding(chicken, false, false);
|
||||
- }
|
||||
- } else if (random.nextFloat() < 0.05) {
|
||||
+ } else { // Purpur - Configurable jockey options
|
||||
Chicken chicken1 = EntityType.CHICKEN.create(this.level(), EntitySpawnReason.JOCKEY);
|
||||
if (chicken1 != null) {
|
||||
chicken1.snapTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F);
|
||||
@@ -578,6 +591,7 @@ public class Zombie extends Monster {
|
||||
this.startRiding(chicken1, false, false);
|
||||
level.addFreshEntity(chicken1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.MOUNT); // CraftBukkit
|
||||
}
|
||||
+ } // Purpur - Configurable jockey options
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/net/minecraft/world/entity/monster/ZombieVillager.java b/net/minecraft/world/entity/monster/ZombieVillager.java
|
||||
index 5a1ba4b80c104806ea8cff4242416951751ee919..04748820e2c78a6d0faa6c4fb4901c7d8b2a8760 100644
|
||||
--- a/net/minecraft/world/entity/monster/ZombieVillager.java
|
||||
+++ b/net/minecraft/world/entity/monster/ZombieVillager.java
|
||||
@@ -102,6 +102,23 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
+ // Purpur start - Configurable jockey options
|
||||
+ @Override
|
||||
+ public boolean jockeyOnlyBaby() {
|
||||
+ return level().purpurConfig.zombieVillagerJockeyOnlyBaby;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public double jockeyChance() {
|
||||
+ return level().purpurConfig.zombieVillagerJockeyChance;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean jockeyTryExistingChickens() {
|
||||
+ return level().purpurConfig.zombieVillagerJockeyTryExistingChickens;
|
||||
+ }
|
||||
+ // Purpur end - Configurable jockey options
|
||||
+
|
||||
@Override
|
||||
protected void defineSynchedData(SynchedEntityData.Builder builder) {
|
||||
super.defineSynchedData(builder);
|
||||
diff --git a/net/minecraft/world/entity/monster/ZombifiedPiglin.java b/net/minecraft/world/entity/monster/ZombifiedPiglin.java
|
||||
index a6244a3d5d8e48b81147d6aed7ac1126e9ae5d64..325d0f32fd8824dc1c7067eb9c303bdfc122c706 100644
|
||||
--- a/net/minecraft/world/entity/monster/ZombifiedPiglin.java
|
||||
+++ b/net/minecraft/world/entity/monster/ZombifiedPiglin.java
|
||||
@@ -89,6 +89,23 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
+ // Purpur start - Configurable jockey options
|
||||
+ @Override
|
||||
+ public boolean jockeyOnlyBaby() {
|
||||
+ return level().purpurConfig.zombifiedPiglinJockeyOnlyBaby;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public double jockeyChance() {
|
||||
+ return level().purpurConfig.zombifiedPiglinJockeyChance;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean jockeyTryExistingChickens() {
|
||||
+ return level().purpurConfig.zombifiedPiglinJockeyTryExistingChickens;
|
||||
+ }
|
||||
+ // Purpur end - Configurable jockey options
|
||||
+
|
||||
@Override
|
||||
public void setPersistentAngerTarget(@Nullable UUID target) {
|
||||
this.persistentAngerTarget = target;
|
||||
Reference in New Issue
Block a user