mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-17 11:05:40 +00:00
30 lines
876 B
Java
30 lines
876 B
Java
package net.minecraftforge.debug;
|
|
|
|
import net.minecraft.init.Blocks;
|
|
import net.minecraftforge.event.world.BlockEvent;
|
|
import net.minecraftforge.fml.common.Mod;
|
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
|
|
|
@Mod(modid = BlockPlaceEventTest.MOD_ID, name = "BlockPlaceEvent test mod", version = "1.0", acceptableRemoteVersions = "*")
|
|
@Mod.EventBusSubscriber
|
|
public class BlockPlaceEventTest
|
|
{
|
|
static final String MOD_ID = "block_place_event_test";
|
|
static final boolean ENABLED = false;
|
|
|
|
@SubscribeEvent
|
|
public static void onBlockPlaced(BlockEvent.PlaceEvent event)
|
|
{
|
|
if (!ENABLED)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (event.getPlacedBlock().getBlock() == Blocks.CHEST
|
|
&& event.getPlacedAgainst().getBlock() != Blocks.DIAMOND_BLOCK)
|
|
{
|
|
event.setCanceled(true);
|
|
}
|
|
}
|
|
}
|