
Hexadecimal
Members-
Posts
26 -
Joined
-
Last visited
Everything posted by Hexadecimal
-
[1.11.2] Difficulty Adding an item with a Texture
Hexadecimal replied to Hexadecimal's topic in Modder Support
Thank you very much. It works now and I can see the texture. -
[1.11.2] Difficulty Adding an item with a Texture
Hexadecimal replied to Hexadecimal's topic in Modder Support
So I made the method static and apparently it's worked but I'm encountering this error that I had a while back: I looked this up before and it said it was because there was no unlocalized name until it reached the init or something like that. It uses registry name now but the same principle may apply. Or it's something else. -
[1.11.2] Difficulty Adding an item with a Texture
Hexadecimal replied to Hexadecimal's topic in Modder Support
So I added @Mod.EventBusSubscriber to the top of my events class and I still have nothing in the console which I printed and there is no texture either. This is what the class looks like: package com.coal; import com.coal.item.ModItems; import net.minecraftforge.client.event.ModelRegistryEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @Mod.EventBusSubscriber public class BasicEvents { @SubscribeEvent public void onModelRegistry(ModelRegistryEvent event){ System.out.println("=======================" + "=========================" + "Model Registered! " ); ModItems.registerRenders(); } } -
[1.11.2] Difficulty Adding an item with a Texture
Hexadecimal replied to Hexadecimal's topic in Modder Support
How do I use EventBusSubscriber? I've tried this: @EventBusSubscriber(new BasicEvents()) Which informs me that BasicEvents() cannot be converted to side. Same error when I try this: @EventBusSubscriber(MinecraftForge.EVENT_BUS.register(new BasicEvents())) -
[1.11.2] Difficulty Adding an item with a Texture
Hexadecimal replied to Hexadecimal's topic in Modder Support
It isn't being fired for some reason: Events Class: package com.coal; import com.coal.item.ModItems; import net.minecraftforge.client.event.ModelRegistryEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class BasicEvents { @SubscribeEvent public void onModelRegistry(ModelRegistryEvent event){ System.out.println("=======================" + "=========================" + "Models Registered! " ); ModItems.registerRenders(); } } Main: package com.coal; import com.coal.item.ModItems; import static com.coal.item.ModItems.obsidianSword; import net.minecraftforge.client.event.ModelRegistryEvent; import net.minecraftforge.common.MinecraftForge; 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.eventhandler.SubscribeEvent; @Mod(modid = BasicMod.MODID, version = BasicMod.VERSION) public class BasicMod { public static final String MODID = "basicmod"; public static final String VERSION = "1.0"; BasicEvents events = new BasicEvents(); @EventHandler public void preInit(FMLInitializationEvent event) { System.out.println("Started Pre-Init!"); MinecraftForge.EVENT_BUS.register(events); } @EventHandler public void init(FMLInitializationEvent event) { ModItems.preinit(); System.out.println("Started Init!"); //ModItems.registerRenders(); System.out.println(obsidianSword.getUnlocalizedName()); } @EventHandler public void postInit(FMLInitializationEvent event) { System.out.println("Started PostInit!"); } } Have I registered it incorrectly? -
[1.11.2] Difficulty Adding an item with a Texture
Hexadecimal replied to Hexadecimal's topic in Modder Support
It's a cube with purple and black squares. There is nothing in the logs, no errors or anything. -
[1.11.2] Difficulty Adding an item with a Texture
Hexadecimal replied to Hexadecimal's topic in Modder Support
Sorry for the late response but there is nothing in the logs. Nothing at all. No error. Nothing. -
[1.11.2] Difficulty Adding an item with a Texture
Hexadecimal replied to Hexadecimal's topic in Modder Support
Thanks, that fixed the errors but I still can't see my texture... Is there anything wrong with my json file? -
[1.11.2] Difficulty Adding an item with a Texture
Hexadecimal replied to Hexadecimal's topic in Modder Support
1. oops! My mistake! Fixed on the thread now. 2. So my file is actually called "item.obsidiansword" instead of being obsidiansword in the package item? I don't see where I've managed to do that though... Is it the unlocalized name? -
So I've tried to get used to the new mechanics in 1.9+ forge and I'm having a few issues. I'm doing this in netbeans because I wanted to try something new. I've tried to create a basic item, an Obsidian sword. My Code: ObsidianSword.java package com.coal.item.items; import com.coal.BasicMod; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; public class ObsidianSword extends Item{ public ObsidianSword(){ super(); this.setCreativeTab(CreativeTabs.COMBAT); this.setUnlocalizedName("obsidiansword"); } } ModItems.java package com.coal.item; import com.coal.BasicMod; import com.coal.item.items.ObsidianSword; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.ItemMeshDefinition; 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; public final class ModItems { public static Item obsidianSword; public static final void preinit(){ obsidianSword = registerItem(new ObsidianSword(), "obsidiansword"); } public static final void registerRenders(){ registerRender(obsidianSword); } private static final void registerRender(Item i){ ModelLoader.setCustomModelResourceLocation(i, 0, new ModelResourceLocation(BasicMod.MODID + ":" + i.getUnlocalizedName(), "inventory")); } private static final Item registerItem(Item i, String n){ GameRegistry.register(i, new ResourceLocation(BasicMod.MODID, n)); return i; } } Main Class: package com.coal; import com.coal.item.ModItems; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.event.FMLInitializationEvent; @Mod(modid = BasicMod.MODID, version = BasicMod.VERSION) public class BasicMod { public static final String MODID = "basicmod"; public static final String VERSION = "1.0"; @EventHandler public void preInit(FMLInitializationEvent event) { System.out.println("Started Pre-Init!"); } @EventHandler public void init(FMLInitializationEvent event) { ModItems.preinit(); System.out.println("Started Init!"); ModItems.registerRenders(); } @EventHandler public void postInit(FMLInitializationEvent event) { System.out.println("Started PostInit!"); } } obsidiansword.json { "parent": "item/generated", "textures":{ "layer0":"basicmod:items/obsidiansword" } } My Project Structure: Whenever I run it I get this in the log: For some reason it seems to think the json is in item.item which doesn't exist. But I've tried making another folder called item and adjusting it and it still gives exactly the same error. I've been following multiple tutorials so I'm sure I've done a billion things wrong. If anyone could help it would be greatly appreciated!
-
I'm trying to setup a fresh 1.11.2 Gradlew workspace. I run "gradlew setupDecompWorkspace --refresh-dependencies" but it fails. Here is the output: The website export.mcbot.bspk.rs is also apparently down, could this have something to do with it? This is line 32 of my build.gradle, as pointed out by the console: mappings = "snapshot_20161111" Help would be appreciated!
-
So I've been asked by a friend to make a mod which will get some info about players from public APIs. Specifically for the Hypixel guild system. This is my code: Main Class: Command used to get the info: PlayerUUID Getter; Hypixel API Reader: When I run it I get this error: I know this is a lot to go through and I've probably made many stupid mistakes with the JSON. If so could anybody point out where I've gone wrong?
-
[1.8.9] Extending the Chat Character limit to 256
Hexadecimal replied to Hexadecimal's topic in Modder Support
I don't suppose there is an event for Chat Opened in Forge? There is an OpenGui event look under the net.minecraftforge.events package I'm still getting a Null Pointer. The code is fired when I open the chat (managed to do that), but it's still null... -
[1.8.9] Extending the Chat Character limit to 256
Hexadecimal replied to Hexadecimal's topic in Modder Support
My MCP fix does work as I have tested it thoroughly. As I said in my main post the server has a plugin which SUPPORTS double the chat limit. -
[1.8.9] Extending the Chat Character limit to 256
Hexadecimal replied to Hexadecimal's topic in Modder Support
I don't suppose there is an event for Chat Opened in Forge? -
[1.8.9] Extending the Chat Character limit to 256
Hexadecimal replied to Hexadecimal's topic in Modder Support
Yes. When I print gui it returns null. This is being executed in the pre-init by the way. I'm not sure if that means the variable hasn't been initialised yet or something. -
[1.8.9] Extending the Chat Character limit to 256
Hexadecimal replied to Hexadecimal's topic in Modder Support
Getting a null pointer: GuiTextField gui = ReflectionHelper.getPrivateValue(GuiChat.class, gc, "inputField"); gui.setMaxStringLength(256); It's on the gui.setMaxStringLength Please be patient, I know it's frustrating but I'm learning and I've never had to use reflection before... -
[1.8.9] Extending the Chat Character limit to 256
Hexadecimal replied to Hexadecimal's topic in Modder Support
I'm still a little confused. How does one invoke a method from a field? Edit: I think I may have it: My new code: Field f = fields[8]; f.setAccessible(true); Object fieldValue = f.get(gc); Method method = fieldValue.getClass().getDeclaredMethod("setMaxStringLength"); method.invoke(fieldValue, 256); Edit: Nope, got this error: java.lang.NoSuchMethodException: java.lang.String.setMaxStringLength() It's referencing java.lang.String, it's supposed to be GuiTextField... -
[1.8.9] Extending the Chat Character limit to 256
Hexadecimal replied to Hexadecimal's topic in Modder Support
How though? fields[8] has no method .getValue... I also tried this method I found online: Object c = f.get(gc); Printing c.toString() returns a null pointer exception. -
[1.8.9] Extending the Chat Character limit to 256
Hexadecimal replied to Hexadecimal's topic in Modder Support
I've done this: public class ExtendedChatGui { private String defaultTextField = ""; public static GuiChat gc = new GuiChat(); public void printField() throws Exception { Class<?> objClass = gc.getClass(); Field[] fields = objClass.getDeclaredFields(); System.out.println("Printing fields: "); for (Field field : fields) { field.setAccessible(true); String name = field.getName(); System.out.println(name); } } } This prints all the fields, including inputField, which is the variable I need. This is the variable: protected GuiTextField inputField; The issue is, to set the max string length a method is called like so: this.inputField.setMaxStringLength(255); How would I go about calling this method from the array of fields I have? -
Recently I've found a need to extend the chat limit in 1.8.9, it is really useful being twice its normal size in 1.10 and above and I want it in 1.8.9. The server I want to use this mod on allows the increased chat limit across all versions and so it needs to actually be sent as a message. I've accomplished this with MCP (you literally just need to change one variable pretty much) but I would like to know how to do it in forge. I've done some research and most people seem to suggest class transformers, however these seem extremely complex and apparently need to be coded myself if they are to work - I have no clue where to start with this. If anybody knew of any alternatives to class transformers, or could give me any pointers I would greatly appreciate it!