Jump to content

Recommended Posts

Posted (edited)

So the Code style: I have no idea how to avoid the IHasModel. The Common Proxy: in 1.9  i made a mod with a client/server proxy, no common but im not sure if that same method will work in 1.12

How do I the the registry beside the ForgeRegistryEvent?

I compared my other working mod to this one, the registry looks to me exactly the same, here's the working one: CharacterMod

Where do i call the registry from?

Edited by DiamondMiner88
Posted

I gave up on that tutorial so ill try to work with the CharacterMod, that one I already have working. Where do i change the static initializers? I tried making onItemRegister non-static but it didn't even register the items. The proxies: is this how you do it? CrayfishTM Only I don't know what to put instead of ModItems.registerRenders() in ClientProxy. And i still dont get what you mean by:

  On 12/27/2018 at 6:24 PM, diesieben07 said:

Subscribe to ModelRegistryEvent. In there go through all your items and call ModelLoader.setCustomModelResourceLocation (or whatever else you might need to register the model). There is no action needed in the Item class.

Expand  

In what class do i subscribe to ModelRegistryEvent and call ModelLoader.setCustomResourceLocation?

Posted

Wait i dont get it... how do i subscribe from the client proxy class what annotation do i use? I have no idea how subscribing works. I made the ServerProxy but in the Client i already have

public void registerItemRenderer(Item item, int meta, String id) {
        ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName(), id));
    }

this i what is my ClientProxy class is:

package com.diamondminer88.mod.character.proxy;

import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.client.model.ModelLoader;

public class ClientProxy implements CommonProxy {
    public void registerItemRenderer(Item item, int meta, String id) {
        ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName(), id));
    }
    public void init() {
        ModelLoader.setCustomModelResourceLocation();
    }

}

I updated my Github too.

Posted (edited)

Would I remove the method registerItemRenderer() or just subscribe it to that and what would i do with the init() method? The subscribing still makes no sense for me. What purpose does it serve?

Edited by DiamondMiner88
Posted
  On 12/30/2018 at 1:38 AM, diesieben07 said:
  On 12/30/2018 at 1:36 AM, DiamondMiner88 said:

i also added in my Main.init() proxy.init();

Expand  

Why? 

Expand  

Wait so you're saying that that's not needed to call the proxies? Does this call them at the right time?

@SidedProxy(clientSide = Reference.CLIENT_PROXY, serverSide = Reference.SERVER_PROXY)
public static CommonProxy proxy;

 

  On 12/30/2018 at 1:38 AM, diesieben07 said:
  On 12/30/2018 at 1:36 AM, DiamondMiner88 said:

Ok so i get what subscribing is but how do i subscribe to ModelRegistryEvent?

Expand  

Like any other event.

Expand  

Other subscribing events i see are like this

	@SubscribeEvent
    public static void onBlockRegister(RegistryEvent.Register<Block> event) {
        event.getRegistry().registerAll(ModBlocks.BLOCKS.toArray(new Block[0]));
    }

Should i do @SubscribeEvent with WHAT underneath?

Posted

I think even I can help here so I will try

so basically to make everything simpler for you
First you want a registry_handler which registers the items through Forge( no not the textures just the item "unlocalizedname" and "registryName") and it should look something similar to this
 

@EventBusSubscriber  
public class RegistryHandler {

	
	
    @SubscribeEvent //for @SubscribeEvent you would have to register your class BUT because of the @EventbusSubscriber you don't have to if i am correct
    public static void registerItemsasdasd(Register<Item> event) {


        final Item[] items = {
                new ItemBasic("BasicStar","basic_star_item"),  //the item that you are making (you have the same class in your git so this should be ok
        };
        event.getRegistry().registerAll(items); //this will use the register to tell the game that this thing even exceists
    }

}

Then if you registered your items you need some way to tell that you want a model or picture or whatever for your item so you do this
 

@EventBusSubscriber(Side.CLIENT)
public class ModelRegistryHandler {
 
    @SubscribeEvent
    public static void registerModels(ModelRegistryEvent event) {
        registerModel(TutorialItems.BASIC_STAR_ITEM);  //here comes the problem. You need a reference for your item(basically you could use just a "registryName" without getting the item reference but you will need later anyways
	}
	
	private static void registerModel(Item item) {
        ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
    }
}

To get your item reference one way is to do this:

@ObjectHolder(MainModpls.MODID)
public class TutorialItems {
 
    public static final Item BASIC_STAR_ITEM = null;
//This will just simply look through items thats in the namespace of MainModpls.MODID and if it finds a match it fills the value of your variable in more easier way: you I constructed the basicItem with the registryName=basic_star_item(small letters and theese things _ ) and if it finds that name here with CAPITALS then it sets the value
}

To be honest if you implement theese things it should work just be aware from here for the "picture" of your item it will look for a .json file in: assets.yourMODID.models.item.registryNameofyouritem.json
json contains this:
 

{
    "parent": "item/generated",
    "textures": {
        "layer0": "yourMODID:items/name_of_the_picture_without_the_.png_at_the_and"
    }
}

and it looks for the picture which is .png here:
assets.yourMODID.textures.items.yourpicture.png

YES ITEMS NOT ITEM AND IN MODELS YES ITEM NOT ITEMS
I hope from here you can decode what jumps to where and what happens cause I am sure nobody will give a more detailed explanation here

  • Thanks 1
  • 3 months later...
Posted

Sorry for the very late reply, (I started to play other games *cough cough fortnite* and forgot about MC but got back to finishing my mod.) I have one more question. The ItemBasic class contains what? I am trying to register it but have no idea what to put instead of the previous version with the IHasModel. I updated my Github. Here

Posted (edited)

Remember how in the ModelRegistry event subscriber you registered the models of items like:

ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));

 

Well, just invoke the method with each item in your mod instead of checking for IHasModel first.

 

EDIT: Your current code should be fine. Just remove all references of IHasModel.

 

  On 3/31/2019 at 4:39 AM, DiamondMiner88 said:

ItemBasic class contains what?

Expand  

You should not be using anything like ItemBase of BlockBase (abusing inheritance).

Instantiate, add to your modItems, and register your items in the subscriber for RegistryEvent.Register<Item>; there is no need for an ItemBase.

Edited by DavidM

Some tips:

  Reveal hidden contents

 

Posted (edited)

Sorry i don't know what you mean by

  On 3/31/2019 at 5:24 AM, DavidM said:

invoke the method

Expand  

English is not my first language so i don't understand what that means.

Also in my ItemBase it says

ModItems.ITEMS.add(this);

and

@Override
public void registerModels() {
    Main.proxy.registerItemRenderer(this, 0, "inventory");
}

Since for the adding to the array one i already have a another one, do i just remove it?

The registerModels() I'm pretty sure i just remove it since i already have

@SubscribeEvent
public static void registerModels(ModelRegistryEvent event) {
    for (Item item : ModItems.itemArray) {
        registerModel(item);
    }
}

private static void registerModel(Item item) {
    ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
}

In my ModelRegistryHandler.

If i were to avoid ItemBasics, etc. how would i do that? What about changing options for it like

setCreativeTab(TabCharacterMod.TAB_CHARACTER_MOD);

Isin't what i already have the same as what you said?

Edited by DiamondMiner88
Posted (edited)
  On 3/31/2019 at 5:24 AM, DavidM said:

ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));

Expand  

This line of code registers the model for the item.

The “item” variable is an instance of an Item.

 

In order to register the models for all your items, run the line of code above for each one of your item; for each item, replace the “item” variable with that item.

 

  On 3/31/2019 at 2:35 PM, DiamondMiner88 said:

invoke the method

Expand  

This basically means “calling the method” (or running the method, if that’s easier to understand).

Edited by DavidM

Some tips:

  Reveal hidden contents

 

Posted

But I already have called

ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));

As i see, I made an item in ModItems and added it to the itemArray. Then in ModelRegistryHandler for every object in the array it calls that piece of code.

Since i already called that i remove

ModItems.ITEMS.add(this);

and

@Override
public void registerModels() {
    ModelRegistryHandler.//Here
}

Right?

And in my ClientProxy I have

@SubscribeEvent
public void registerItemRenderer(Item item, int meta, String id) {
    ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName(), id));
}

I remove that too since i already registered the model client-side?

Posted (edited)
  On 3/31/2019 at 2:35 PM, DiamondMiner88 said:

If i were to avoid ItemBasics, etc. how would i do that? What about changing options for it like

setCreativeTab(TabCharacterMod.TAB_CHARACTER_MOD);

Isin't what i already have the same as what you said?

Expand  

You can either 1) Do it in the constructor of your item or 2) Call the method son your item when you first instantiate it in Register<Item> subscriber.

 

  On 3/31/2019 at 3:14 PM, DiamondMiner88 said:

@Override public void registerModels() { ModelRegistryHandler.//Here }

Expand  

There is no need to put the method in your item class; all item models should be registered that way, and registering the model does not need any private data.

Therefore, just call

registerItemRenderer

for each of your item in the subscriber for ModelRegistryEvent.

 

In addition, the tutorial you are following has a lot of bad practices.

You might want to take a look at Cadiboo's example mod to learn about good practices for modding: https://github.com/Cadiboo/Example-Mod

Edited by DavidM

Some tips:

  Reveal hidden contents

 

Posted (edited)

Ur confusing me. Where do i call

  On 3/31/2019 at 3:24 PM, DavidM said:

registerItemRenderer

Expand  

from?

From what you said i understand that i should call registerItemRender in my ClientProxy from registerModels in my ModelRegistryHandler. Right?

And i think ill stick with ItemBases for now until i have the rest of the puzzle solved.

Thanks for linking me Cadiboo's mod though ill look through it.

Edited by DiamondMiner88

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

    • I’ve been reluctant in purchasing this blank atm card I heard about online because everything seems too good to be true, but I was convinced & shocked when my friend at my place of work got the card from "recoveryintelligent wozniak" & we both confirmed it really works, without delay I gave it a go. Ever since then I’ve been withdrawing $4950 daily from the card & the money has been in my own account. So glad I gave it a try at last and this card has really changed my life financially without getting caught, it really & truly works and it’s legal also made me rich!! If you need this card from "recoveryintelligent wozniak" then, Email: wozniakrecoveryintelligent AT zohomail . com    You can also contact them for the service below   Western Union Transfer Bank Transfer PayPal / Skrill Transfer Crypto Mining CashApp Transfer Bitcoin Loans Recover Stolen/Missing Crypto/Funds/Assets Email: wozniakrecoveryintelligent AT zohomail . com I’ve been reluctant in purchasing this blank atm card I heard about online because everything seems too good to be true, but I was convinced & shocked when my friend at my place of work got the card from "recoveryintelligent wozniak" & we both confirmed it really works, without delay I gave it a go. Ever since then I’ve been withdrawing $4950 daily from the card & the money has been in my own account. So glad I gave it a try at last and this card has really changed my life financially without getting caught, it really & truly works and it’s legal also made me rich!! If you need this card from "recoveryintelligent wozniak" then, Email: wozniakrecoveryintelligent AT zohomail . com    You can also contact them for the service below   Western Union Transfer Bank Transfer PayPal / Skrill Transfer Crypto Mining CashApp Transfer Bitcoin Loans Recover Stolen/Missing Crypto/Funds/Assets Email: wozniakrecoveryintelligent AT zohomail . com I’ve been reluctant in purchasing this blank atm card I heard about online because everything seems too good to be true, but I was convinced & shocked when my friend at my place of work got the card from "recoveryintelligent wozniak" & we both confirmed it really works, without delay I gave it a go. Ever since then I’ve been withdrawing $4950 daily from the card & the money has been in my own account. So glad I gave it a try at last and this card has really changed my life financially without getting caught, it really & truly works and it’s legal also made me rich!! If you need this card from "recoveryintelligent wozniak" then, Email: wozniakrecoveryintelligent AT zohomail . com    You can also contact them for the service below   Western Union Transfer Bank Transfer PayPal / Skrill Transfer Crypto Mining CashApp Transfer Bitcoin Loans Recover Stolen/Missing Crypto/Funds/Assets Email: wozniakrecoveryintelligent AT zohomail . com   I’ve been reluctant in purchasing this blank atm card I heard about online because everything seems too good to be true, but I was convinced & shocked when my friend at my place of work got the card from "recoveryintelligent wozniak" & we both confirmed it really works, without delay I gave it a go. Ever since then I’ve been withdrawing $4950 daily from the card & the money has been in my own account. So glad I gave it a try at last and this card has really changed my life financially without getting caught, it really & truly works and it’s legal also made me rich!! If you need this card from "recoveryintelligent wozniak" then, Email: wozniakrecoveryintelligent AT zohomail . com    You can also contact them for the service below   Western Union Transfer Bank Transfer PayPal / Skrill Transfer Crypto Mining CashApp Transfer Bitcoin Loans Recover Stolen/Missing Crypto/Funds/Assets Email: wozniakrecoveryintelligent AT zohomail . com
    • There is an issue with Modular Force Field System (mffs) Remove it or try other builds
    • I never imagined I would be writing this kind of testimony, but I feel it’s important to share my experience with Malice Cyber Recovery and how they helped me recover $230,000 I lost to crypto scammers. A few months ago, I got involved in a crypto investment opportunity that seemed legitimate at first. The scammers were incredibly convincing. They showed me impressive returns, sent regular updates, and even gave me access to what looked like a real trading platform. I was initially cautious, but after seeing the returns, I began to invest more, ultimately transferring over $230,000. Unfortunately, after a few weeks, when I tried to withdraw my funds, I found that the platform had disappeared, and I could no longer contact anyone involved. It was clear I had been scammed, and I felt completely helpless. For weeks, I tried everything to get my money back—contacting the authorities, reaching out to the platform’s so-called support team (who of course were unreachable), and trying to trace the transactions myself. But everything led to dead ends. The more I researched, the more I realized just how hard it was to recover stolen crypto. I began to lose hope. That’s when I came across Malice Cyber Recovery. At first, I was skeptical. Could they really help me recover my funds after everything I had been through? I decided to reach out anyway, just to see if they could offer any guidance. From the very first conversation, their team was not only professional but also deeply empathetic. They understood exactly how I was feeling and immediately made it clear that they were dedicated to helping me recover my lost funds. Malice Cyber Recovery’s team got to work quickly. They walked me through every step of the process, explaining the methods they would use to track down my stolen crypto. Their knowledge of blockchain technology and how to trace crypto transactions was incredibly impressive. They didn’t just give me vague promises they showed me the action they were taking and the progress they were making, which gave me hope that my money wasn’t gone forever. One of the most reassuring aspects of working with Malice Cyber Recovery was their transparency. They kept me updated regularly, letting me know what they were doing, what obstacles they encountered, and how they were overcoming them. It wasn’t an easy process; tracing funds through blockchain and dealing with scammers who hide behind fake identities and complex networks is incredibly difficult. But Malice Cyber Recovery’s team was relentless. They used advanced tools and techniques to trace the flow of my funds, and within just a few weeks, they managed to locate a significant portion of my lost funds. I couldn’t believe it when they informed me that they had successfully recovered a large chunk of my money. I never thought I’d see that $230,000 again. The recovery process wasn’t instantaneous it  took time, patience, and persistence but Malice Cyber Recovery delivered on their promise.  
    • Almost, just the java -server -Xmx4G -Xms4G -Dlog4j.configurationFile=log4jformattingfix.xml -jar forge-1.12.2-14.23.5.2860.jar nogui and if that doesn't work, try java --version
    • What so just copy and paste " java -server -Xmx4G -Xms4G -Dlog4j.configurationFile=log4jformattingfix.xml -jar forge-1.12.2-14.23.5.2860.jar nogui Pause >nul " into a cmd terminal? If that's what you mean, nothing happens
  • Topics

×
×
  • Create New...

Important Information

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