mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
81 lines
3.7 KiB
Diff
81 lines
3.7 KiB
Diff
From 6699495e47994aba3b94784c943b9a3a99a67742 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
|
Date: Sat, 22 Feb 2020 15:54:08 -0600
|
|
Subject: [PATCH] Add item entity options
|
|
|
|
---
|
|
src/main/java/net/minecraft/server/Entity.java | 1 +
|
|
src/main/java/net/minecraft/server/EntityItem.java | 4 +++-
|
|
.../java/net/pl3x/purpur/PurpurWorldConfig.java | 14 ++++++++++++++
|
|
3 files changed, 18 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
|
index 2efb8a975..3e95af4ee 100644
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
|
@@ -1284,6 +1284,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
|
|
|
}
|
|
|
|
+ public boolean isInLiquid(Tag<FluidType> tag) { return a(tag); } // Purpur - OBFHELPER
|
|
public boolean a(Tag<FluidType> tag) {
|
|
return this.O == tag;
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
|
|
index a7860cb4d..77e970c30 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityItem.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityItem.java
|
|
@@ -258,7 +258,7 @@ public class EntityItem extends Entity {
|
|
|
|
@Override
|
|
public boolean isFireProof() {
|
|
- return this.getItemStack().getItem().u() || super.isFireProof();
|
|
+ return this.getItemStack().getItem().u() || super.isFireProof() || world.purpurConfig.itemImmuneToFire.contains(getItemStack().getItem());
|
|
}
|
|
|
|
@Override
|
|
@@ -269,6 +269,8 @@ public class EntityItem extends Entity {
|
|
return false;
|
|
} else if (!this.getItemStack().getItem().a(damagesource)) {
|
|
return false;
|
|
+ } else if ((damagesource.isFire() || damagesource == DamageSource.FIRE) && world.purpurConfig.itemImmuneToFire.contains(getItemStack().getItem())) { return false; // Purpur
|
|
+ } else if (damagesource.isExplosion() && world.purpurConfig.itemImmuneToExplosion.contains(getItemStack().getItem())) { return false; // Purpur
|
|
} else {
|
|
// CraftBukkit start
|
|
if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f)) {
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
index 3f49a6a0b..b018bfe03 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -10,6 +10,7 @@ import net.minecraft.server.MinecraftKey;
|
|
import org.bukkit.configuration.ConfigurationSection;
|
|
import org.spigotmc.SpigotWorldConfig;
|
|
|
|
+import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
@@ -104,6 +105,19 @@ public class PurpurWorldConfig {
|
|
}
|
|
}
|
|
|
|
+ public List<Item> itemImmuneToExplosion = new ArrayList<>();
|
|
+ public List<Item> itemImmuneToFire = new ArrayList<>();
|
|
+ private void itemSettings() {
|
|
+ getList("gameplay-mechanics.item.immune.explosion", itemImmuneToExplosion).forEach(key -> {
|
|
+ Item item = IRegistry.ITEM.get(new MinecraftKey((String) key));
|
|
+ if (item != Items.AIR) itemImmuneToExplosion.add(item);
|
|
+ });
|
|
+ getList("gameplay-mechanics.item.immune.fire", itemImmuneToFire).forEach(key -> {
|
|
+ Item item = IRegistry.ITEM.get(new MinecraftKey((String) key));
|
|
+ if (item != Items.AIR) itemImmuneToFire.add(item);
|
|
+ });
|
|
+ }
|
|
+
|
|
public boolean idleTimeoutKick = true;
|
|
public boolean idleTimeoutTickNearbyEntities = true;
|
|
public boolean idleTimeoutCountAsSleeping = false;
|
|
--
|
|
2.26.2
|
|
|