[SPIGOT-3105] BlockFadeEvent not fired for snow block melting Created: 07/Mar/17  Updated: 08/Mar/17  Resolved: 08/Mar/17

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Carter Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: blocks, event


 Description   

Snow blocks don't melt under normal conditions, but can melt if there are lighting errors. I ran into this recently when snow blocks still had a light level. I caused the lighting error with a plugin, however this could happen with any lighting error. The snow block melting drops snowballs and triggers a BlockPhysicsEvent, however the block still melts even when the physics event is cancelled. A BlockFadeEvent is not fired either.



 Comments   
Comment by Carter [ 08/Mar/17 ]

@md_5 This problem is with actual blocks of snow (ID 80) when there is lighting remaining inside the block. Here's some code that demonstrates it:

	@EventHandler
	public void onChat(AsyncPlayerChatEvent e){
		if(!e.getPlayer().isOp() || !e.getMessage().equals("test")) return;
		final Location l = e.getPlayer().getLocation();
		final int SNOW = 80;
		new BukkitRunnable(){
			@Override
			public void run(){
				for(int x = -5;x < 5;x++){
					for(int z = -5;z < 5;z++){
						final BlockPosition bp = new BlockPosition(l.getBlockX() + x,l.getBlockY(),l.getBlockZ() + z);
						((CraftChunk)l.getChunk()).getHandle().a(bp,Block.getByCombinedId(SNOW));
						((CraftWorld)l.getWorld()).getHandle().a(EnumSkyBlock.BLOCK,bp,15);
					}
				}
			}
		}.runTask(this);
		e.getPlayer().sendMessage("Relog to see changes.");
	}
Comment by md_5 [ 07/Mar/17 ]

[07:55:24 INFO]: org.bukkit.event.block.BlockFadeEvent@18224a0[cancelled=false,newState=org.bukkit.craftbukkit.block.CraftBlockState@ce887f79,block=CraftBlock{chunk=CraftChunk

{x=-6z=31}

,x=-83,y=55,z=506,type=SNOW,data=0},name=<null>,async=false]

Comment by md_5 [ 07/Mar/17 ]

Snow melting does have an event - place a torch next to snow:

        if (world.getBrightness(EnumSkyBlock.BLOCK, blockposition) > 11) {
            // CraftBukkit start
            if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), Blocks.AIR).isCancelled()) {
                return;
            }
            // CraftBukkit end
            this.b(world, blockposition, world.getType(blockposition), 0);
            world.setAir(blockposition);
        }

Thats why I'm asking for clarification about how to trigger this "bug"

Comment by Carter [ 07/Mar/17 ]

@md_5 It seems advisable that snow block melting/fading should either be treated like every other block fade or shouldn't happen at all.

Comment by md_5 [ 07/Mar/17 ]

You sound like you're suggesting an event be fired when the bug MC-88097 is triggered, or am I missing something.

Generated at Fri Mar 14 15:03:40 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.