mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 00:47:42 +01:00
Upstream has released updates that appears to apply and compile correctly Paper Changes: cc477e6a Force Plugins that use delayed tasks for init back in their place 597263fd Don't skip full player connection tick when dead e2c23475 Revert loaded entity list (#3304) fa87db6b Move another NetworkManager util into the inner class (#3303) 841c7d18 Make loaded entity list logic more consistent (#3301) 36f34f01 Updated Upstream (Bukkit/CraftBukkit) 5ca5f131 Rebuild all patches using the new rebuild pattern 1ccff6fa Add villager reputation API 5c0bfffa Speed up rebuilding patches and reduce diff f37381ea Optimize Network Manager to not need synchronization 8f9df2ed Anti Xray cleanup 878c66f1 No-Tick view distance implementation - Closes #3196 b87743c1 Stop copy-on-write operations for updating light data 97a9c972 Optimize isOutsideRange to use distance maps b4e629a2 Use distance map to optimise entity tracker / Misc Utils d80d1517 Optimize Entity Ticking to Loaded Chunks only 31d7686d Add item slot helper methods for various inventories (#3221) 75e1e3b3 Mob Goal API c7bc393a Revert "Don't flush packet queue off main thread" 1abd2bd2 Don't flush packet queue off main thread a4ed58a9 Clean up Direct Memory Region Files Fix for different Java versions 55e35019 Set cap on JDK per-thread native byte buffer cache b5101f4f Cleanup Region Files Direct Memory on close 81e655d7 Optimize Voxel Shape Merging ed9fc11f Sync position on teleportation 9c326fce Nanothing to see here 3e9fc24b Attempt to fix FastLogin maybe
105 lines
6.0 KiB
Diff
105 lines
6.0 KiB
Diff
From 78498ce0b82d11b1ec78e6a598e14fb8a4e2b1db 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 6406e6c5d..e5a2414c1 100644
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
|
@@ -1318,6 +1318,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 0e34414a7..4cb856ebb 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;
|
|
@@ -176,6 +178,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;
|
|
@@ -205,6 +211,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
|
|
|