mirror of
https://github.com/Samsuik/Sakura.git
synced 2025-12-19 14:59:30 +00:00
Configure items that can that drop from explosions
This commit is contained in:
@@ -595,10 +595,10 @@ index 0000000000000000000000000000000000000000..94dd734ca4049354f925af1736bda57c
|
|||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/me/samsuik/sakura/configuration/WorldConfiguration.java b/src/main/java/me/samsuik/sakura/configuration/WorldConfiguration.java
|
diff --git a/src/main/java/me/samsuik/sakura/configuration/WorldConfiguration.java b/src/main/java/me/samsuik/sakura/configuration/WorldConfiguration.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..42a233ad23223c857b6c86936415380e1eaf30d1
|
index 0000000000000000000000000000000000000000..89f67f30831e945e327d32703f359e776ddae389
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/me/samsuik/sakura/configuration/WorldConfiguration.java
|
+++ b/src/main/java/me/samsuik/sakura/configuration/WorldConfiguration.java
|
||||||
@@ -0,0 +1,239 @@
|
@@ -0,0 +1,248 @@
|
||||||
+package me.samsuik.sakura.configuration;
|
+package me.samsuik.sakura.configuration;
|
||||||
+
|
+
|
||||||
+import com.mojang.logging.LogUtils;
|
+import com.mojang.logging.LogUtils;
|
||||||
@@ -792,8 +792,17 @@ index 0000000000000000000000000000000000000000..42a233ad23223c857b6c86936415380e
|
|||||||
+
|
+
|
||||||
+ public Items items = new Items();
|
+ public Items items = new Items();
|
||||||
+ public class Items extends ConfigurationPart {
|
+ public class Items extends ConfigurationPart {
|
||||||
+ public boolean useWhitelistForExplosionResistantItems = true;
|
+ public BlastResistant blastResistant = new BlastResistant();
|
||||||
+ public List<Item> explosionResistantItems = List.of();
|
+ public class BlastResistant extends ConfigurationPart {
|
||||||
|
+ public List<Item> items = List.of();
|
||||||
|
+ public boolean whitelistOverBlacklist = true;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public ExplosionItemDrops explosionItemDrops = new ExplosionItemDrops();
|
||||||
|
+ public class ExplosionItemDrops extends ConfigurationPart {
|
||||||
|
+ public List<Item> items = List.of();
|
||||||
|
+ public boolean whitelistOverBlacklist = false;
|
||||||
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @Comment("Entity travel distance limits")
|
+ @Comment("Entity travel distance limits")
|
||||||
|
|||||||
@@ -5,17 +5,19 @@ Subject: [PATCH] Added list of ItemEntity's that ignore explosions
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||||
index 4423973d4d9a2c3879d98d1d4c8b8c117c677ac5..801e4ec55b3df7ed3e2b4cb9fdbd49567d434720 100644
|
index 4423973d4d9a2c3879d98d1d4c8b8c117c677ac5..01ca80f2d44ca2a443a1a87fd8bbc0985bff7f3c 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||||
@@ -590,6 +590,17 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
@@ -590,6 +590,19 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Sakura start
|
+ // Sakura start
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public boolean ignoreExplosion(net.minecraft.world.level.Explosion explosion) {
|
+ public boolean ignoreExplosion(net.minecraft.world.level.Explosion explosion) {
|
||||||
+ if (this.level().sakuraConfig().entity.items.explosionResistantItems.contains(this.getItem().getItem()) != this.level().sakuraConfig().entity.items.useWhitelistForExplosionResistantItems) {
|
+ final List<Item> blastResistantTypes = this.level().sakuraConfig().entity.items.blastResistant.items;
|
||||||
|
+ final boolean whitelist = this.level().sakuraConfig().entity.items.blastResistant.whitelistOverBlacklist;
|
||||||
|
+ if (blastResistantTypes.contains(this.getItem().getItem()) != whitelist) {
|
||||||
+ return true;
|
+ return true;
|
||||||
+ } else {
|
+ } else {
|
||||||
+ return super.ignoreExplosion(explosion);
|
+ return super.ignoreExplosion(explosion);
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Samsuik <kfian294ma4@gmail.com>
|
||||||
|
Date: Fri, 11 Apr 2025 22:16:32 +0100
|
||||||
|
Subject: [PATCH] Configure items that can that drop from explosions
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||||
|
index 8eb9e93427a4a43f8264e8bd73bca1f35ea9085e..4338729938f711bd4ab8e6eb3bfd853f1a1eb944 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||||
|
@@ -931,8 +931,15 @@ public class Explosion {
|
||||||
|
// Sakura end - config for explosions dropping items
|
||||||
|
Iterator iterator = list.iterator();
|
||||||
|
|
||||||
|
+ // Sakura start - configure items that can that drop from explosions
|
||||||
|
+ final List<net.minecraft.world.item.Item> explosionItemDrops = this.level.sakuraConfig().entity.items.explosionItemDrops.items;
|
||||||
|
+ final boolean whitelist = this.level.sakuraConfig().entity.items.explosionItemDrops.whitelistOverBlacklist;
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
Pair<ItemStack, BlockPos> pair = (Pair) iterator.next();
|
||||||
|
+ if (explosionItemDrops.contains(pair.getFirst().getItem()) != whitelist) {
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+ // Sakura start - configure items that can that drop from explosions
|
||||||
|
|
||||||
|
Block.popResource(this.level, (BlockPos) pair.getSecond(), (ItemStack) pair.getFirst());
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user