mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Upstream has released updates that appears to apply and compile correctly Paper Changes: 979b53a7 Do not allow bee's to load chunks for beehives 13cb8373 Remote Connections shouldn't hold up shutdown 7dac5467 Fix bug in double register fix 87829d83 Remove incorrect IO flush for save-all that doesn't have flush parameter 31e751cb Fix unregistering entities from unloading chunks bc351f6e Ensure Entity is never double registered 2ec0274b Fix many issues with dupe uuid resolve patch 756da10d (Actually) Don't duplicate velocity entry into hidden-configs 9b3679fb Don't duplicate velocity entry into hidden-configs 28cf6540 Pillager patrol spawn settings and per player options (#2924) 6bf04cd5 Reduce entity tracker updates on move
105 lines
6.0 KiB
Diff
105 lines
6.0 KiB
Diff
From d966a55aac457ad295e8535ac46cd8c3dd54d925 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
|
|
|
|
---
|
|
.../java/net/minecraft/server/Entity.java | 1 +
|
|
.../java/net/minecraft/server/EntityItem.java | 9 ++++++++-
|
|
.../net/pl3x/purpur/PurpurWorldConfig.java | 19 +++++++++++++++++++
|
|
3 files changed, 28 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
|
index 4f9a780b8..fe9c72dd9 100644
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
|
@@ -1262,6 +1262,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.a(tag, false);
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
|
|
index bbb9ca1ef..262a7935e 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityItem.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityItem.java
|
|
@@ -71,7 +71,7 @@ public class EntityItem extends Entity {
|
|
this.lastZ = this.locZ();
|
|
Vec3D vec3d = this.getMot();
|
|
|
|
- if (this.a(TagsFluid.WATER)) {
|
|
+ if (isInLiquid(TagsFluid.WATER) || (world.purpurConfig.itemFloatInLava && isInLiquid(TagsFluid.LAVA))) { // Purpur
|
|
this.u();
|
|
} else if (!this.isNoGravity()) {
|
|
this.setMot(this.getMot().add(0.0D, -0.04D, 0.0D));
|
|
@@ -105,6 +105,7 @@ public class EntityItem extends Entity {
|
|
|
|
if (this.ticksLived % i == 0) {
|
|
if (this.world.getFluid(new BlockPosition(this)).a(TagsFluid.LAVA)) {
|
|
+ if (!world.purpurConfig.itemImmuneToLava.contains(getItemStack().getItem())) // Purpur
|
|
this.setMot((double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F), 0.20000000298023224D, (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F));
|
|
this.a(SoundEffects.ENTITY_GENERIC_BURN, 0.4F, 2.0F + this.random.nextFloat() * 0.4F);
|
|
}
|
|
@@ -282,6 +283,12 @@ public class EntityItem extends Entity {
|
|
} else if (!this.getItemStack().isEmpty() && this.getItemStack().getItem() == Items.NETHER_STAR && damagesource.isExplosion()) {
|
|
return false;
|
|
} else {
|
|
+ // Purpur start
|
|
+ Item item = getItemStack().getItem();
|
|
+ if (world.purpurConfig.itemImmuneToLava.contains(item) && damagesource == DamageSource.LAVA) return false;
|
|
+ if (world.purpurConfig.itemImmuneToFire.contains(item) && (damagesource.isFire() || damagesource == DamageSource.FIRE)) return false;
|
|
+ if (world.purpurConfig.itemImmuneToExplosion.contains(item) && damagesource.isExplosion()) return false;
|
|
+ // Purpur end
|
|
// CraftBukkit start
|
|
if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f)) {
|
|
return false;
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
index 865c73f38..24d9c699a 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -5,6 +5,8 @@ import net.minecraft.server.Block;
|
|
import net.minecraft.server.Blocks;
|
|
import net.minecraft.server.Explosion;
|
|
import net.minecraft.server.IRegistry;
|
|
+import net.minecraft.server.Item;
|
|
+import net.minecraft.server.Items;
|
|
import net.minecraft.server.MinecraftKey;
|
|
import org.bukkit.configuration.ConfigurationSection;
|
|
import org.spigotmc.SpigotWorldConfig;
|
|
@@ -185,6 +187,10 @@ public class PurpurWorldConfig {
|
|
public Map<Block, Double> controllableMinecartsBlockSpeeds = new HashMap<>();
|
|
public boolean disableDropsOnCrammingDeath = false;
|
|
public boolean fixClimbingBypassingCrammingRule = false;
|
|
+ public boolean itemFloatInLava = false;
|
|
+ public List<Item> itemImmuneToExplosion = new ArrayList<>();
|
|
+ public List<Item> itemImmuneToFire = new ArrayList<>();
|
|
+ public List<Item> itemImmuneToLava = new ArrayList<>();
|
|
public boolean milkCuresBadOmen = true;
|
|
public String playerDeathExpDropEquation = "expLevel * 7";
|
|
public int playerDeathExpDropMax = 100;
|
|
@@ -214,6 +220,19 @@ public class PurpurWorldConfig {
|
|
}
|
|
disableDropsOnCrammingDeath = getBoolean("gameplay-mechanics.disable-drops-on-cramming-death", disableDropsOnCrammingDeath);
|
|
fixClimbingBypassingCrammingRule = getBoolean("gameplay-mechanics.fix-climbing-bypassing-cramming-rule", fixClimbingBypassingCrammingRule);
|
|
+ itemFloatInLava = getBoolean("gameplay-mechanics.item.float-in-lava", itemFloatInLava);
|
|
+ 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);
|
|
+ });
|
|
+ getList("gameplay-mechanics.item.immune.lava", itemImmuneToLava).forEach(key -> {
|
|
+ Item item = IRegistry.ITEM.get(new MinecraftKey((String) key));
|
|
+ if (item != Items.AIR) itemImmuneToLava.add(item);
|
|
+ });
|
|
milkCuresBadOmen = getBoolean("gameplay-mechanics.milk-cures-bad-omen", milkCuresBadOmen);
|
|
playerDeathExpDropEquation = getString("gameplay-mechanics.player.exp-dropped-on-death.equation", playerDeathExpDropEquation);
|
|
playerDeathExpDropMax = getInt("gameplay-mechanics.player.exp-dropped-on-death.maximum", playerDeathExpDropMax);
|
|
--
|
|
2.24.0
|
|
|