View Issue Details

IDProjectCategoryView StatusLast Update
0002163Industrial-Craft²nuclear reactor and anything associatedpublic2017-04-26 18:04
Reporterloveyanbei Assigned ToChocohead  
PriorityhighSeveritymajorReproducibilityalways
Status closedResolutionno change required 
Platformamd64OSLinux 
Fixed in VersionBuilds for MC 1.7.10 
Summary0002163: Explosions are not pushed to Sponge Eventbus
DescriptionOfficial IC2 doesn't push any information to Sponge Eventbus on nuke explosion , reactor melt and even IC TNT exploded. So plugins cannot control explosions. But controlling Events is very important in MP game.

I tried to decompile ExplosionIC2.class and pushed the event to SpongeForge Event bus, Then added to the classpath, and deleted the original class. Fortunately it worked. Plugins can now detect IC2 explosions.

Will there be any official plans on this?
Steps To ReproduceInstall IC2 with SpongeForge on server.

Add RedProtect plugin , which is plugin like Residence on bukkit

Create a region(residence) on the server.

Ignite a nuke near it, boom!And the plugin does nothing.
TagsNo tags attached.
Minecraft Version1.10.2

Activities

Chocohead

2017-04-25 16:45

developer   ~0005158

Last edited: 2017-04-25 16:45

The ExplosionEvent exists in the API purely so that people can control explosions, as well as get the finer information like the igniter, radiation range and range limit.

loveyanbei

2017-04-25 17:10

reporter   ~0005159

I know what you are talking about.
Through decompiling the mod I know IC2 pushed fml event of explosion but, on the one hand it didn't provide information of blocks the explosion affected or some way to cancel it(which is important for plugin),neither did spongeForge
 catch it.On the other hand I discovered that IC2 didn't call NMS implementation of Explosion.

IC2 Extended the Explosion class, and implemented the algorithm of explosion independently.

SpongeForge used mixin/ASM to hook into NMS classes and changed their behavior, they redirected NMS calls, which means if someone created an explosion through directly setting blocks to AIR.Nobody knows, and there hardly be plugins under pure forge. That's why IC2 can break some restrictions of plugins under MCPC+/Sponge.

IC2 just need to send event to Sponge EventBus(If sponge exists) to make plugins under Sponge know what mod did, it's important.(MCPC+/Cauldron is not maintained anymore)
I just resolved explosion problem through decompliling, IC2 is not an open-source project, which makes it tough.It can't be better if you can do something.
Can you tell me if there's any plan in the future?

Chocohead

2017-04-25 22:45

developer   ~0005160

Information about the blocks that are exploded is essentially impossible with the way the explosion code currently works, as they're blown up as they're found. The secondary blast rays are shot off in completely random directions, so even if you had a list of the primary broken blocks (that are worked out later than when the rays are sent out, might I add), the rays couldn't be included without major performance hits from having to do calculations twice.
The explosion event itself however, can be cancelled like any other Forge event that is annotated with @Cancelable, via setCanceled(true).

Sponge support is not planned to avoiding having another effective code base to be working against as it very much changes the way Forge and Minecraft itself works, not to mention that an additional dependency is just more compatibility concerns to worry about.

With the information that the explosion events provides, you could quite easily just watch for the event on the Forge bus then cancel it, and perform another explosion yourself. That would allow the control you want, and with the information provided in the event, at the very least theoretically allow mimicking of the normal one (but with claims protected or whatever).


Sorry it's not ideal, but IC2 explosions are designed for performance first, and that comes at the expense of how easily they can be stopped midway through.

Issue History

Date Modified Username Field Change
2017-04-25 09:35 loveyanbei New Issue
2017-04-25 16:45 Chocohead Note Added: 0005158
2017-04-25 16:45 Chocohead Status new => closed
2017-04-25 16:45 Chocohead Assigned To => Chocohead
2017-04-25 16:45 Chocohead Resolution open => no change required
2017-04-25 16:45 Chocohead Fixed in Version => Builds for MC 1.7.10
2017-04-25 16:45 Chocohead Note Edited: 0005158
2017-04-25 17:10 loveyanbei Note Added: 0005159
2017-04-25 17:10 loveyanbei Status closed => feedback
2017-04-25 17:10 loveyanbei Resolution no change required => reopened
2017-04-25 22:45 Chocohead Note Added: 0005160
2017-04-26 18:04 Chocohead Status feedback => closed
2017-04-26 18:04 Chocohead Resolution reopened => no change required