Reputation: 1
I decided to start learning java and make a minecraft mod. I tried to make an modded block with holes and extensions but when I try to start minecraft it says that there is something wrong with the texture.
terminal error: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state java
Minecraft error: mods.toml missing metadata for modid forge
this is my code from my core "Cosmicages.java":
package quintoniusvlint.cosmicages;
import com.mojang.logging.LogUtils;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.InterModComms;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;
import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent;
import net.minecraftforge.event.server.ServerStartingEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import org.slf4j.Logger;
import quintoniusvlint.cosmicages.core.ModBlocks;
import quintoniusvlint.cosmicages.core.ModItems;
import java.util.stream.Collectors;
import static net.minecraftforge.versions.forge.ForgeVersion.MOD_ID;
// The value here should match an entry in the META-INF/mods.toml file
@Mod(MOD_ID)
public class Cosmicages {
// Directly reference a slf4j logger
public static final String MOD_ID = "cosmicages";
private static final Logger LOGGER = LogUtils.getLogger();
public Cosmicages() {
IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus();
bus.addListener(this::setup);
bus.addListener(this::enqueueIMC);
bus.addListener(this::processIMC);
ModBlocks.BLOCKS.register(bus);
ModItems.ITEMS.register(bus);
MinecraftForge.EVENT_BUS.register(this);
}
private void setup(final FMLCommonSetupEvent event) {
// Some preinit code
LOGGER.info("HELLO FROM PREINIT");
LOGGER.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName());
}
private void enqueueIMC(final InterModEnqueueEvent event) {
// Some example code to dispatch IMC to another mod
InterModComms.sendTo("cosmicages", "helloworld", () -> {
LOGGER.info("Hello world from the MDK");
return "Hello world";
});
}
private void processIMC(final InterModProcessEvent event) {
// Some example code to receive and process InterModComms from other mods
LOGGER.info("Got IMC {}", event.getIMCStream().
map(m -> m.messageSupplier().get()).
collect(Collectors.toList()));
}
// You can use SubscribeEvent and let the Event Bus discover methods to call
@SubscribeEvent
public void onServerStarting(ServerStartingEvent event) {
// Do something when the server starts
LOGGER.info("HELLO from server starting");
}
// You can use EventBusSubscriber to automatically subscribe events on the contained class (this is subscribing to the MOD
// Event bus for receiving Registry Events)
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
public static class RegistryEvents {
@SubscribeEvent
public static void onBlocksRegistry(final RegistryEvent.Register<Block> blockRegistryEvent) {
// Register a new block here
LOGGER.info("HELLO from Register Block");
}
}
}
this is my code from my core "ModBlocks":
package quintoniusvlint.cosmicages.core;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.material.Material;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
import quintoniusvlint.cosmicages.Cosmicages;
public class ModBlocks {
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, Cosmicages.MOD_ID);
public static final RegistryObject<Block> ARTIFACT_BLOCK = BLOCKS.register("artifact_block", () -> new Block(BlockBehaviour.Properties.of(Material.STONE)));
}
this is my code from my core "ModItems":
package quintoniusvlint.cosmicages.core;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
import quintoniusvlint.cosmicages.Cosmicages;
public class ModItems {
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, Cosmicages.MOD_ID);
public static final RegistryObject<Item> ARTIFACT_BLOCK = ITEMS.register("ARTIFACT_BLOCK", () -> new BlockItem(ModBlocks.ARTIFACT_BLOCK.get(), new Item.Properties().tab(CreativeModeTab.TAB_BUILDING_BLOCKS)));
}
this is my code from my "blockstates/artifact_block.json":
{
"variants": {
"": {"model": "cosmicages:block/artifact_block"}
},
"credit": "Made with Blockbench",
"parent": "ArtifactActivationBlock",
"texture_size": [128, 128],
"textures": {
"0": "block/ texture"
},
"elements": [
{
{
"variants": {
"": {"model": "cosmicages:block/artifact_block"}
},
"credit": "Made with Blockbench",
"parent": "ArtifactActivationBlock",
"texture_size": [128, 128],
"textures": {
"0": "block/ texture"
},
"elements": [
{
//and then we have the position of the block etc
this is my code from my "models/block/artifact_block.json":
{
"credit": "Made with Blockbench",
"parent": "block/cube_all",
"texture_size": [128, 128],
"textures": {
"all": "cosmicages:block/artifact_block"
},
"elements": [
{
//and then we have the position of the block etc
this is my code from my "models/item/artifact_block.json":
{
"credit": "Made with Blockbench",
"parent": "cosmicages:block/artifact_block",
"texture_size": [128, 128],
"textures": {
"0": "block/texture"
},
"elements": [
{
//and then we have the position of the block etc
Upvotes: 0
Views: 654
Reputation: 15
So you are trying to render a transparent block. the problem might be in the json file.
I use mcreator for my mods and i found this in this directory: models/block/artifact_block.json:
{
"parent": "cosmicages:block/artifact_block",
"textures": {
"all": "cosmicages:block/artifact_block",
"particle": "cosmicages:block/artifact_block"
},
"render_type": "solid"
}
i found something called render type. I went in the transparency type and here are all the possible options:
all of those options was according to my research on the internet and don't know if it's accurate
Upvotes: 0