Jump to content

Recommended Posts

Posted (edited)

Probably a common issue with a simple fix, but i cannot figure it out, the copper ingot texture & name are not registering in testing.

 

I'm following TechnoVision's 1.15.2 modding tutorials, for reference.

 

Here's the 16x16 png texture for the ingot, which I have put in src/main/resources/assets/necessarytechnology/textures/items: copper_ingot.png

It's file shares the same name as the item, copper_ingot.


NecessaryTechonology.java, which is in src/main/java/com.cyphon.necessarytechnology

package com.cyphon.necessarytechnology;


import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.InterModComms;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;
import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent;
import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import util.RegistryHandler;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.util.stream.Collectors;

@Mod("necessarytechnology")
public class NecessaryTechnology
{
    private static final Logger LOGGER = LogManager.getLogger();
    public static final String MOD_ID = "necessarytechnology";

    public NecessaryTechnology() {
        FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
        FMLJavaModLoadingContext.get().getModEventBus().addListener(this::enqueueIMC);
        FMLJavaModLoadingContext.get().getModEventBus().addListener(this::processIMC);
        FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff);
        RegistryHandler.init();

        MinecraftForge.EVENT_BUS.register(this);
    }

    private void setup(final FMLCommonSetupEvent event)
    {
        LOGGER.info("HELLO FROM PREINIT");
        LOGGER.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName());
    }

    private void doClientStuff(final FMLClientSetupEvent event) {
        LOGGER.info("Got game settings {}", event.getMinecraftSupplier().get().gameSettings);
    }

    private void enqueueIMC(final InterModEnqueueEvent event)
    {
        InterModComms.sendTo("examplemod", "helloworld", () -> { LOGGER.info("Hello world from the MDK"); return "Hello world";});
    }

    private void processIMC(final InterModProcessEvent event)
    {
        LOGGER.info("Got IMC {}", event.getIMCStream().
                map(m->m.getMessageSupplier().get()).
                collect(Collectors.toList()));
    }
    @SubscribeEvent
    public void onServerStarting(FMLServerStartingEvent event) {
        LOGGER.info("HELLO from server starting");
    }

    @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD)
    public static class RegistryEvents {
        @SubscribeEvent
        public static void onBlocksRegistry(final RegistryEvent.Register<Block> blockRegistryEvent) {
            LOGGER.info("HELLO from Register Block");
        }
    }
}

 

 

ItemBase.java, which is in src/main/java/items:

package items;

import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;

public class ItemBase extends Item {

        
        public ItemBase() {
            super(new Item.Properties().group(ItemGroup.MATERIALS));
        }
    
    }

 

RegistryHandler.java, which is in src/main/java/util:

package util;

import com.cyphon.necessarytechnology.NecessaryTechnology;

import items.ItemBase;
import net.minecraft.item.Item;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;

public class RegistryHandler {
    
    public static final DeferredRegister<Item> ITEMS = new DeferredRegister<>(ForgeRegistries.ITEMS, NecessaryTechnology.MOD_ID);
    
    public static void init() {ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus());}
    
    // Items
    public static final RegistryObject<Item> COPPER_INGOT = ITEMS.register("copper_ingot", ItemBase::new);

}

 

en_us.json, which is in src/main/resources/assets/necessarytechnology/lang:

{
"item.necessarytechnology.copper_ingot": "Copper Ingot"
}

 

copper_ingot.json, which is in src/main/resources/assets/necessarytechnology/models/item:

{
  "parent": "item/generated",
  "textures": {
    "layer0": "necessarytechnology:items/copper_ingot"
  }
}

 

Thanks in advance!

Edited by Cyphon
fixed file location typos
Posted
  On 5/15/2020 at 2:21 PM, Cyphon said:

src/main/resources/assets/models/item

Expand  

You forgot to include a folder with your mod ID.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
  On 5/15/2020 at 2:21 PM, Cyphon said:

I'm following TechnoVision's 1.15.2 modding tutorials, for reference.

Expand  

Please, don't, they're pretty bad. It's better for you to look at vanilla examples and other people's mods like Botania.

 

  On 5/15/2020 at 2:21 PM, Cyphon said:

ItemBase.java, which is in src/main/java/items:

Expand  

Don't make base item classes, it'll just be a nuisance when you want to extend something else.

Besides that looking at your problem I don't see anything wrong, post more code, preferably as a git repo.

It's sad how much time mods spend saying "x is no longer supported on this forum. Please update to a modern version of Minecraft to receive support".

Posted (edited)
  On 5/15/2020 at 2:21 PM, Cyphon said:

ItemBase.java, which is in src/main/java/items:

Expand  

There's already an "item base" class, its called Item and is in the net.minecraft.item package.

 

Any reason you're using a deferred register for your items, but a registry event for your blocks?

Edited by Draco18s

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

I'll be starting fresh with this mod, not like I had much.

 

Learning how Minecraft is coded directly from it's code sounds like exactly what I want.

 

How would I go about looking through vanilla code in Eclipse?

Or is there another program you would reccomend?

Posted
  On 5/15/2020 at 3:54 PM, Cyphon said:

I'll be starting fresh with this mod, not like I had much.

 

Learning how Minecraft is coded directly from it's code sounds like exactly what I want.

 

How would I go about looking through vanilla code in Eclipse?

Or is there another program you would reccomend?

Expand  

Referenced libraries

It's sad how much time mods spend saying "x is no longer supported on this forum. Please update to a modern version of Minecraft to receive support".

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Dear Brunoe Quick Hack (Team) Thank you so much for your remarkable help in recovering my funds after I was scammed. As a busy surgeon and single mother to three children, the loss was overwhelming.Web-Site: Brunoequickhack.COM Your team's hard work, expertise, and unwavering support gave me hope and helped restore my financial stability. I admire your professionalism and the way you genuinely care about your clients. I highly recommend your services to anyone who has fallen prey to scammers. You are truly life savers. Whats-App: +1705-(7842)-635 With heartfelt thanks, Contact information: BrunoequickhackATgmail.cOM Dear Brunoe Quick Hack (Team) Thank you so much for your remarkable help in recovering my funds after I was scammed. As a busy surgeon and single mother to three children, the loss was overwhelming.Web-Site: Brunoequickhack.COM Your team's hard work, expertise, and unwavering support gave me hope and helped restore my financial stability. I admire your professionalism and the way you genuinely care about your clients. I highly recommend your services to anyone who has fallen prey to scammers. You are truly life savers. Whats-App: +1705-(7842)-635 With heartfelt thanks, Contact information: BrunoequickhackATgmail.cOM
    • ok i tried to disable the last mod's i installed and it is some of then, so now im going to do the classic enable and disable trick to find out which mod cause the crash. thanks for the help  
    • ok  make it work (java not being recognize) by downloading the zip putting it in the java folder and manually setting the path but is still give the same crush report https://pastebin.com/PPmR6jN0
    • Install this one: https://www.azul.com/downloads/?version=java-17-lts&os=windows&architecture=x86-64-bit&package=jdk#zulu After installation, set the java version in your Launcher / Java settings
    • it say it requires java 17 so when i go to install it is say "the installer has encounter an unexpected error installing this package." error code 2503 and 2502. https://pastebin.com/AL6AHMM9
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.