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: 1dc7c308 Optimize Collision Chunk lookup and avoid loading far chunks d5c6dbee Prevent Double PlayerChunkMap adds crashing server a2a9ffe3 Fix issues with Activation Range causing large chunk lookups. 017297cd Improve entity.getCurrentChunk() and use it for entity.isChunkLoaded() 52cf8906 Remove some old removed 1.14 patches that are never going to be needed (fixed/already applied)
105 lines
6.0 KiB
Diff
105 lines
6.0 KiB
Diff
From 9ad41cdd65edde37b21bd6abfca168c0c68feef1 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 d9532ebfc1..80ace33828 100644
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
|
@@ -1268,6 +1268,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 bbb9ca1efc..262a7935e7 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 567a305511..b60065111f 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
|
|
|