Created
February 6, 2024 07:38
-
-
Save robotgryphon/9e082b82c6dec079670c12064de274be to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package dev.compactmods.machines.test.worldgen; | |
import net.minecraft.core.BlockPos; | |
import net.minecraft.world.phys.AABB; | |
import net.neoforged.bus.api.Event; | |
import net.neoforged.bus.api.ICancellableEvent; | |
import java.util.Collection; | |
/** | |
* Notifies listeners of block changes over a large region. | |
*/ | |
public abstract class BlockRegionModificationEvent extends Event { | |
private final AABB boundaries; | |
public BlockRegionModificationEvent(AABB boundaries) { | |
this.boundaries = boundaries; | |
} | |
public AABB getBoundaries() { | |
return this.boundaries; | |
} | |
/** | |
* Fired on the logical server when multiple blocks in an area are about to change. | |
* If cancelled, none of the blocks within boundaries are to be modified. | |
*/ | |
public static class Pre extends BlockRegionModificationEvent implements ICancellableEvent { | |
public Pre(AABB boundaries) { | |
super(boundaries); | |
} | |
public void disallowChanges(AABB boundaries) { | |
} | |
public void disallowChanges(Collection<BlockPos> blockPositions) { | |
} | |
} | |
/** | |
* Fired on the logical server after a region of blocks have been changed. | |
*/ | |
public static class Post extends BlockRegionModificationEvent { | |
public Post(AABB boundaries) { | |
super(boundaries); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment