How to create a new event

I’m on making some changes before opening a PR.

The main part of the change is a new Event in Sponge. Unfortunately, while it has auto-generated an implementation it doesn’t work as desired. How do I change how the Event is coded?

It would help if you laid out what your event is, what it’s meant to do, and why it doesn’t work as desired.

Note that events should effectively be simple data objects - if you’re trying to put logic into the event your are almost certainly doing it wrong.

//Sponge Start
float impl$BlockExplosionResistance = f2;

if (ShouldFire.EXPLOSION_EVENT_BLOCK_EXPLOSION_RESISTANCE) {
    final Cause cause = Sponge.getCauseStackManager().getCurrentCause();

    final Vector3d blockPosition = new Vector3d(blockpos.getX(), blockpos.getY(), blockpos.getZ());

    final ExplosionEvent.BlockExplosionResistance resistance =
                SpongeEventFactory.createExplosionEventBlockExplosionResistance(cause, blockPosition, (BlockState) iblockstate, (Explosion) this, (World) this.world, f2, f2);
    SpongeImpl.postEvent(resistance);

    impl$BlockExplosionResistance = resistance.getExplosionResistance();
}

f -= (impl$BlockExplosionResistance + 0.3F) * 0.3F;
//Sponge End
    /**
     * An event that is fired when an explosion calculation fetches the explosion resistance of a block.
     */
    interface BlockExplosionResistance extends ExplosionEvent, TargetWorldEvent {

        /**
         *
         * @return
         */
        Vector3d getBlockPosition();

        /**
         *
         * @return
         */
        BlockState getBlockState();
        /**
         *
         * @return
         */
        float getDefaultExplosionResistance();

        /**
         *
         * @return
         */
        float getExplosionResistance();

        /**
         *
         * @param explosionResistance
         */
        void setExplosionResistance(float explosionResistance);
    }

I need getDefaultExplosionResistance() to return the normal explosion resistance for that block without having to input the default and the actual value.