Compact Machines

Compact Machines

68M Downloads

BreakEvent doesn't seem to be cancelled in Compact Dimension

stepsword opened this issue ยท 2 comments

commented

Compact Machines version: compactmachines3-1.12.2-3.0.18-b278
Forge version: 14.23.5.2854
I am not using Optifine: true

Description of the problem including expected versus actual behavior:

I'm trying to diagnose an incompatibility between Mahou Tsukai & your mod.
It seems the Raise Enclosure Boundary in Mahou Tsukai can remove the wall blocks in the compact dimension. I fire a BlockEvent.BreakEvent before attempting to do so, and it isn't cancelled ( I printed out a

Steps to reproduce:

  1. Install Mahou Tsukai latest
  2. Install Compact Machines latest
  3. Go into a compact machine with shrink thingy
  4. Get a "Scroll of the Enclosure Boundary" from Mahou Tsukai's creative tab
  5. Right click on the floor somewhere and wait like 5 seconds

Additional Info
Here is my code for attempting to change blockstates, if it's helpful.

public static void tryChangeBlockState(boolean killTE, BlockPos p, IBlockState newstate, World world, EntityPlayer player) {
    if (world != null && !world.isRemote) {
        IBlockState state = world.getBlockState(p);
        if (state.getBlock() == Blocks.BEDROCK) return;
        if (!killTE && world.getTileEntity(p) != null) return;
        if (player == null) player = new FakePlayer((WorldServer) world, new GameProfile(UUID.randomUUID(), "faker"));
        BlockEvent.BreakEvent event = new BlockEvent.BreakEvent(world, p, state, player);
        boolean x = MinecraftForge.EVENT_BUS.post(event);
        if (!x && !event.isCanceled() && event.getResult() != Event.Result.DENY) {
            System.out.println(event.isCanceled() + ":" + event.getResult());
            world.setBlockState(p, newstate);
        }
    }
}

The println() call I added prints out "false:DEFAULT" when using it in the compact machine dimension. Your SkyWorldEvents.java looks fine, though, I think, so I can't imagine why this is happening. Any ideas?

commented

Thanks for raising an event that we can use, and the steps to reproduce. Adding a few labels to track this, will investigate as time permits.

commented

The solid wall blocks are weird. They are meant to be indestructible, but in their current state, they can be broken with very high explosion magnitudes. For example, they can be broken from NuclearCraft fusion reactor explosions, which I have personally experienced. I tried remedying this by looking at how barriers function, however modifying the solid wall blocks class to include similar code to barrier blocks broke it. It dropped the block from a single TNT explosion, where before it took a much higher explosion (and didn't even drop the block). I will have to look into this further.

Possibly by modifying the solid wall blocks to function correctly like barrier blocks would remedy this issue with Mahou Tsukai.