33 lines
1.1 KiB
Java
33 lines
1.1 KiB
Java
package space.eptaproject.vmodaddon;
|
|
|
|
import lombok.ToString;
|
|
import net.minecraft.resources.ResourceLocation;
|
|
import net.minecraft.world.level.block.Block;
|
|
import net.minecraft.world.level.block.state.BlockState;
|
|
import net.minecraftforge.registries.ForgeRegistries;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.Logger;
|
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|
|
|
@ToString
|
|
public class Validator implements IValidator {
|
|
public static final Logger LOGGER = LoggerFactory.getLogger("Validator");
|
|
public static ResourceLocation RB = ResourceLocation.fromNamespaceAndPath(Vmodaddon.MODID, "example_block");
|
|
|
|
public Validator() {
|
|
|
|
}
|
|
|
|
@Override
|
|
public void valid(Block block, ResourceLocation location, CallbackInfoReturnable<BlockState> info) {
|
|
LOGGER.info(location.toString());
|
|
if (Config.parsedList.contains(location)) {
|
|
Block replacement = ForgeRegistries.BLOCKS.getValue(Config.replace);
|
|
if (replacement != null) {
|
|
info.setReturnValue(replacement.defaultBlockState());
|
|
info.cancel();
|
|
}
|
|
}
|
|
}
|
|
}
|