Skip to content

Commit

Permalink
Hot fix wind charges
Browse files Browse the repository at this point in the history
Explosions are in general busted and requires
new API changes. We aren't even correctly
handling normal explosives
  • Loading branch information
aromaa committed Nov 9, 2024
1 parent c0cf9cd commit bcdde69
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,11 @@ public abstract class ServerLevelMixin_Tracker extends LevelMixin_Tracker implem

final var explosionBuilder = org.spongepowered.api.world.explosion.Explosion.builder().from((org.spongepowered.api.world.explosion.Explosion) mcExplosion);

Explosive apiExplosive = (Explosive) entity;
if (!(entity instanceof final Explosive apiExplosive)) {
mcExplosion.explode();
this.tracker$apiExplosion = explosionBuilder.build();
return;
}
final PhaseTracker phaseTracker = PhaseTracker.getWorldInstance((ServerLevel) (Object) this);
final var detonateEvent = SpongeEventFactory.createDetonateExplosiveEvent(phaseTracker.currentCause(),
explosionBuilder, apiExplosive, (org.spongepowered.api.world.explosion.Explosion) instance);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ public abstract class ServerExplosionMixin_Tracker {
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/state/BlockState;onExplosionHit(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/Explosion;Ljava/util/function/BiConsumer;)V"))
private void tracker$onExplosionHit(final BlockState instance, final ServerLevel serverLevel,
final BlockPos blockPos, final Explosion explosion, final BiConsumer biConsumer) {
if (explosion.getBlockInteraction() == Explosion.BlockInteraction.TRIGGER_BLOCK) {
instance.onExplosionHit(serverLevel, blockPos, explosion, biConsumer);
return;
}
// this.level.getBlockState($$2).onExplosionHit(this.level, $$2, this, ($$1x, $$2x) -> addOrAppendStack($$1, $$1x, $$2x));

// TODO addOrAppendStack? ItemStack pre merging
Expand Down

0 comments on commit bcdde69

Please sign in to comment.