/
0024-MC-168772-Fix-Add-turtle-egg-block-options.patch
77 lines (73 loc) · 4.02 KB
/
0024-MC-168772-Fix-Add-turtle-egg-block-options.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Thu, 6 Jun 2019 22:15:46 -0500
Subject: [PATCH] MC-168772 Fix - Add turtle egg block options
diff --git a/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java b/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java
index fdb3ab919a78221605257ae82bfd026346ce2ffb..e98fc3c235f9160f1928a8afb0d7991a6d3430cb 100644
--- a/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java
@@ -10,11 +10,15 @@ import net.minecraft.tags.BlockTags;
import net.minecraft.tags.Tag;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
+import net.minecraft.world.entity.ExperienceOrb;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.ambient.Bat;
import net.minecraft.world.entity.animal.Turtle;
+import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.entity.monster.Zombie;
import net.minecraft.world.entity.player.Player;
+import net.minecraft.world.entity.vehicle.AbstractMinecart;
+import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
@@ -187,6 +191,23 @@ public class TurtleEggBlock extends Block {
}
private boolean canDestroyEgg(Level world, Entity entity) {
- return !(entity instanceof Turtle) && !(entity instanceof Bat) ? (!(entity instanceof LivingEntity) ? false : entity instanceof Player || world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) : false;
+ // Purpur start - fix MC-168772
+ if (entity instanceof Turtle) {
+ return false;
+ }
+ if (!world.purpurConfig.turtleEggsBreakFromExpOrbs && entity instanceof ExperienceOrb) {
+ return false;
+ }
+ if (!world.purpurConfig.turtleEggsBreakFromItems && entity instanceof ItemEntity) {
+ return false;
+ }
+ if (!world.purpurConfig.turtleEggsBreakFromMinecarts && entity instanceof AbstractMinecart) {
+ return false;
+ }
+ if (entity instanceof LivingEntity && !(entity instanceof Player)) {
+ return world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING);
+ }
+ return true;
+ // Purpur end
}
}
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index a96d7cad39076b08ee43849d3014e71d1c3d4a82..2f5e6325398b2933c751027382593e3e3be17a70 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -1064,7 +1064,10 @@ public class PurpurWorldConfig {
public boolean turtleRidable = false;
public boolean turtleRidableInWater = false;
public double turtleMaxHealth = 30.0D;
- private void turtleSettings() {
+ public boolean turtleEggsBreakFromExpOrbs = true;
+ public boolean turtleEggsBreakFromItems = true;
+ public boolean turtleEggsBreakFromMinecarts = true;
+ private void turtleEggSettings() {
turtleRidable = getBoolean("mobs.turtle.ridable", turtleRidable);
turtleRidableInWater = getBoolean("mobs.turtle.ridable-in-water", turtleRidableInWater);
if (PurpurConfig.version < 10) {
@@ -1073,6 +1076,9 @@ public class PurpurWorldConfig {
set("mobs.turtle.attributes.max_health", oldValue);
}
turtleMaxHealth = getDouble("mobs.turtle.attributes.max_health", turtleMaxHealth);
+ turtleEggsBreakFromExpOrbs = getBoolean("blocks.turtle_egg.break-from-exp-orbs", turtleEggsBreakFromExpOrbs);
+ turtleEggsBreakFromItems = getBoolean("blocks.turtle_egg.break-from-items", turtleEggsBreakFromItems);
+ turtleEggsBreakFromMinecarts = getBoolean("blocks.turtle_egg.break-from-minecarts", turtleEggsBreakFromMinecarts);
}
public boolean vexRidable = false;