Jump to content

Recommended Posts

Posted (edited)

I've been trying to render my sword but it wont render correctly, but it does not look correct in game, can anyone help me please?

 

nichirinblack.json

{
    "parent": "item/handheld",
    "textures": {
        "layer0": "dslayer:items/nichirinblack"
    }
}

 

ClientEvents.java

package me.entonez.dslayer.utils;

import me.entonez.dslayer.items.ItemRegistry;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;

@EventBusSubscriber(modid = RefStrings.MODID, value = Side.CLIENT)
public final class ClientEvents {

    @SubscribeEvent
    public static void registerModels(ModelRegistryEvent event) {
    	registerModel(ItemRegistry.kblack);
    }

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

}

 

ClientProxy.java

package me.entonez.dslayer.proxies;


import me.entonez.dslayer.client.gui.GuiBreath;
import me.entonez.dslayer.client.render.Renders;
import me.entonez.dslayer.utils.KeyInputHandler;
import me.entonez.dslayer.utils.Keybinds;
import me.entonez.dslayer.utils.RefStrings;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.client.model.obj.OBJLoader;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;

public class ClientProxy extends ServerProxy {
	
	public void preInit() {
		Keybinds.register();
		MinecraftForge.EVENT_BUS.register(new KeyInputHandler());
	}

	public void postInit() {
	}
	
	@Override
    public void addOBJLoaderDomainIfOnClient() {
        OBJLoader.INSTANCE.addDomain(RefStrings.MODID);
    }
    
	@Override
	public void registerItemRenderer(Item item, int meta, String id) {
		ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName(), id));
	}
	
	@Override
    public EntityPlayer getPlayerFromMessage(final MessageContext ctx) {
        return (EntityPlayer)Minecraft.getMinecraft().player;
    }
	
	@Override
	public void initRenders() {
		Renders.renderEntities();
		MinecraftForge.EVENT_BUS.register((Object)new GuiBreath(Minecraft.getMinecraft()));
	}

}

 

nichirinblack.png

6a99ee3fee4104a6aebd53cf7b3e15ba.png

Edited by Entonez
Posted

@Entonez, your sword look so weird because you use the handheld Model, its the same Model as a Diamond sword or others tools. First: We need to see your full mod, to do this use Github. Second: You should try by making your Sword Model in Blockbench, then exporting it as Json Model and it should work. Thirdly: You dont need proxies. In wich Version of Minecraft you are modding?

New in Modding? == Still learning!

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.