explosion - added entity context.

This commit is contained in:
gnembon committed 2020-05-12 14:16:19 -03:00
1 parent 5a746cc3c4
commit 5cee4e9958
2 files changed
+8 -7

No files matched your search

+1 -1
View File
@@ -5,7 +5,7 @@ org.gradle.jvmargs=-Xmx1G
# check these on https://fabricmc.net/use # check these on https://fabricmc.net/use
# or better: https://modmuss50.me/fabric.html # or better: https://modmuss50.me/fabric.html
minecraft_version=20w19a minecraft_version=20w19a
yarn_mappings=20w19a+build.9 yarn_mappings=20w19a+build.15
loader_version=0.8.2+build.194 loader_version=0.8.2+build.194
# Mod Properties # Mod Properties
@@ -243,14 +243,15 @@ public class OptimizedExplosion
{ {
BlockEntity blockEntity = block.hasBlockEntity() ? world.getBlockEntity(blockpos) : null; BlockEntity blockEntity = block.hasBlockEntity() ? world.getBlockEntity(blockpos) : null;
LootContext.Builder lootBuilder = new LootContext.Builder((ServerWorld) eAccess.getWorld()) LootContext.Builder lootBuilder = (new LootContext.Builder((ServerWorld)eAccess.getWorld()))
.setRandom(eAccess.getWorld().random) .random(eAccess.getWorld().random)
.put(LootContextParameters.POSITION, blockpos) .parameter(LootContextParameters.POSITION, blockpos)
.put(LootContextParameters.TOOL, ItemStack.EMPTY) .parameter(LootContextParameters.TOOL, ItemStack.EMPTY)
.putNullable(LootContextParameters.BLOCK_ENTITY, blockEntity); .optionalParameter(LootContextParameters.BLOCK_ENTITY, blockEntity)
.optionalParameter(LootContextParameters.THIS_ENTITY, eAccess.getEntity());
if (eAccess.getDestructionType() == Explosion.DestructionType.DESTROY) if (eAccess.getDestructionType() == Explosion.DestructionType.DESTROY)
lootBuilder.put(LootContextParameters.EXPLOSION_RADIUS, eAccess.getPower()); lootBuilder.parameter(LootContextParameters.EXPLOSION_RADIUS, eAccess.getPower());
state.getDroppedStacks(lootBuilder).forEach((itemStackx) -> { state.getDroppedStacks(lootBuilder).forEach((itemStackx) -> {
method_24023(objectArrayList, itemStackx, blockpos.toImmutable()); method_24023(objectArrayList, itemStackx, blockpos.toImmutable());