mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 09:27:43 +01:00
respect vanilla when trampling turtle eggs, closes #1255
This commit is contained in:
65
patches/server/0022-Add-turtle-egg-block-options.patch
Normal file
65
patches/server/0022-Add-turtle-egg-block-options.patch
Normal file
@@ -0,0 +1,65 @@
|
||||
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] 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 70d46aafa9c16921e5c5bed3d97b8f402e25038a..1cc3e156eb612a7dc0a771d38252525c1884eaea 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java
|
||||
@@ -10,7 +10,6 @@ import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
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.monster.Zombie;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
@@ -193,6 +192,25 @@ 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
|
||||
+ if (entity instanceof Turtle || entity instanceof net.minecraft.world.entity.ambient.Bat) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ if (!world.purpurConfig.turtleEggsBreakFromExpOrbs && entity instanceof net.minecraft.world.entity.ExperienceOrb) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ if (!world.purpurConfig.turtleEggsBreakFromItems && entity instanceof net.minecraft.world.entity.item.ItemEntity) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ if (!world.purpurConfig.turtleEggsBreakFromMinecarts && entity instanceof net.minecraft.world.entity.vehicle.AbstractMinecart) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ if (!(entity instanceof LivingEntity)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ if (entity instanceof Player) return true;
|
||||
+
|
||||
+ return world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING);
|
||||
+ // Purpur end
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 4b538590943d7ac36f04526ad87431d7c9b5fc60..f295aeec1428086bb3d2cf4720fdcc7c6ed2131a 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -147,6 +147,15 @@ public class PurpurWorldConfig {
|
||||
});
|
||||
}
|
||||
|
||||
+ public boolean turtleEggsBreakFromExpOrbs = true;
|
||||
+ public boolean turtleEggsBreakFromItems = true;
|
||||
+ public boolean turtleEggsBreakFromMinecarts = true;
|
||||
+ private void turtleEggSettings() {
|
||||
+ 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 babiesAreRidable = true;
|
||||
public boolean untamedTamablesAreRidable = true;
|
||||
public boolean useNightVisionWhenRiding = false;
|
||||
Reference in New Issue
Block a user