Jump to content

Recommended Posts

Posted

Hey everyone, I have an item that when the constructor is called, it registers a new crafting recipe for every item in the entire game (including metadata). However it's texture is not working, it renders as a block with the missing texture texture.

This is my main code:

package com.example.examplemod;

import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;

@Mod(modid = ItemsOStupidity.MODID, version = ItemsOStupidity.VERSION)
public class ItemsOStupidity {
public static final String MODID = "itemsofstupidity";
public static final String VERSION = "1.0";
public static Item itemMultiplier;
public static Item itemRodCore;

@EventHandler
public void preinit(FMLPreInitializationEvent event) {
	itemMultiplier = new ItemMultiplier();
	// itemRodCore = new ItemRodCore();
	if (event.getSide() == Side.CLIENT) {
		Minecraft
				.getMinecraft()
				.getRenderItem()
				.getItemModelMesher()
				.register(
						itemMultiplier,
						0,
						new ModelResourceLocation("itemsofstupidity:stupidMultiplier",
								"inventory"));
	}
}

@EventHandler
public void init(FMLInitializationEvent event) {

}

}

This is my item class:

package com.example.examplemod;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.common.registry.LanguageRegistry;
import scala.actors.threadpool.Arrays;

public class ItemMultiplier extends Item {

private final String name = "stupidMultiplier";

public ItemMultiplier() {
	GameRegistry.registerItem(this, name);
	LanguageRegistry.addName(this, "Multiplier");
	setUnlocalizedName(ItemsOStupidity.MODID + ":" + name);
	setCreativeTab(CreativeTabs.tabTools);
	Iterator iterator = Item.itemRegistry.iterator();
	while(iterator.hasNext()) {
		Item i = (Item) iterator.next();
		for(int meta = 0; meta < 100; meta++) {
			GameRegistry.addShapelessRecipe(new ItemStack(i, 2, meta), new ItemStack(i, 1, meta), this);
		}
	}
}

public String getName() {
	return name;
}
}

And this is my JSON file:

{
    "parent": "builtin/generated",
    "textures": {
        "layer0": "itemsofstupidity:items/stupidMultiplier"
    },
    "display": {
        "thirdperson": {
            "rotation": [ -90, 0, 0 ],
            "translation": [ 0, 1, -3 ],
            "scale": [ 0.55, 0.55, 0.55 ]
        },
        "firstperson": {
            "rotation": [ 0, -135, 25 ],
            "translation": [ 0, 4, 2 ],
            "scale": [ 1.7, 1.7, 1.7 ]
        }
    }
}

And this is what's in the package explorer:

5iraa.jpg

Posted

1. First, don't use event.getSide() == Side.CLIENT. You should use proxies for the purpose.

2. Show your Console log.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted

I forgot how to use proxies though, and the tutorials are outdated. What is the difference between getSide and proxies?

Also this is my log:

[21:06:29] [main/INFO] [GradleStart]: Extra: []
[21:06:30] [main/INFO] [GradleStart]: Running with arguments: [--userProperties, {}, --accessToken, {REDACTED}, --assetIndex, 1.8, --assetsDir, C:/Users/Gaming/.gradle/caches/minecraft/assets, --version, 1.8, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.GradleStartCommon$GradleStartTweaker]
[21:06:30] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker
[21:06:30] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker
[21:06:30] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.GradleStartCommon$GradleStartTweaker
[21:06:30] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLTweaker
[21:06:30] [main/INFO] [FML]: Forge Mod Loader version 8.0.20.1023 for Minecraft 1.8 loading
[21:06:30] [main/INFO] [FML]: Java is Java HotSpot(TM) 64-Bit Server VM, version 1.7.0_71, running on Windows 7:amd64:6.1, installed at C:\Program Files\Java\jre7
[21:06:30] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation
[21:06:30] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.GradleStartCommon$GradleStartTweaker
[21:06:30] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.fml.relauncher.FMLCorePlugin
[21:06:30] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[21:06:30] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[21:06:30] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[21:06:30] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[21:06:30] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[21:06:30] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work!
[21:06:32] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing
[21:06:32] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[21:06:33] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker
[21:06:33] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker
[21:06:33] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main}
[21:06:34] [Client thread/INFO]: Setting user: Player808
[21:06:34] [Client thread/INFO]: (Session ID is token:FML:Player808)
[21:06:38] [Client thread/INFO]: LWJGL Version: 2.9.1
[21:06:39] [Client thread/INFO] [MinecraftForge]: Attempting early MinecraftForge initialization
[21:06:39] [Client thread/INFO] [MinecraftForge]: Completed early MinecraftForge initialization
[21:06:39] [Client thread/INFO] [FML]: Searching C:\Users\Gaming\Downloads\The Items of Stupidity\eclipse\mods for mods
[21:06:39] [Client thread/INFO] [itemsofstupidity]: Mod itemsofstupidity is missing the required element 'name'. Substituting itemsofstupidity
[21:06:43] [Client thread/INFO] [FML]: Forge Mod Loader has identified 3 mods to load
[21:06:43] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, itemsofstupidity] at CLIENT
[21:06:43] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, itemsofstupidity] at SERVER
[21:06:43] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:itemsofstupidity
[21:06:44] [Client thread/INFO] [FML]: Processing ObjectHolder annotations
[21:06:44] [Client thread/INFO] [FML]: Found 384 ObjectHolder annotations
[21:06:44] [Client thread/INFO] [FML]: Applying holder lookups
[21:06:44] [Client thread/INFO] [FML]: Holder lookups applied
[21:06:44] [Client thread/ERROR] [FML]: Fatal errors were detected during the transition from PREINITIALIZATION to INITIALIZATION. Loading cannot continue
[21:06:44] [Client thread/ERROR] [FML]: 
mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized
FML{8.0.20.1023} [Forge Mod Loader] (fmlSrc-1.8-8.0.20.1023-1.8.jar) Unloaded->Constructed->Pre-initialized
itemsofstupidity{1.0} [itemsofstupidity] (bin) Unloaded->Constructed->Errored
[21:06:44] [Client thread/ERROR] [FML]: The following problems were captured during this phase
[21:06:44] [Client thread/ERROR] [FML]: Caught exception from itemsofstupidity
java.lang.NullPointerException
at com.example.examplemod.ItemsOStupidity.preinit(ItemsOStupidity.java:34) ~[bin/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_71]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_71]
at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:515) ~[fmlSrc-1.8-8.0.20.1023-1.8.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_71]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_71]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) ~[fmlSrc-1.8-8.0.20.1023-1.8.jar:?]
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:187) ~[fmlSrc-1.8-8.0.20.1023-1.8.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_71]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_71]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:118) [LoadController.class:?]
at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:514) [Loader.class:?]
at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:243) [FMLClientHandler.class:?]
at net.minecraft.client.Minecraft.startGame(Minecraft.java:413) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:326) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_71]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_71]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:85) [start/:?]
at GradleStart.main(GradleStart.java:45) [start/:?]
[21:06:44] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:568]: ---- Minecraft Crash Report ----
// Shall we play a game?

Time: 26.02.15 21:06
Description: Initializing game

java.lang.NullPointerException: Initializing game
at com.example.examplemod.ItemsOStupidity.preinit(ItemsOStupidity.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:515)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:208)
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:187)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:118)
at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:514)
at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:243)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:413)
at net.minecraft.client.Minecraft.run(Minecraft.java:326)
at net.minecraft.client.main.Main.main(Main.java:117)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:85)
at GradleStart.main(GradleStart.java:45)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Stacktrace:
at com.example.examplemod.ItemsOStupidity.preinit(ItemsOStupidity.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:515)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:208)
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:187)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:118)
at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:514)
at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:243)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:413)

-- Initialization --
Details:
Stacktrace:
at net.minecraft.client.Minecraft.run(Minecraft.java:326)
at net.minecraft.client.main.Main.main(Main.java:117)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:85)
at GradleStart.main(GradleStart.java:45)

-- System Details --
Details:
Minecraft Version: 1.8
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.7.0_71, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 650921608 bytes (620 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v9.10 FML v8.0.20.1023 3 mods loaded, 3 mods active
mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized
FML{8.0.20.1023} [Forge Mod Loader] (fmlSrc-1.8-8.0.20.1023-1.8.jar) Unloaded->Constructed->Pre-initialized
itemsofstupidity{1.0} [itemsofstupidity] (bin) Unloaded->Constructed->Errored
Launched Version: 1.8
LWJGL: 2.9.1
OpenGL: GeForce GT 630/PCIe/SSE2 GL version 4.4.0 NVIDIA 344.75, NVIDIA Corporation
GL Caps: Using GL 1.3 multitexturing.
Using GL 1.3 texture combiners.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Shaders are available because OpenGL 2.1 is supported.
VBOs are available because OpenGL 1.5 is supported.

Using VBOs: No
Is Modded: Definitely; Client brand changed to 'fml'
Type: Client (map_client.txt)
Resource Packs: []
Current Language: English (US)
Profiler Position: N/A (disabled)
[21:06:44] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:568]: #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\Gaming\Downloads\The Items of Stupidity\eclipse\.\crash-reports\crash-2015-02-26_21.06.44-client.txt

Posted

The difference is, you cannot access to the client only classes like Minecraft in if(getSide==Side.CLIENT), so your code would crash on Dedicated Server. So you need proxies.

And, you got a crash! Why didn't you say that..

+ post your current code, since the crash cannot be occured by the old code posted.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted

But I didn't change anything,

ItemsOStupidity.java

package com.example.examplemod;

import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;

@Mod(modid = ItemsOStupidity.MODID, version = ItemsOStupidity.VERSION)
public class ItemsOStupidity {
public static final String MODID = "itemsofstupidity";
public static final String VERSION = "1.0";
public static Item itemMultiplier;
public static Item itemRodCore;

@EventHandler
public void preinit(FMLPreInitializationEvent event) {
	itemMultiplier = new ItemMultiplier();
	// itemRodCore = new ItemRodCore();
	if (event.getSide() == Side.CLIENT) {
		Minecraft
				.getMinecraft()
				.getRenderItem()
				.getItemModelMesher()
				.register(
						itemMultiplier,
						0,
						new ModelResourceLocation("itemsofstupidity:stupidMultiplier",
								"inventory"));
	}
}

@EventHandler
public void init(FMLInitializationEvent event) {

}

}

 

ItemMultiplier.java

package com.example.examplemod;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.common.registry.LanguageRegistry;
import scala.actors.threadpool.Arrays;

public class ItemMultiplier extends Item {

private final String name = "stupidMultiplier";

public ItemMultiplier() {
	GameRegistry.registerItem(this, name);
	LanguageRegistry.addName(this, "Multiplier");
	setUnlocalizedName(ItemsOStupidity.MODID + ":" + name);
	setCreativeTab(CreativeTabs.tabTools);
	Iterator iterator = Item.itemRegistry.iterator();
	while(iterator.hasNext()) {
		Item i = (Item) iterator.next();
		for(int meta = 0; meta < 100; meta++) {
			GameRegistry.addShapelessRecipe(new ItemStack(i, 2, meta), new ItemStack(i, 1, meta), this);
		}
	}
}

public String getName() {
	return name;
}
}

 

stupidMultiplier.json

{
    "parent": "builtin/generated",
    "textures": {
        "layer0": "itemsofstupidity:items/stupidMultiplier"
    },
    "display": {
        "thirdperson": {
            "rotation": [ -90, 0, 0 ],
            "translation": [ 0, 1, -3 ],
            "scale": [ 0.55, 0.55, 0.55 ]
        },
        "firstperson": {
            "rotation": [ 0, -135, 25 ],
            "translation": [ 0, 4, 2 ],
            "scale": [ 1.7, 1.7, 1.7 ]
        }
    }
}

Posted

I tried to do this:

ItemsOStupidity.java

package org.midnightas.mc.mod.itemsostupidity;

import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;

@Mod(modid = ItemsOStupidity.MODID, version = ItemsOStupidity.VERSION)
public class ItemsOStupidity {
public static final String MODID = "itemsofstupidity";
public static final String VERSION = "1.0";
public static Item itemMultiplier;
public static Item itemRodCore;

@SidedProxy(clientSide = "org.midnightas.mc.mod.itemsostupidity.StupidClientProxy", serverSide = "org.midnightas.mc.mod.itemsostupidity.StupidCommonProxy")
public static StupidCommonProxy proxy;

@EventHandler
public void preinit(FMLPreInitializationEvent event) {
	itemMultiplier = new ItemMultiplier();
	// itemRodCore = new ItemRodCore();
}

@EventHandler
public void init(FMLInitializationEvent event) {
	proxy.registerRenderers();
}

}

ItemMultiplier i did not change.

 

StupidCommonProxy.java

package org.midnightas.mc.mod.itemsostupidity;

public class StupidCommonProxy {

public void registerRenderers() {

}

}

 

StupidClientProxy.java

package org.midnightas.mc.mod.itemsostupidity;

public class StupidCommonProxy {

public void registerRenderers() {

}

}

 

stupidMultiplier.json I did not change.

Posted

Oh, sorry.

package org.midnightas.mc.mod.itemsostupidity;

import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelResourceLocation;

public class StupidClientProxy extends StupidCommonProxy {

@Override
public void registerRenderers() {
	Minecraft
			.getMinecraft()
			.getRenderItem()
			.getItemModelMesher()
			.register(
					ItemsOStupidity.itemMultiplier,
					0,
					new ModelResourceLocation(
							"itemsofstupidity:stupidMultiplier",
							"inventory"));
}

}

(StupidClientProxy.java)

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



×
×
  • Create New...

Important Information

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