Jump to content

Recommended Posts

Posted

Hi first post so please excuse any glaring noobness.

 

I have been trying to learn how to code mods mainly as a way of getting back in to Java (not done much since finishing my AI degree 10 years ago). I have purchased several books, watched loads of videos, read loads of your posts etc. and thus far I am really enjoying tinkering with Minecraft. I can genuinely see why you guys love it so much.

 

So far I have done all the standard stuff in 1.7.10 (blocks, items, recipes, textures) and I would now like to do some work with .obj files and rendering a 3D item. I won't lie, I have tried so many random things I am a bit lost and really need someone to point me in the right direction. I fully appreciate you guys are not here to write my code etc. and I am not asking for that but if someone could have a look over my code and give me a nudge it would be very much appreciated.

 

The issue is that although I have made a model, made a renderer etc. nothing different is happening. I still get the same black and purple square that I had before I started adding textures (which i edited out) :(

 

Here is my MainRegistry.java arghh Spoiler isn't working sorry.

 

package com.hammy.MainRegistry;

 

import com.hammy.item.LaserItem;

import com.hammy.item.LaserRender;

 

import cpw.mods.fml.common.registry.GameRegistry;

import net.minecraftforge.client.MinecraftForgeClient;

 

public class ClientProxy extends ServerProxy {

 

    public void registerRenderInfo(){

   

    MinecraftForgeClient.registerItemRenderer(MainRegistry.Laser, new LaserRender());   

    }

 

}

 

 

Here is my Item LaserItem.java

 

package com.hammy.item;

 

import com.google.common.collect.HashMultimap;

import com.google.common.collect.Multimap;

import com.hammy.lib.RefStrings;

 

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.entity.Entity;

import net.minecraft.entity.SharedMonsterAttributes;

import net.minecraft.entity.ai.attributes.AttributeModifier;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.init.Blocks;

import net.minecraft.init.Items;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.item.ItemSword;

import net.minecraft.potion.Potion;

import net.minecraft.potion.PotionEffect;

import net.minecraft.world.World;

 

public class LaserItem extends Item {

 

  public LaserItem() {

      super();

      this.setUnlocalizedName(RefStrings.MODID + "_" + "trustLaser");

      this.setCreativeTab(CreativeTabs.tabCombat);

      //this.setTextureName("hammytest:LaserItem");

      setMaxStackSize(1);

  }

       

}

 

 

Here is my Item Renderer LaserRender.java

 

package com.hammy.item;

 

import net.minecraft.client.Minecraft;

import net.minecraft.client.gui.inventory.GuiContainerCreative;

import net.minecraft.client.gui.inventory.GuiInventory;

import net.minecraft.client.renderer.entity.RenderManager;

import net.minecraft.entity.Entity;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.item.ItemStack;

import net.minecraft.util.ResourceLocation;

import net.minecraftforge.client.IItemRenderer;

import net.minecraftforge.client.model.AdvancedModelLoader;

import net.minecraftforge.client.model.IModelCustom;

import com.hammy.item.LaserItem;

 

import org.lwjgl.opengl.GL11;

 

import com.hammy.lib.RefStrings;

 

public class LaserRender implements IItemRenderer {

 

public final ResourceLocation modelResource = new ResourceLocation(RefStrings.MODID, "models/LaserItem.obj");

 

//public IModelCustom model = AdvancedModelLoader.loadModel(modelResource);

 

IModelCustom model;

 

public LaserRender(){

 

IModelCustom model = AdvancedModelLoader.loadModel(modelResource);

// public final ResourceLocation texture = new ResourceLocation("assets/textures/items/Laser-texture.jpg");

 

 

 

}

 

 

 

@Override

public boolean handleRenderType(ItemStack item, ItemRenderType type) {

// TODO Auto-generated method stub

switch(type){

case EQUIPPED:

case EQUIPPED_FIRST_PERSON:

return true;

default:

return false;

}

}

 

@Override

public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {

// TODO Auto-generated method stub

return false;

}

 

public void renderItem(ItemRenderType type, ItemStack stack, Object... data) {

switch(type){

case EQUIPPED:

case EQUIPPED_FIRST_PERSON:

{

GL11.glPushMatrix();

//Minecraft.getMinecraft().renderEngine.bindTexture(texture); //Not 100% sure if I got this right, but you bing the texture here.

//Do all your GL11 rotations, scales, and translaters here...

//this.model.renderAll(); //Finally render the model

 

model.renderAll();

 

GL11.glPopMatrix();

}

default:

break;

}

}

 

}

 

 

Here is my ClientProxy.java

 

package com.hammy.MainRegistry;

 

import com.hammy.item.LaserItem;

import com.hammy.item.LaserRender;

 

import cpw.mods.fml.common.registry.GameRegistry;

import net.minecraftforge.client.MinecraftForgeClient;

 

public class ClientProxy extends ServerProxy {

 

    public void registerRenderInfo(){

   

    MinecraftForgeClient.registerItemRenderer(MainRegistry.Laser, new LaserRender());   

    }

 

}

 

 

And here is my really basic .obj file created during Blender (which I also have no idea how to use but it is a dumb pyramid). LaserItem.obj

 

# Blender v2.74 (sub 0) OBJ File: ''

# www.blender.org

o Cube

v 1.000000 0.000000 -1.000000

v 1.000000 0.000000 1.000000

v -1.000000 0.000000 1.000000

v -1.000000 0.000000 -1.000000

v -0.000000 1.500000 0.000000

vn 0.000000 -1.000000 0.000000

vn 0.832100 0.554700 0.000000

vn -0.000000 0.554700 0.832100

vn -0.832100 0.554700 -0.000000

vn 0.000000 0.554700 -0.832100

s off

f 2//1 3//1 4//1

f 1//2 5//2 2//2

f 2//3 5//3 3//3

f 3//4 5//4 4//4

f 5//5 1//5 4//5

f 1//1 2//1 4//1

 

I am really sorry for the wall of text and code.

 

Also, here is my file tree just incase..

 

http://gyazo.com/9fa0cae3bddc6e45e8257e289cd23060

 

Is this forum running on 2011 software? The WYSIWYG isn't really doing anything in Chrome.

 

Anyhow, many thanks for any help or insight you guys can shed.

 

Ham out!

 

 

Posted

Oh sorry, basically all I get is the default square (purple and black) when held, dropped and first person. Nothing seems to be different from when it was just an item with a standard texture on it.

Posted

Oh sorry, basically all I get is the default square (purple and black) when held, dropped and first person. Nothing seems to be different from when it was just an item with a standard texture on it.

 

I think this might be you're issue.


   IModelCustom model;
   
   public LaserRender(){
   
      IModelCustom model = AdvancedModelLoader.loadModel(modelResource);
      // public final ResourceLocation texture = new ResourceLocation("assets/textures/items/Laser-texture.jpg");

 

What you're doing is setting a variable but never actually defining it.

What you need to do is change  IModelCustom model to model alone. In java whenever you set a variable you do not need to declare it's type again.

Posted

Can you actually confirm that the model is being loaded? Check the console, it should give you a few errors if something isn't loading properly. Also I have noticed another issue.


   @Override
   public boolean handleRenderType(ItemStack item, ItemRenderType type) {
      // TODO Auto-generated method stub
      switch(type){
     [b] case EQUIPPED:
      case EQUIPPED_FIRST_PERSON:
         return true;
      default:
         return false;[/b]
      }
   }   

 

Whenever you return false you are telling it not to render it period. Also on case EQUIPPED you never told it to return anything. Try changing that, if you still need help afterwards let me know.

EDIT: You're code is riddled with mistakes. Give me 1 minute to go through and give you what should be a working example.

Posted

Change your render class to this, it should work fine afterwards. Also you really need to look up the basics of java, you don't seem to understand how switch statements work.

 

package com.hammy.item;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainerCreative;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
import com.hammy.item.LaserItem;

import org.lwjgl.opengl.GL11;

import com.hammy.lib.RefStrings;

public class LaserRender implements IItemRenderer {

public final ResourceLocation texture = new ResourceLocation(RefStrings.MODID, "models/LaserItem.png");
public IModelCustom model = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/LaserItem.obj"));

IModelCustom model;

public LaserRender(){}



@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
	switch(type){
	case EQUIPPED:
		return true;	
	case EQUIPPED_FIRST_PERSON:
		return true;
	default:
		return false;
	}
}   

@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
	return true;
}

public void renderItem(ItemRenderType type, ItemStack stack, Object... data) {
	switch(type){
	case EQUIPPED:
		GL11.glPushMatrix();
		Minecraft.getMinecraft().renderEngine.bindTexture(texture);
		//Do all your GL11 rotations, scales, and translaters here...
		model.renderAll();
		GL11.glPopMatrix();
		break;
	case EQUIPPED_FIRST_PERSON:{
		GL11.glPushMatrix();
		Minecraft.getMinecraft().renderEngine.bindTexture(texture);
		//Do all your GL11 rotations, scales, and translaters here...
		model.renderAll();
		GL11.glPopMatrix();
	}
	default:
		break;
	}
}

}

Posted

Hi deadrecon98,

 

Many thanks for this. I replaced my render class with the one you crafted and nothing seems to have changed. Your other query about whether the object actually renders / is being loaded got me thinking. I have read through the console outputs and there is some moaning about a missing texture but nothing else I can see as an issue. I have attached the .txt dump

 

 

 

[10:10:56] [main/INFO] [GradleStart]: Extra: []

[10:10:56] [main/INFO] [GradleStart]: Running with arguments: [--userProperties, {}, --assetsDir, C:/Users/PCSPECIALIST/.gradle/caches/minecraft/assets, --assetIndex, 1.7.10, --accessToken, {REDACTED}, --version, 1.7.10, --tweakClass, cpw.mods.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker]

[10:10:56] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLTweaker

[10:10:56] [main/INFO] [LaunchWrapper]: Using primary tweak class name cpw.mods.fml.common.launcher.FMLTweaker

[10:10:56] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker

[10:10:56] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLTweaker

[10:10:56] [main/INFO] [FML]: Forge Mod Loader version 7.99.16.1448 for Minecraft 1.7.10 loading

[10:10:56] [main/INFO] [FML]: Java is Java HotSpot 64-Bit Server VM, version 1.8.0_45, running on Windows 7:amd64:6.1, installed at C:\Program Files\Java\jdk1.8.0_45\jre

[10:10:56] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation

[10:10:56] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker

[10:10:56] [main/INFO] [GradleStart]: Injecting location in coremod cpw.mods.fml.relauncher.FMLCorePlugin

[10:10:56] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin

[10:10:56] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker

[10:10:56] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLDeobfTweaker

[10:10:56] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker

[10:10:56] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker

[10:10:56] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker

[10:10:56] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper

[10:10:57] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work!

[10:10:57] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing

[10:10:57] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper

[10:10:57] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLDeobfTweaker

[10:10:58] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker

[10:10:58] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.TerminalTweaker

[10:10:58] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.TerminalTweaker

[10:10:58] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main}

[10:10:58] [main/INFO]: Setting user: Player336

[10:10:59] [Client thread/INFO]: LWJGL Version: 2.9.1

[10:11:00] [Client thread/INFO] [sTDOUT]: [cpw.mods.fml.client.SplashProgress:start:188]: ---- Minecraft Crash Report ----

// Don't do that.

 

 

Time: 04/07/15 10:11

Description: Loading screen debug info

 

 

This is just a prompt for computer specs to be printed. THIS IS NOT A ERROR

 

 

 

 

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

---------------------------------------------------------------------------------------

 

 

-- System Details --

Details:

Minecraft Version: 1.7.10

Operating System: Windows 7 (amd64) version 6.1

Java Version: 1.8.0_45, Oracle Corporation

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

Memory: 792961632 bytes (756 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)

JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0

FML:

GL info: ' Vendor: 'ATI Technologies Inc.' Version: '4.4.13283 Compatibility Profile Context 14.501.1003.0' Renderer: 'AMD Radeon HD 7970M'

[10:11:00] [Client thread/INFO] [MinecraftForge]: Attempting early MinecraftForge initialization

[10:11:00] [Client thread/INFO] [FML]: MinecraftForge v10.13.4.1448 Initialized

[10:11:00] [Client thread/INFO] [FML]: Replaced 183 ore recipies

[10:11:00] [Client thread/INFO] [MinecraftForge]: Completed early MinecraftForge initialization

[10:11:00] [Client thread/INFO] [FML]: Found 0 mods from the command line. Injecting into mod discoverer

[10:11:00] [Client thread/INFO] [FML]: Searching C:\Users\PCSPECIALIST\Desktop\MinecraftModding\eclipse\mods for mods

[10:11:03] [Client thread/INFO] [FML]: Forge Mod Loader has identified 4 mods to load

[10:11:03] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, hammytest] at CLIENT

[10:11:03] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, hammytest] at SERVER

[10:11:03] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Hammy Test

[10:11:03] [Client thread/INFO] [FML]: Processing ObjectHolder annotations

[10:11:03] [Client thread/INFO] [FML]: Found 341 ObjectHolder annotations

[10:11:03] [Client thread/INFO] [FML]: Identifying ItemStackHolder annotations

[10:11:03] [Client thread/INFO] [FML]: Found 0 ItemStackHolder annotations

[10:11:03] [Client thread/INFO] [FML]: Configured a dormant chunk cache size of 0

[10:11:03] [Client thread/INFO] [FML]: Applying holder lookups

[10:11:03] [Client thread/INFO] [FML]: Holder lookups applied

[10:11:03] [Client thread/INFO] [FML]: Injecting itemstacks

[10:11:03] [Client thread/INFO] [FML]: Itemstack injection complete

[10:11:03] [sound Library Loader/INFO] [sTDOUT]: [paulscode.sound.SoundSystemLogger:message:69]:

[10:11:03] [sound Library Loader/INFO] [sTDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: Starting up SoundSystem...

[10:11:03] [Thread-8/INFO] [sTDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: Initializing LWJGL OpenAL

[10:11:03] [Thread-8/INFO] [sTDOUT]: [paulscode.sound.SoundSystemLogger:message:69]:    (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)

[10:11:03] [Thread-8/INFO] [sTDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: OpenAL initialized.

[10:11:04] [sound Library Loader/INFO] [sTDOUT]: [paulscode.sound.SoundSystemLogger:message:69]:

[10:11:04] [sound Library Loader/INFO]: Sound engine started

[10:11:04] [Client thread/INFO]: Created: 512x256 textures/blocks-atlas

[10:11:05] [Client thread/INFO]: Created: 256x256 textures/items-atlas

[10:11:05] [Client thread/INFO] [FML]: Injecting itemstacks

[10:11:05] [Client thread/INFO] [FML]: Itemstack injection complete

[10:11:05] [Client thread/INFO] [FML]: Forge Mod Loader has successfully loaded 4 mods

[10:11:05] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Hammy Test

[10:11:05] [Client thread/INFO]: Created: 512x256 textures/blocks-atlas

[10:11:05] [Client thread/INFO]: Created: 256x256 textures/items-atlas

[10:11:05] [Client thread/INFO] [sTDOUT]: [paulscode.sound.SoundSystemLogger:message:69]:

[10:11:05] [Client thread/INFO] [sTDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: SoundSystem shutting down...

[10:11:05] [Client thread/INFO] [sTDOUT]: [paulscode.sound.SoundSystemLogger:importantMessage:90]:    Author: Paul Lamb, www.paulscode.com

[10:11:05] [Client thread/INFO] [sTDOUT]: [paulscode.sound.SoundSystemLogger:message:69]:

[10:11:05] [sound Library Loader/INFO] [sTDOUT]: [paulscode.sound.SoundSystemLogger:message:69]:

[10:11:05] [sound Library Loader/INFO] [sTDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: Starting up SoundSystem...

[10:11:05] [Thread-10/INFO] [sTDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: Initializing LWJGL OpenAL

[10:11:05] [Thread-10/INFO] [sTDOUT]: [paulscode.sound.SoundSystemLogger:message:69]:    (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)

[10:11:05] [Thread-10/INFO] [sTDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: OpenAL initialized.

[10:11:06] [sound Library Loader/INFO] [sTDOUT]: [paulscode.sound.SoundSystemLogger:message:69]:

[10:11:06] [sound Library Loader/INFO]: Sound engine started

[10:11:06] [Client thread/ERROR] [TEXTURE ERRORS]: +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=

[10:11:06] [Client thread/ERROR] [TEXTURE ERRORS]: The following texture errors were found.

[10:11:06] [Client thread/ERROR] [TEXTURE ERRORS]: ==================================================

[10:11:06] [Client thread/ERROR] [TEXTURE ERRORS]:  DOMAIN minecraft

[10:11:06] [Client thread/ERROR] [TEXTURE ERRORS]: --------------------------------------------------

[10:11:06] [Client thread/ERROR] [TEXTURE ERRORS]:  domain minecraft is missing 1 texture

[10:11:06] [Client thread/ERROR] [TEXTURE ERRORS]:    domain minecraft has 3 locations:

[10:11:06] [Client thread/ERROR] [TEXTURE ERRORS]:      unknown resourcepack type net.minecraft.client.resources.DefaultResourcePack : Default

[10:11:06] [Client thread/ERROR] [TEXTURE ERRORS]:      mod FML resources at C:\Users\PCSPECIALIST\.gradle\caches\minecraft\net\minecraftforge\forge\1.7.10-10.13.4.1448-1.7.10\forgeSrc-1.7.10-10.13.4.1448-1.7.10.jar

[10:11:06] [Client thread/ERROR] [TEXTURE ERRORS]:      mod Forge resources at C:\Users\PCSPECIALIST\.gradle\caches\minecraft\net\minecraftforge\forge\1.7.10-10.13.4.1448-1.7.10\forgeSrc-1.7.10-10.13.4.1448-1.7.10.jar

[10:11:06] [Client thread/ERROR] [TEXTURE ERRORS]: -------------------------

[10:11:06] [Client thread/ERROR] [TEXTURE ERRORS]:    The missing resources for domain minecraft are:

[10:11:06] [Client thread/ERROR] [TEXTURE ERRORS]:      textures/items/MISSING_ICON_ITEM_4096_hammytest_trustLaser.png

[10:11:06] [Client thread/ERROR] [TEXTURE ERRORS]: -------------------------

[10:11:06] [Client thread/ERROR] [TEXTURE ERRORS]:    No other errors exist for domain minecraft

[10:11:06] [Client thread/ERROR] [TEXTURE ERRORS]: ==================================================

[10:11:06] [Client thread/ERROR] [TEXTURE ERRORS]: +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=

[10:11:15] [server thread/INFO]: Starting integrated minecraft server version 1.7.10

[10:11:15] [server thread/INFO]: Generating keypair

[10:11:15] [server thread/INFO] [FML]: Injecting existing block and item data into this server instance

[10:11:15] [server thread/INFO] [FML]: Applying holder lookups

[10:11:15] [server thread/INFO] [FML]: Holder lookups applied

[10:11:15] [server thread/INFO] [FML]: Loading dimension 0 (New World M) (net.minecraft.server.integrated.IntegratedServer@5592397b)

[10:11:15] [server thread/INFO] [FML]: Loading dimension 1 (New World M) (net.minecraft.server.integrated.IntegratedServer@5592397b)

[10:11:15] [server thread/INFO] [FML]: Loading dimension -1 (New World M) (net.minecraft.server.integrated.IntegratedServer@5592397b)

[10:11:15] [server thread/INFO]: Preparing start region for level 0

[10:11:16] [server thread/INFO]: Changing view distance to 12, from 10

[10:11:21] [server thread/INFO]: Stopping server

[10:11:21] [server thread/INFO]: Saving players

[10:11:21] [server thread/INFO]: Saving worlds

[10:11:21] [server thread/INFO]: Saving chunks for level 'New World M'/Overworld

[10:11:21] [server thread/INFO]: Saving chunks for level 'New World M'/Nether

[10:11:21] [server thread/INFO]: Saving chunks for level 'New World M'/The End

[10:11:22] [server thread/INFO] [FML]: Unloading dimension 0

[10:11:22] [server thread/INFO] [FML]: Unloading dimension -1

[10:11:22] [server thread/INFO] [FML]: Unloading dimension 1

[10:11:22] [server thread/INFO] [FML]: Applying holder lookups

[10:11:22] [server thread/INFO] [FML]: Holder lookups applied

[10:11:22] [server thread/INFO]: Starting integrated minecraft server version 1.7.10

[10:11:22] [server thread/INFO]: Generating keypair

[10:11:22] [server thread/INFO] [FML]: Injecting existing block and item data into this server instance

[10:11:22] [server thread/INFO] [FML]: Applying holder lookups

[10:11:22] [server thread/INFO] [FML]: Holder lookups applied

[10:11:22] [server thread/INFO] [FML]: Loading dimension 0 (New World M) (net.minecraft.server.integrated.IntegratedServer@25b57852)

[10:11:22] [server thread/INFO] [FML]: Loading dimension 1 (New World M) (net.minecraft.server.integrated.IntegratedServer@25b57852)

[10:11:22] [server thread/INFO] [FML]: Loading dimension -1 (New World M) (net.minecraft.server.integrated.IntegratedServer@25b57852)

[10:11:22] [server thread/INFO]: Preparing start region for level 0

[10:11:22] [server thread/INFO]: Changing view distance to 12, from 10

[10:11:23] [Netty Client IO #1/INFO] [FML]: Server protocol version 2

[10:11:23] [Netty IO #3/INFO] [FML]: Client protocol version 2

[10:11:23] [Netty IO #3/INFO] [FML]: Client attempting to join with 4 mods : [email protected],[email protected],[email protected],[email protected]

[10:11:23] [Netty IO #3/INFO] [FML]: Attempting connection with missing mods [] at CLIENT

[10:11:23] [Netty Client IO #1/INFO] [FML]: Attempting connection with missing mods [] at SERVER

[10:11:23] [server thread/INFO] [FML]: [server thread] Server side modded connection established

[10:11:23] [server thread/INFO]: Player336[local:E:9f087944] logged in with entity id 518 at (-196.5, 65.0, 105.5)

[10:11:23] [server thread/INFO]: Player336 joined the game

[10:11:23] [Client thread/INFO] [FML]: [Client thread] Client side modded connection established

[10:11:36] [server thread/INFO]: Player336 has just earned the achievement [Taking Inventory]

[10:11:36] [Client thread/INFO]: [CHAT] Player336 has just earned the achievement [Taking Inventory]

[10:11:57] [server thread/INFO]: Saving and pausing game...

[10:11:57] [server thread/INFO]: Saving chunks for level 'New World M'/Overworld

[10:11:57] [server thread/INFO]: Saving chunks for level 'New World M'/Nether

[10:11:57] [server thread/INFO]: Saving chunks for level 'New World M'/The End

[10:11:58] [server thread/INFO]: Stopping server

[10:11:58] [server thread/INFO]: Saving players

[10:11:58] [server thread/INFO]: Saving worlds

[10:11:58] [server thread/INFO]: Saving chunks for level 'New World M'/Overworld

[10:11:58] [server thread/INFO]: Saving chunks for level 'New World M'/Nether

[10:11:58] [server thread/INFO]: Saving chunks for level 'New World M'/The End

[10:11:58] [server thread/INFO] [FML]: Unloading dimension 0

[10:11:58] [server thread/INFO] [FML]: Unloading dimension -1

[10:11:58] [server thread/INFO] [FML]: Unloading dimension 1

[10:11:58] [server thread/INFO] [FML]: Applying holder lookups

[10:11:58] [server thread/INFO] [FML]: Holder lookups applied

[10:12:00] [Client thread/INFO]: Stopping!

[10:12:00] [Client thread/INFO] [sTDOUT]: [paulscode.sound.SoundSystemLogger:message:69]:

[10:12:00] [Client thread/INFO] [sTDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: SoundSystem shutting down...

[10:12:00] [Client thread/INFO] [sTDOUT]: [paulscode.sound.SoundSystemLogger:importantMessage:90]:    Author: Paul Lamb, www.paulscode.com

[10:12:00] [Client thread/INFO] [sTDOUT]: [paulscode.sound.SoundSystemLogger:message:69]:

Java HotSpot 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release

 

 

Regarding Java switch statements, how do you mean exactly? I'm pretty certain the stacking of cases is fine as it just groups them all so they all trigger the same functionality as the last in the grouping.

 

Thanks again for your help with this, it really is greatly appreciated.

 

 

Ham.

Posted

I think I may have found the issue. In your main class is the modid all lower-case? If not go into the render class and change all cases of where it grabs the modid to have .toLowerCase() after it. As for the switch statements you had a couple blank ones which immediately go onto the next statement.

Posted

For my modid I use a reference file called RefStrings.java which contains them all. My RefStrings.MODID is set to "hammytest" so is always consistent.

 

I did find out one thing today. I was unsure as to whether forge was reading my .obj file so I made a new one using Blender. I forgot to triangulate the faces and when I ran MC is crashed telling me there were too many points in my object faces which means it is having a go at using my object. I fixed this by re-exporting.

 

Alas though, I still get the default purple and black square  :-[

Posted

I am going to assume that the issue is in your render class and not the model. Try using this for the render class. If this doesn't fix it then you need to upload all of your code somewhere so that I can get a better look at it.

Render Class:http://bit.ly/1feyNWD

How to use Render http://bit.ly/1LMEjfs

Posted

Hi deadrecon98, I have got it working  ;D ;D ;D ;D

 

I took all the complexity out of my mainRegistry file and migrated it in to the Item class.

 

Here are all my final files just in case anyone else has a similar problem (loads of people just go "I fixed it" and don't show how).

 

 

MainRegistry.java

 

package com.hammy.MainRegistry;

 

import net.minecraft.item.Item;

 

import com.hammy.item.LaserItem;

import com.hammy.item.LaserRender;

import com.hammy.lib.RefStrings;

 

import cpw.mods.fml.common.Mod;

import cpw.mods.fml.common.Mod.EventHandler;

import cpw.mods.fml.common.SidedProxy;

import cpw.mods.fml.common.Mod.Instance;

import cpw.mods.fml.common.event.FMLInitializationEvent;

import cpw.mods.fml.common.event.FMLPostInitializationEvent;

import cpw.mods.fml.common.event.FMLPreInitializationEvent;

import cpw.mods.fml.common.registry.GameRegistry;

 

@Mod(modid = RefStrings.MODID , name = RefStrings.NAME , version = RefStrings.VERSION)

public class MainRegistry {

 

@SidedProxy(clientSide = RefStrings.CLIENTSIDE, serverSide = RefStrings.SERVERSIDE)

 

public static ServerProxy proxy;

 

@EventHandler

public static void preInit(FMLPreInitializationEvent e) {

 

LaserItem.mainRegistry();

proxy.registerRenderInfo();

 

}

 

@EventHandler

public static void Init(FMLInitializationEvent e) {

 

}

 

    @EventHandler

public static void postInit(FMLPostInitializationEvent e) {

 

 

}

 

}

 

 

 

RefStrings.java

 

package com.hammy.lib;

 

public class RefStrings {

 

public static final String MODID = "hammytest";

public static final String NAME = "Hammy Test";

public static final String VERSION = "1.0";

public static final String CLIENTSIDE = "com.hammy.MainRegistry.ClientProxy";

public static final String SERVERSIDE = "com.hammy.MainRegistry.ServerProxy";

 

}

 

 

LaserItem.java

 

package com.hammy.item;

 

import com.google.common.collect.HashMultimap;

import com.google.common.collect.Multimap;

import com.hammy.lib.RefStrings;

 

import cpw.mods.fml.common.registry.GameRegistry;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.entity.Entity;

import net.minecraft.entity.SharedMonsterAttributes;

import net.minecraft.entity.ai.attributes.AttributeModifier;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.init.Blocks;

import net.minecraft.init.Items;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.item.ItemSword;

import net.minecraft.potion.Potion;

import net.minecraft.potion.PotionEffect;

import net.minecraft.world.World;

 

public class LaserItem extends Item {

 

    public static void mainRegistry(){

   

        initializeItem();

        registerItem();

   

    }

   

    public static Item trustLaser;

   

 

public static void initializeItem(){

 

    trustLaser = new Item().setUnlocalizedName(RefStrings.MODID + "_" + "trustLaser").setCreativeTab(CreativeTabs.tabCombat);

 

}

 

public static void registerItem(){

 

GameRegistry.registerItem(trustLaser, trustLaser.getUnlocalizedName());

 

}

       

}

 

 

 

LaserRender.java

 

package com.hammy.item;

 

import net.minecraft.client.Minecraft;

import net.minecraft.client.gui.inventory.GuiContainerCreative;

import net.minecraft.client.gui.inventory.GuiInventory;

import net.minecraft.client.renderer.entity.RenderManager;

import net.minecraft.entity.Entity;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.item.ItemStack;

import net.minecraft.util.ResourceLocation;

import net.minecraftforge.client.IItemRenderer;

import net.minecraftforge.client.model.AdvancedModelLoader;

import net.minecraftforge.client.model.IModelCustom;

import com.hammy.item.LaserItem;

 

import org.lwjgl.opengl.GL11;

 

import com.hammy.lib.RefStrings;

 

public class LaserRender implements IItemRenderer {

 

public final ResourceLocation texture = new ResourceLocation(RefStrings.MODID, "models/LaserItem.png");

public IModelCustom model = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/LaserItem.obj"));

 

public LaserRender(){}

 

 

 

@Override

public boolean handleRenderType(ItemStack item, ItemRenderType type) {

switch(type){

case EQUIPPED:

return true;

case EQUIPPED_FIRST_PERSON:

return true;

default:

return false;

}

 

@Override

public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {

return true;

}

 

public void renderItem(ItemRenderType type, ItemStack stack, Object... data) {

switch(type){

case EQUIPPED:

GL11.glPushMatrix();

Minecraft.getMinecraft().renderEngine.bindTexture(texture);

//Do all your GL11 rotations, scales, and translaters here...

model.renderAll();

GL11.glPopMatrix();

break;

case EQUIPPED_FIRST_PERSON:{

GL11.glPushMatrix();

Minecraft.getMinecraft().renderEngine.bindTexture(texture);

//Do all your GL11 rotations, scales, and translaters here...

model.renderAll();

GL11.glPopMatrix();

}

default:

break;

}

}

 

}

 

 

 

ServerProxy.java

 

package com.hammy.MainRegistry;

 

public class ServerProxy {

 

    public void registerRenderInfo(){

   

    }

 

}

 

 

 

ClientProxy.java

 

package com.hammy.MainRegistry;

 

import com.hammy.item.LaserItem;

import com.hammy.item.LaserRender;

 

import cpw.mods.fml.common.registry.GameRegistry;

import net.minecraftforge.client.MinecraftForgeClient;

 

public class ClientProxy extends ServerProxy {

 

    public void registerRenderInfo(){

   

    MinecraftForgeClient.registerItemRenderer(LaserItem.trustLaser, new LaserRender());   

    }

 

}

 

 

 

Massive thanks to you deadrecon98 for your support during this. Between us we got it done  :)

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.