Jump to content

Recommended Posts

Posted

Hello All,I have new problem:

Today I do an armor in my mod...

The code that I used is:

public static Item ModdedHelmet = new ItemArmorModdedHelmet(2837, "ModdedHelmet", ModdedArmor1, ModLoader.addArmor("Modded"), 0).setUnlocalizedName("HelmetModded").setCreativeTab(mod_modification.tabus);

It work,but if I start a server with this mod, it crash. I read that the "ModLoader.addArmor" isn't for smp...

Then I search and I find that the proxy can resolve my problem...

But when I do it the mod crash...

Main Code:

@Mod(modid = "moddingmod", name = "Modded Mod", version = "1.0")
@NetworkMod(clientSideRequired = true , serverSideRequired = true)
public class mod_modded {
@SidedProxy(clientSide = "Modding.ClientProxy", serverSide = "Modding.CommonProxy")
@Instance("modding")
public static mod_modded instance;
public static Item ModdedHelmet = new ItemArmorModdedHelmet(2837, "ModdedHelmet", ModdedArmor1, ModLoader.addArmor("Modded"), 0).setUnlocalizedName("HelmetModded").setCreativeTab(mod_modification.tabus);
public void load(){
	GameRegistry.registerItem(ModdedHelmet, "Helmet Armor");
	LanguageRegistry.addName(ModdedHelmet, "HelmetArmor");
}

CommonProxy Code:

public class CommonProxy {
public void registerRenderInformation()
    {
        MinecraftForgeClient.preloadTexture(null);
    }
public int addArmor(String armor)
    {
        return RenderingRegistry.addNewArmourRendererPrefix(armor);
    }
}

ClientProxy Code:

public class ClientProxy extends CommonProxy {
@Override
public void registerRenderInformation()
    {
        MinecraftForgeClient.preloadTexture(null);
    }
@Override
    public int addArmor(String armor)
    {
        return RenderingRegistry.addNewArmourRendererPrefix(armor);
    }
}

 

I try it on the Main Code:

@Mod(modid = "moddingmod", name = "Modded Mod", version = "1.0")
@NetworkMod(clientSideRequired = true , serverSideRequired = true)
public class mod_modded {
@SidedProxy(clientSide = "Modding.ClientProxy", serverSide = "Modding.CommonProxy")
@Instance("modding")
public static mod_modded instance;
public static Item ModdedHelmet = new ItemArmorModdedHelmet(2837, "ModdedHelmet", ModdedArmor1, proxy.addArmor("Modded"), 0).setUnlocalizedName("HelmetModded").setCreativeTab(mod_modification.tabus);
public void load(){
proxy.registerRenderThings();
	GameRegistry.registerItem(ModdedHelmet, "Helmet Armor");
	LanguageRegistry.addName(ModdedHelmet, "HelmetArmor");
}

But Not work

Posted

This is the logs of the console of eclipse:

2013-06-11 12:09:12 [iNFO] [ForgeModLoader] Forge Mod Loader version 5.2.17.716 for Minecraft 1.5.2 loading

2013-06-11 12:09:12 [iNFO] [ForgeModLoader] Java is Java HotSpot 64-Bit Server VM, version 1.7.0_17, running on Windows 7:amd64:6.1, installed at C:\Program Files\Java\jre7

2013-06-11 12:09:12 [iNFO] [ForgeModLoader] Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation

2013-06-11 12:09:16 [iNFO] [sTDOUT] 229 recipes

2013-06-11 12:09:16 [iNFO] [sTDOUT] 27 achievements

2013-06-11 12:09:16 [iNFO] [Minecraft-Client] Setting user: Player901

2013-06-11 12:09:16 [iNFO] [sTDOUT] (Session ID is -)

2013-06-11 12:09:16 [iNFO] [sTDERR] Client asked for parameter: server

2013-06-11 12:09:16 [iNFO] [Minecraft-Client] LWJGL Version: 2.4.2

2013-06-11 12:09:17 [iNFO] [MinecraftForge] Attempting early MinecraftForge initialization

2013-06-11 12:09:17 [iNFO] [sTDOUT] MinecraftForge v7.8.0.716 Initialized

2013-06-11 12:09:17 [iNFO] [ForgeModLoader] MinecraftForge v7.8.0.716 Initialized

2013-06-11 12:09:17 [iNFO] [sTDOUT] Replaced 85 ore recipies

2013-06-11 12:09:17 [iNFO] [MinecraftForge] Completed early MinecraftForge initialization

2013-06-11 12:09:17 [iNFO] [ForgeModLoader] Reading custom logging properties from C:\Users\User\Desktop\Meteorus\jars\config\logging.properties

2013-06-11 12:09:17 [OFF] [ForgeModLoader] Logging level for ForgeModLoader logging is set to ALL

2013-06-11 12:09:17 [iNFO] [ForgeModLoader] Searching C:\Users\User\Desktop\Meteorus\jars\mods for mods

2013-06-11 12:09:18 [iNFO] [ForgeModLoader] Attempting to reparse the mod container bin

2013-06-11 12:09:20 [iNFO] [ForgeModLoader] Forge Mod Loader has identified 4 mods to load

2013-06-11 12:09:20 [iNFO] [mcp] Activating mod mcp

2013-06-11 12:09:20 [iNFO] [FML] Activating mod FML

2013-06-11 12:09:20 [iNFO] [Forge] Activating mod Forge

2013-06-11 12:09:20 [iNFO] [moddingmod] Activating mod moddingmod

2013-06-11 12:09:20 [iNFO] [ForgeModLoader] Registering Forge Packet Handler

2013-06-11 12:09:20 [iNFO] [ForgeModLoader] Succeeded registering Forge Packet Handler

2013-06-11 12:09:20 [iNFO] [sTDERR] Exception in thread "Minecraft main thread" java.lang.ExceptionInInitializerError

2013-06-11 12:09:20 [iNFO] [sTDERR] at java.lang.Class.forName0(Native Method)

2013-06-11 12:09:20 [iNFO] [sTDERR] at java.lang.Class.forName(Unknown Source)

2013-06-11 12:09:20 [iNFO] [sTDERR] at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:425)

2013-06-11 12:09:20 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

2013-06-11 12:09:20 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

2013-06-11 12:09:20 [iNFO] [sTDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

2013-06-11 12:09:20 [iNFO] [sTDERR] at java.lang.reflect.Method.invoke(Unknown Source)

2013-06-11 12:09:20 [iNFO] [sTDERR] at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

2013-06-11 12:09:20 [iNFO] [sTDERR] at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

2013-06-11 12:09:20 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)

2013-06-11 12:09:20 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

2013-06-11 12:09:20 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.post(EventBus.java:267)

2013-06-11 12:09:20 [iNFO] [sTDERR] at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:165)

2013-06-11 12:09:20 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

2013-06-11 12:09:20 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

2013-06-11 12:09:20 [iNFO] [sTDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

2013-06-11 12:09:20 [iNFO] [sTDERR] at java.lang.reflect.Method.invoke(Unknown Source)

2013-06-11 12:09:20 [iNFO] [sTDERR] at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

2013-06-11 12:09:20 [iNFO] [sTDERR] at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

2013-06-11 12:09:20 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)

2013-06-11 12:09:20 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

2013-06-11 12:09:20 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.post(EventBus.java:267)

2013-06-11 12:09:20 [iNFO] [sTDERR] at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:98)

2013-06-11 12:09:20 [iNFO] [sTDERR] at cpw.mods.fml.common.Loader.loadMods(Loader.java:509)

2013-06-11 12:09:20 [iNFO] [sTDERR] at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:163)

2013-06-11 12:09:20 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.startGame(Minecraft.java:411)

2013-06-11 12:09:20 [iNFO] [sTDERR] at net.minecraft.client.MinecraftAppletImpl.startGame(MinecraftAppletImpl.java:44)

2013-06-11 12:09:20 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.run(Minecraft.java:733)

2013-06-11 12:09:20 [iNFO] [sTDERR] at java.lang.Thread.run(Unknown Source)

2013-06-11 12:09:20 [iNFO] [sTDERR] Caused by: java.lang.NullPointerException

2013-06-11 12:09:20 [iNFO] [sTDERR] at Modding.mod_modding.<clinit>(mod_modding.java:72)

2013-06-11 12:09:20 [iNFO] [sTDERR] ... 29 more

2013-06-11 12:10:47 [iNFO] [sTDERR] Someone is closing me!

Posted

On the line 72 there is:

public static Item ModdedHelmet = new ItemArmorModdedHelmet(2837, "ModdedHelmet", ModdedArmor1, proxy.addArmor("Modded"), 0).setUnlocalizedName("HelmetModded").setCreativeTab(mod_modification.tabus);

Posted

On the line 72 there is:

public static Item ModdedHelmet = new ItemArmorModdedHelmet(2837, "ModdedHelmet", ModdedArmor1, proxy.addArmor("Modded"), 0).setUnlocalizedName("HelmetModded").setCreativeTab(mod_modification.tabus);

 

your proxy variable is not instanciatd when you initialize your item that way. You have to initialize in one of your @init methods (preferably the @PreInit one)

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

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

    • You would have better results asking a more specific question. What have you done? What exactly do you need help with? Please also read the FAQ regarding posting logs.
    • Hi, this is my second post with the same content as no one answered this and it's been a long time since I made the last post, I want to make a client-only mod, everything is ok, but when I use shaders, none of the textures rendered in RenderLevelStageEvent nor the crow entity model are rendered, I want them to be visible, because it's a horror themed mod I've already tried it with different shaders, but it didn't work with any of them and I really want to add support for shaders Here is how i render the crow model in the CrowEntityRenderer<CrowEntity>, by the time i use this method, i know is not the right method but i don't think this is the cause of the problem, the renderType i'm using is entityCutout @Override public void render(CrowEntity p_entity, float entityYaw, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight) { super.render(p_entity, entityYaw, partialTick, poseStack, bufferSource, packedLight); ClientEventHandler.getClient().crow.renderToBuffer(poseStack, bufferSource.getBuffer(ClientEventHandler.getClient().crow .renderType(TEXTURE)), packedLight, OverlayTexture.NO_OVERLAY, Utils.rgb(255, 255, 255)); } Here renderLevelStage @Override public void renderWorld(RenderLevelStageEvent e) { horrorEvents.draw(e); } Here is how i render every event public void draw(RenderLevelStageEvent e) { for (HorrorEvent event : currentHorrorEvents) { event.tick(e.getPartialTick()); event.draw(e); } } Here is how i render the crow model on the event @Override public void draw(RenderLevelStageEvent e) { if(e.getStage() == RenderLevelStageEvent.Stage.AFTER_ENTITIES) { float arcProgress = getArcProgress(0.25f); int alpha = (int) Mth.lerp(arcProgress, 0, 255); int packedLight = LevelRenderer.getLightColor(Minecraft.getInstance().level, blockPos); VertexConsumer builder = ClientEventHandler.bufferSource.getBuffer(crow); Crow<CreepyBirdHorrorEvent> model = ClientEventHandler .getClient().crow; model.setupAnim(this); RenderHelper.renderModelInWorld(model, position, offset, e.getCamera(), e.getPoseStack(), builder, packedLight, OverlayTexture.NO_OVERLAY, alpha); builder = ClientEventHandler.bufferSource.getBuffer(eyes); RenderHelper.renderModelInWorld(model, position, offset, e.getCamera(), e.getPoseStack(), builder, 15728880, OverlayTexture.NO_OVERLAY, alpha); } } How i render the model public static void renderModelInWorld(Model model, Vector3f pos, Vector3f offset, Camera camera, PoseStack matrix, VertexConsumer builder, int light, int overlay, int alpha) { matrix.pushPose(); Vec3 cameraPos = camera.getPosition(); double finalX = pos.x - cameraPos.x + offset.x; double finalY = pos.y - cameraPos.y + offset.y; double finalZ = pos.z - cameraPos.z + offset.z; matrix.pushPose(); matrix.translate(finalX, finalY, finalZ); matrix.mulPose(Axis.XP.rotationDegrees(180f)); model.renderToBuffer(matrix, builder, light, overlay, Utils .rgba(255, 255, 255, alpha)); matrix.popPose(); matrix.popPose(); } Thanks in advance
    • Same issue - I have no idea
    • I am trying to develop a modpack for me and my friends to use on our server. Does anyone know how to develop a modpack for a server or could they help take a look at my modpack to potentially help at all?
    • un server de armas realista.  
  • Topics

×
×
  • Create New...

Important Information

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