Skip to content

Commit

Permalink
Fix #56 Fix #50 - Ridable baby and tameable settings
Browse files Browse the repository at this point in the history
  • Loading branch information
BillyGalbreath committed Sep 14, 2020
1 parent 8ec6f6f commit 8767574
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 13 deletions.
38 changes: 27 additions & 11 deletions patches/server/0119-Ridables.patch
Expand Up @@ -2199,7 +2199,7 @@ index f5c9e4e0a..5e6c7e317 100644
this.targetSelector.a(2, (new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, true)).a(300));
this.targetSelector.a(3, (new PathfinderGoalNearestAttackableTarget<>(this, EntityVillagerAbstract.class, false)).a(300));
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index 7465e867b..0dc811ff7 100644
index 7465e867b..2bda9d6c6 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -29,7 +29,7 @@ public abstract class EntityInsentient extends EntityLiving {
Expand Down Expand Up @@ -2264,7 +2264,7 @@ index 7465e867b..0dc811ff7 100644
}

public boolean ev() {
@@ -1614,4 +1617,45 @@ public abstract class EntityInsentient extends EntityLiving {
@@ -1614,4 +1617,54 @@ public abstract class EntityInsentient extends EntityLiving {
this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
this.unleash(true, false);
}
Expand Down Expand Up @@ -2295,6 +2295,15 @@ index 7465e867b..0dc811ff7 100644
+ if (tameable.isTamed() && !tameable.isOwner(entityhuman)) {
+ return EnumInteractionResult.PASS;
+ }
+ if (!tameable.isTamed() && !world.purpurConfig.untamedTamablesAreRidable) {
+ return EnumInteractionResult.PASS;
+ }
+ }
+ if (this instanceof EntityAgeable) {
+ EntityAgeable ageable = (EntityAgeable) this;
+ if (ageable.isBaby() && !world.purpurConfig.babiesAreRidable) {
+ return EnumInteractionResult.PASS;
+ }
+ }
+ if (!entityhuman.getBukkitEntity().hasPermission("allow.ride." + getEntityType().getName())) {
+ entityhuman.sendMessage(net.pl3x.purpur.PurpurConfig.cannotRideMob);
Expand Down Expand Up @@ -4864,7 +4873,7 @@ index 0bac6b050..9a17eb606 100644
Entity entity1 = this.getShooter();
// Paper start - Cancel hit for vanished players
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index a8ec01687..f07e2d285 100644
index 1ff07a08d..5b5e9211c 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -2149,6 +2149,8 @@ public class PlayerConnection implements PacketListenerPlayIn {
Expand Down Expand Up @@ -4950,7 +4959,7 @@ index 8714d1574..af3739c79 100644

public static int dungeonSeed = -1;
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index b070eed98..a58f07b4b 100644
index b070eed98..a0684f16c 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -42,11 +42,6 @@ public class PurpurWorldConfig {
Expand All @@ -4965,10 +4974,17 @@ index b070eed98..a58f07b4b 100644
private ConfigurationSection getConfigurationSection(String path) {
ConfigurationSection section = PurpurConfig.config.getConfigurationSection("world-settings." + worldName + "." + path);
return section != null ? section : PurpurConfig.config.getConfigurationSection("world-settings.default." + path);
@@ -317,65 +312,181 @@ public class PurpurWorldConfig {
@@ -317,65 +312,188 @@ public class PurpurWorldConfig {
turtleEggsBreakFromMinecarts = getBoolean("blocks.turtle_egg.break-from-minecarts", turtleEggsBreakFromMinecarts);
}

+ public boolean babiesAreRidable = true;
+ public boolean untamedTamablesAreRidable = true;
+ private void ridableSettings() {
+ babiesAreRidable = getBoolean("ridable-settings.babies-are-ridable", babiesAreRidable);
+ untamedTamablesAreRidable = getBoolean("ridable-settings.untamed-tamables-are-ridable", untamedTamablesAreRidable);
+ }
+
+ public boolean batRidable = false;
+ public boolean batRidableInWater = false;
+ public double batMaxY = 256D;
Expand Down Expand Up @@ -5147,7 +5163,7 @@ index b070eed98..a58f07b4b 100644
public float giantStepHeight = 2.0F;
public float giantJumpHeight = 1.0F;
public double giantMaxHealth = 100.0D;
@@ -384,6 +495,8 @@ public class PurpurWorldConfig {
@@ -384,6 +502,8 @@ public class PurpurWorldConfig {
public boolean giantHaveAI = false;
public boolean giantHaveHostileAI = false;
private void giantSettings() {
Expand All @@ -5156,7 +5172,7 @@ index b070eed98..a58f07b4b 100644
giantStepHeight = (float) getDouble("mobs.giant.step-height", giantStepHeight);
giantJumpHeight = (float) getDouble("mobs.giant.jump-height", giantJumpHeight);
giantMaxHealth = getDouble("mobs.giant.max-health", giantMaxHealth);
@@ -393,29 +506,119 @@ public class PurpurWorldConfig {
@@ -393,29 +513,119 @@ public class PurpurWorldConfig {
giantHaveHostileAI = getBoolean("mobs.giant.have-hostile-ai", giantHaveHostileAI);
}

Expand Down Expand Up @@ -5276,7 +5292,7 @@ index b070eed98..a58f07b4b 100644
public double phantomAttackedByCrystalRadius = 0.0D;
public float phantomAttackedByCrystalDamage = 1.0F;
public double phantomOrbitCrystalRadius = 0.0D;
@@ -435,6 +638,11 @@ public class PurpurWorldConfig {
@@ -435,6 +645,11 @@ public class PurpurWorldConfig {
public boolean phantomIgnorePlayersWithTorch = false;
public boolean phantomBurnInDaylight = true;
private void phantomSettings() {
Expand All @@ -5288,7 +5304,7 @@ index b070eed98..a58f07b4b 100644
phantomAttackedByCrystalRadius = getDouble("mobs.phantom.attacked-by-crystal-range", phantomAttackedByCrystalRadius);
phantomAttackedByCrystalDamage = (float) getDouble("mobs.phantom.attacked-by-crystal-damage", phantomAttackedByCrystalDamage);
phantomOrbitCrystalRadius = getDouble("mobs.phantom.orbit-crystal-radius", phantomOrbitCrystalRadius);
@@ -455,40 +663,184 @@ public class PurpurWorldConfig {
@@ -455,40 +670,184 @@ public class PurpurWorldConfig {
phantomIgnorePlayersWithTorch = getBoolean("mobs.phantom.ignore-players-with-torch", phantomIgnorePlayersWithTorch);
}

Expand Down Expand Up @@ -5473,7 +5489,7 @@ index b070eed98..a58f07b4b 100644
public int villagerBrainTicks = 1;
public boolean villagerUseBrainTicksOnlyWhenLagging = true;
public boolean villagerCanBeLeashed = false;
@@ -498,6 +850,8 @@ public class PurpurWorldConfig {
@@ -498,6 +857,8 @@ public class PurpurWorldConfig {
public int villagerSpawnIronGolemLimit = 0;
public boolean villagerCanBreed = true;
private void villagerSettings() {
Expand All @@ -5482,7 +5498,7 @@ index b070eed98..a58f07b4b 100644
villagerBrainTicks = getInt("mobs.villager.brain-ticks", villagerBrainTicks);
villagerUseBrainTicksOnlyWhenLagging = getBoolean("mobs.villager.use-brain-ticks-only-when-lagging", villagerUseBrainTicksOnlyWhenLagging);
villagerCanBeLeashed = getBoolean("mobs.villager.can-be-leashed", villagerCanBeLeashed);
@@ -508,46 +862,109 @@ public class PurpurWorldConfig {
@@ -508,46 +869,109 @@ public class PurpurWorldConfig {
villagerCanBreed = getBoolean("mobs.villager.can-breed", villagerCanBreed);
}

Expand Down
Expand Up @@ -53,10 +53,10 @@ index 1054b492c..2a288d372 100644

@Override
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index ad8ff0587..11a5795f5 100644
index 6ca2815b0..54319b097 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -894,10 +894,16 @@ public class PurpurWorldConfig {
@@ -901,10 +901,16 @@ public class PurpurWorldConfig {
public boolean witherRidable = false;
public boolean witherRidableInWater = false;
public double witherMaxY = 256D;
Expand Down

0 comments on commit 8767574

Please sign in to comment.