AlterGroundEvent for modifying block placement performed by AlterGroundDecorator (#9637)

This commit is contained in:
bconlon authored and GitHub committed 2023-07-13 17:29:03 -07:00
1 parent 2f229c5bb1
commit 2c965fac90
5 files changed
+128

No files matched your search

@@ -0,0 +1,27 @@
/*
* Copyright (c) Forge Development LLC and contributors
* SPDX-License-Identifier: LGPL-2.1-only
*/
package net.minecraftforge.debug;
import net.minecraft.world.level.block.Blocks;
import net.minecraftforge.event.level.AlterGroundEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
@Mod("alter_ground_event_test")
@Mod.EventBusSubscriber
public class AlterGroundEventTest {
public static final boolean ENABLE = true;
@SubscribeEvent
public static void onAlterGround(AlterGroundEvent event)
{
if (ENABLE) {
if (event.getOriginalAlteredState().is(Blocks.PODZOL)) {
event.setNewAlteredState(Blocks.REDSTONE_BLOCK.defaultBlockState());
}
}
}
}