Jump to content

Recommended Posts

Posted (edited)

Hello I have a problem in 1.12 at the line "GameRegistry.register (item);

can you help me here is my code:

 

package com.cubicdeath.blocks;

import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class CubicDeath_Blocks{
	public CubicDeath_Blocks() {
		initItems();
		registerItem(logo);
		registerRender(logo, 0);
	}
	public Item logo;
	public void initItems() {
		logo = new Item().setRegistryName("logo").setUnlocalizedName("logo");
	}
	@SideOnly(Side.CLIENT)
	public void registerItem(Item item) {
		GameRegistry.register(item);
	}
	public void registerRender(Item item, int meta) {
		ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(new ResourceLocation("test", item.getUnlocalizedName().substring(5)), "inventory"));
	}
}
	
	

 

Edited by LeChevalierD_Or
Posted
Quote

1.12

Quote

"GameRegistry.register (item);

You're doing everything wrong. You need to use the Registry events.

http://mcforge.readthedocs.io/en/latest/concepts/registries/#registering-things

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

Hello,
Thank you for your answer.

here is my code now:

 

 

package com.cubicdeath.blocks;

import net.minecraft.block.Block;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder;

public class CubicDeath_Blocks{
	
	
	@SubscribeEvent
	public void registerBlocks(RegistryEvent.Register<Block> event) {
		event.getResult().registerAll(Block1);
	}
}

 

 

Can you now give me the whole code with a block and features so that I can understand better.

Thank you in advance .

Posted (edited)
1 hour ago, LeChevalierD_Or said:

 


public class CubicDeath_Blocks{
	@SubscribeEvent
	public void registerBlocks(RegistryEvent.Register<Block> event) {
		event.getResult().registerAll(Block1);
	}
}

 

Your original code had you trying to register an item named logo.

In this code you're trying to register a block named Block1 (which doesn't exist).

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 send this to some other people too but,

 

In the new 1.12.2 version you need to use the new way of registering with the new RegistryEvent<T> 

 

Try and read the documentation on at mcforge.readthedocs.io/en/latest/concepts/registries/

 

If you arent known with events check out this https://mcforge.readthedocs.io/en/latest/events/intro/

 

I could advice you to check out this repo from Harry'sTechreviews: a youtuber, you can also check out his video on it

https://github.com/HarryTechRevs/MinecraftModding/tree/HarryTechRevs-1.12.2-Tutorials/main/java/harry/mod

 

Posted
Just now, tebreca said:

 

I send this to some other people too but,

 

In the new 1.12.2 version you need to use the new way of registering with the new RegistryEvent<T> 

 

Try and read the documentation on at mcforge.readthedocs.io/en/latest/concepts/registries/

 

If you arent known with events check out this https://mcforge.readthedocs.io/en/latest/events/intro/

 

I could advice you to check out this repo from Harry'sTechreviews: a youtuber, you can also check out his video on it

https://github.com/HarryTechRevs/MinecraftModding/tree/HarryTechRevs-1.12.2-Tutorials/main/java/harry/mod

 

 

1 hour ago, LeChevalierD_Or said:

Hello,
Thank you for your answer.

here is my code now:

 

 


package com.cubicdeath.blocks;

import net.minecraft.block.Block;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder;

public class CubicDeath_Blocks{
	
	
	@SubscribeEvent
	public void registerBlocks(RegistryEvent.Register<Block> event) {
		event.getResult().registerAll(Block1);
	}
}

 

 

Can you now give me the whole code with a block and features so that I can understand better.

Thank you in advance .

also you need to register your class as a @EventBusSubscriber

is pretty easy with just the @mod.eventbussubsriber annonation

 

Posted (edited)

Hi, I would like to know if until I get well: xD

 

package com.cubicdeath.blocks;


import net.minecraft.item.Item;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.registries.IForgeRegistry;

@Mod(modid = Main.modId, name = Main.name, version = Main.version)
public class Main {

	public static final String modId = "cubicdeath_block";
	public static final String name = "CubicDeath Block";
	public static final String version = "1.0.0";

	@Mod.Instance(modId)
	public static Main instance;
	
	@SidedProxy(serverSide = "com.cubicdeath.blocks.CommonProxy", clientSide = "com.cubicdeath.blocks.ClientProxy")
	public static CommonProxy proxy;

	@Mod.EventHandler
	public void preInit(FMLPreInitializationEvent event) {
		System.out.println(name + " Et en chargement...");
	}

	@Mod.EventHandler
	public void init(FMLInitializationEvent event) {
		
	}

	@Mod.EventHandler
	public void postInit(FMLPostInitializationEvent event) {
		
	}

	@Mod.EventBusSubscriber
	public static class RegistrationHandler {
	
		@SubscribeEvent
		public static void registerItems(RegistryEvent.Register<Item> event) {
			Main.register(event.getRegistry());
		}
			@SubscribeEvent
			public static void registerItems(ModelRegistryEvent event) {
				Main.registerModels();
				
			}
		}
		
	
	public static void register(IForgeRegistry<Item> registry) {
		
		
	}
	public static void registerModels() {
	
		
	}
}
	


	
	

 

Edited by LeChevalierD_Or
Posted (edited)

Hi, there seems to be a problem but I do not know how to help you.
Explanations: When I run the game via eclipse and I go in the CreativeTabs "BuildingsBlocks" I can not find my item CopperIngot = (

Please help me =)

Here is a folder where there are all my classes =)
Thank you in advance ...

error.zip

Edited by LeChevalierD_Or
Posted
	public static void register(IForgeRegistry<Item> registry) {
		//something goes here maybe? I dunno. Maybe something to register my items?
	}

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

Your methods do jack diddly squat.

They are empty.

They need to not be empty.

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

geico-gecko-facepalm.jpg

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 believe your biggest problem is likely a lack of java knowledge. You really do need to know at least intermediate java/OOP in order to make mods for Minecraft. Otherwise you will struggle a LOT with the simplest of blocks and items, nevermind making anything actually cool/different/exciting.

 

http://www.minecraftforge.net/forum/topic/49497-1112-is-using-registryevent-this-way-ok/

 

This post shows how to register items, blocks, and their models.

 

If someone just writes the code for you and/or gives you the complete answer, you will be right back here stuck again unless you have some programming skills. I'm not trying to be mean, just stating what is true. There are a lot of guys on here that have been here a long time, and you won't get a nice answer out of them if you lack even rudimentary java skills, as this forum is not a place to learn how to program.

Posted
4 hours ago, Ugdhar said:

Je crois que votre plus gros problème est probablement un manque de connaissances Java. Vous avez vraiment besoin de connaître au moins intermédiaire Java / OOP afin de faire des mods pour Minecraft. Sinon, vous aurez beaucoup de mal avec le plus simple des blocs et des objets, sans jamais faire quoi que ce soit de vraiment cool / différent / excitant.

 

http://www.minecraftforge.net/forum/topic/49497-1112-is-using-registryevent-this-way-ok/

 

Ce message montre comment enregistrer des éléments, des blocs et leurs modèles.

 

Si quelqu'un vous écrit simplement le code et / ou vous donne la réponse complète, vous serez à nouveau coincé ici à moins que vous n'ayez des compétences en programmation. Je n'essaie pas d'être méchant, juste en disant ce qui est vrai. Il y a beaucoup de gars ici depuis longtemps et vous n'obtiendrez pas une bonne réponse si vous n'avez même pas de compétences java rudimentaires, car ce forum n'est pas un endroit pour apprendre à programmer.

 

Negative I have a very good knowledge of JAVA but not in forge!

 

Posted
20 hours ago, Draco18s said:

They are empty.

They need to not be empty.

20 hours ago, Draco18s said:

not be empty.

20 hours ago, LeChevalierD_Or said:

So can I delete them?

 

You tell me.

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 (edited)
	public static void register(IForgeRegistry<Item> registry) {
		registry.registerAll(ingotCopper);
	}


	public static void registerModels() {
		ingotCopper.registerItemModel();
	}
}

 

if that's what you expect from me I've already put it in another class!

 

Edited by LeChevalierD_Or

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

    • When I first heard about Bitcoin back in 2018, I was skeptical. The idea of a decentralized, digital currency seemed too good to be true. But I was intrigued as I learned more about the technology behind it and its potential. I started small, investing just a few hundred dollars, dipping my toes into the cryptocurrency waters. At first, it was exhilarating to watch the value of my investment grow exponentially. I felt like I was part of the future, an early adopter of this revolutionary new asset. But that euphoria was short-lived. One day, I logged into my digital wallet only to find it empty - my Bitcoin had vanished without a trace. It turned out that the online exchange I had trusted had been hacked, and my funds were stolen. I was devastated, both financially and emotionally. All the potential I had seen in Bitcoin was tainted by the harsh reality that with decentralization came a lack of regulation and oversight. My hard-earned money was gone, lost to the ether of the digital world. This experience taught me a painful lesson about the price of trust in the uncharted territory of cryptocurrency. While the technology holds incredible promise, the risks can be catastrophic if you don't approach it with extreme caution. My Bitcoin investment gamble had failed, and I was left to pick up the pieces, wiser but poorer for having placed my faith in the wrong hands. My sincere appreciation goes to MUYERN TRUST HACKER. You are my hero in recovering my lost funds. Send a direct m a i l ( muyerntrusted ( @ ) mail-me ( . )c o m ) or message on whats app : + 1 ( 4-4-0 ) ( 3 -3 -5 ) ( 0-2-0-5 )
    • You could try posting a log (if there is no log at all, it may be the launcher you are using, the FAQ may have info on how to enable the log) as described in the FAQ, however this will probably need to be reported to/remedied by the mod author.
    • So me and a couple of friends are playing with a shitpost mod pack and one of the mods in the pack is corail tombstone and for some reason there is a problem with it, where on death to fire the player will get kicked out of the server and the tombstone will not spawn basically deleting an entire inventory, it doesn't matter what type of fire it is, whether it's from vanilla fire/lava, or from modded fire like ice&fire/lycanites and it's common enough to where everyone on the server has experienced at least once or twice and it doesn't give any crash log. a solution to this would be much appreciated thank you!
    • It is 1.12.2 - I have no idea if there is a 1.12 pack
  • Topics

×
×
  • Create New...

Important Information

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