mirror of
https://github.com/Samsuik/Sakura.git
synced 2026-01-04 15:31:43 +00:00
Configure items that can that drop from explosions
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
--- a/net/minecraft/world/entity/item/ItemEntity.java
|
||||
+++ b/net/minecraft/world/entity/item/ItemEntity.java
|
||||
@@ -370,6 +_,11 @@
|
||||
@@ -370,6 +_,13 @@
|
||||
|
||||
@Override
|
||||
public boolean ignoreExplosion(Explosion explosion) {
|
||||
+ // Sakura start - add list of items that ignore explosions
|
||||
+ if (this.level().sakuraConfig().entity.items.explosionResistantItems.contains(this.getItem().getItem()) != this.level().sakuraConfig().entity.items.useWhitelistForExplosionResistantItems) {
|
||||
+ final java.util.Set<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;
|
||||
+ }
|
||||
+ // Sakura end - add list of items that ignore explosions
|
||||
|
||||
@@ -26,16 +26,24 @@
|
||||
|
||||
do {
|
||||
final int blockX = Mth.floor(currX);
|
||||
@@ -618,6 +_,12 @@
|
||||
.getBlockState(blockPos)
|
||||
@@ -619,7 +_,20 @@
|
||||
.onExplosionHit(this.level, blockPos, this, (itemStack, blockPos1) -> addOrAppendStack(list, itemStack, blockPos1));
|
||||
}
|
||||
+
|
||||
|
||||
+ // Sakura start - configure explosions dropping items
|
||||
+ if (!this.level.sakuraConfig().cannons.explosion.explosionsDropItems) {
|
||||
+ list.clear();
|
||||
+ }
|
||||
+ // Sakura end - configure explosions dropping items
|
||||
|
||||
+
|
||||
+ // Sakura start - configure items that can that drop from explosions
|
||||
+ final Set<net.minecraft.world.item.Item> explosionItemDrops = this.level.sakuraConfig().entity.items.explosionItemDrops.items;
|
||||
+ final boolean whitelist = this.level.sakuraConfig().entity.items.explosionItemDrops.whitelistOverBlacklist;
|
||||
for (ServerExplosion.StackCollector stackCollector : list) {
|
||||
+ if (explosionItemDrops.contains(stackCollector.stack.getItem()) != whitelist) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ // Sakura start - configure items that can that drop from explosions
|
||||
Block.popResource(this.level, stackCollector.pos, stackCollector.stack);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user