Jump to content

[1.8] Rendering item model from item stack using EntityItem and...?


Recommended Posts

Posted

Hi, All.  :)

 

I'm still working on my shelves mod: I have my shelf block behaving properly, rendering and able to hold up to four item stacks.

I'm trying to make the item models render on the shelves in the proper location.

I want to say,

For each itemStacks[0 through 3],

take the ItemStack, find it's item model, render the item model in the proper location[0 through 3] relative to the block.

 

I was looking at EntityItem, and I can set an item stack, but I'm not sure how to render it.

Looking at RenderEntityItem, there are arguments of types RenderManager and RenderItem (and I'm not sure how to create those), but I'm thinking I should be able to find something that says "render this item in this location of this block" or something.  sounds like something I might have to write... 

 

What structure would you use to get this done?

hw developer in a sw world

Posted
float renderPosX;
float renderPosZ;

for(int i=0; i<4; i++) {
renderPosX = i/2; /*  0 / 2 = 0, 1 / 1 = 0, etc. */
renderPosZ = i%2;  /*  0 % 2 = 0, 1 % 2 = 1, etc. */
/*the multiply by some fraction, add in the block's world coordinates*/
/*finally, call the renderer*/
}

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Thanks, Draco; so, what I got out of that is that the position data is of type float.

 

Right now I'm trying to figure out how to add in the block's coordinates but haven't found the translation between BlockPos and x, y, and z coordinates.

I'll have a y offset for my items, too, so I'll add that into the for loop.

I'm reading up on BlockPos and Entity and RenderEntityItem to figure out the position data.

 

It's the rendering part I'm stuck on. 

hw developer in a sw world

Posted

haven't found the translation between BlockPos and x, y, and z coordinates.

 

BlockPos.x ?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

after stumbling around, the code that eclipse hasn't complained much about is:

 

double x = ((TileEntity)shelfTileEntity).getPos().getX();

double y = ((TileEntity)shelfTileEntity).getPos().getY();

double z = ((TileEntity)shelfTileEntity).getPos().getZ();

 

we'll see if that works...  :P

 

I can't believe I just realized yesterday that it's TileEntity, not TitleEntity.  I have a _lot_ of spelling errors in my code now.  :\

hw developer in a sw world

Posted

I've put together something that I think might render my items (I at least want to see if it works) but I'm not sure from where to call my RenderShelfTileEntity class.

 

package com.rosecotton.shelvesmod;

import net.minecraft.client.renderer.entity.RenderEntityItem;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.tileentity.TileEntity;

public class RenderShelfTileEntity 
{
public RenderShelfTileEntity(ShelfTitleEntity shelfTileEntity)
{
	RenderEntityItem renderEntityItem = new RenderEntityItem(null, null);
	double x = ((TileEntity)shelfTileEntity).getPos().getX();
	double y = ((TileEntity)shelfTileEntity).getPos().getY();
	double z = ((TileEntity)shelfTileEntity).getPos().getZ();
	EntityItem shelfEntityItem[] = new EntityItem[4];
	for (int n = 0; n <4; n++)
	{
		shelfEntityItem[n].setEntityItemStack(shelfTileEntity.itemStacks[n]);

		double xPlus = x + (double)((4+(n%2)*8)/16);
		double yPlus = y + (double)((2+(n/2)*6)/16);
		double zPlus = z + (double)((13-(n/2)*8)/16);

		renderEntityItem.func_177075_a(shelfEntityItem[n], xPlus, yPlus, zPlus, 0.0625f, 1.05f);
	}

}
}

 

Should I call this from the BlockShelf class, the ShelvesEventHandler (which currently doese nothing), or the ShelfTitleEntity class?

 

I know I need to rename everything that says TitleEntity to TileEntity.  :\

hw developer in a sw world

Posted

uh, oh.... if position data is type float, then I just calculated doubles for who-knows-what reason and passed them into I-don't-know-what in my renderEntityItem.func_177075_a(bunches-of-stuff).

hw developer in a sw world

Posted

UPDATE:

trying to update inventory in my shelf, which is where I call my EntityItem renderer code, definitely causes mc to crash.

 

 

 

[11:05:06] [main/INFO] [GradleStart]: Extra: []

[11:05:06] [main/INFO] [GradleStart]: Running with arguments: [--userProperties, {}, --assetsDir, C:/Users/Becky/.gradle/caches/minecraft/assets, --assetIndex, 1.8, --accessToken, {REDACTED}, --version, 1.8, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.GradleStartCommon$GradleStartTweaker]

[11:05:06] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker

[11:05:06] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker

[11:05:06] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.GradleStartCommon$GradleStartTweaker

[11:05:06] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLTweaker

[11:05:06] [main/INFO] [FML]: Forge Mod Loader version 8.0.20.1023 for Minecraft 1.8 loading

[11:05:06] [main/INFO] [FML]: Java is Java HotSpot Client VM, version 1.8.0_31, running on Windows 7:x86:6.1, installed at C:\Program Files\Java\jre1.8.0_31

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

[11:05:06] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.GradleStartCommon$GradleStartTweaker

[11:05:06] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.fml.relauncher.FMLCorePlugin

[11:05:06] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker

[11:05:06] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker

[11:05:06] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker

[11:05:06] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker

[11:05:06] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper

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

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

[11:05:08] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker

[11:05:09] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker

[11:05:09] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker

[11:05:09] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main}

[11:05:10] [Client thread/INFO]: Setting user: Player680

[11:05:10] [Client thread/INFO]: (Session ID is token:FML:Player680)

[11:05:14] [Client thread/INFO]: LWJGL Version: 2.9.1

[11:05:15] [Client thread/INFO] [MinecraftForge]: Attempting early MinecraftForge initialization

[11:05:15] [Client thread/INFO] [MinecraftForge]: Completed early MinecraftForge initialization

[11:05:15] [Client thread/INFO] [FML]: Searching C:\Users\Becky\Desktop\Forge ModLoader-1.8-8.0.20.1023-1.8-src\eclipse\mods for mods

[11:05:20] [Client thread/INFO] [FML]: Forge Mod Loader has identified 5 mods to load

[11:05:20] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, testmod01, oredetectmod, shelvesmod] at CLIENT

[11:05:20] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, testmod01, oredetectmod, shelvesmod] at SERVER

[11:05:20] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Test Mod 01, FMLFileResourcePack:Ore Detect Mod, FMLFileResourcePack:Shelves Mod

[11:05:21] [Client thread/INFO] [FML]: Processing ObjectHolder annotations

[11:05:21] [Client thread/INFO] [FML]: Found 384 ObjectHolder annotations

[11:05:21] [Client thread/INFO] [sTDOUT]: [com.rosecotton.shelvesmod.GuiHandlerShelf:getGuiID:19]: Called method: GuiHandlerShelf.getGuiID

[11:05:21] [Client thread/INFO] [FML]: Applying holder lookups

[11:05:21] [Client thread/INFO] [FML]: Holder lookups applied

[11:05:22] [sound Library Loader/INFO]: Starting up SoundSystem...

[11:05:22] [Thread-7/INFO]: Initializing LWJGL OpenAL

[11:05:22] [Thread-7/INFO]: (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)

[11:05:23] [Thread-7/INFO]: OpenAL initialized.

[11:05:23] [sound Library Loader/INFO]: Sound engine started

[11:05:37] [Client thread/INFO]: Created: 512x512 textures-atlas

[11:05:38] [Client thread/INFO] [sTDOUT]: [com.becky.testmod01.Testmod01:postInit:142]: Called method: postInit

[11:05:38] [Client thread/INFO] [sTDOUT]: [com.rosecotton.oredetect.OreDetectMod:postInit:120]: Called method: postInit

[11:05:38] [Client thread/INFO] [sTDOUT]: [com.rosecotton.shelvesmod.ShelvesMod:postInit:99]: Called method: postInit

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

[11:05:38] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Test Mod 01, FMLFileResourcePack:Ore Detect Mod, FMLFileResourcePack:Shelves Mod

[11:05:38] [Client thread/INFO]: SoundSystem shutting down...

[11:05:39] [Client thread/WARN]: Author: Paul Lamb, www.paulscode.com

[11:05:39] [sound Library Loader/INFO]: Starting up SoundSystem...

[11:05:39] [Thread-9/INFO]: Initializing LWJGL OpenAL

[11:05:39] [Thread-9/INFO]: (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)

[11:05:40] [Thread-9/INFO]: OpenAL initialized.

[11:05:40] [sound Library Loader/INFO]: Sound engine started

[11:05:41] [Client thread/INFO]: Created: 512x512 textures-atlas

[11:06:03] [server thread/INFO]: Starting integrated minecraft server version 1.8

[11:06:03] [server thread/INFO]: Generating keypair

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

[11:06:03] [server thread/INFO] [FML]: Applying holder lookups

[11:06:03] [server thread/INFO] [FML]: Holder lookups applied

[11:06:03] [server thread/INFO]: Preparing start region for level 0

[11:06:04] [server thread/INFO]: Preparing spawn area: 44%

[11:06:06] [server thread/INFO]: Changing view distance to 8, from 10

[11:06:06] [Netty Local Client IO #0/INFO] [FML]: Server protocol version 1

[11:06:06] [Netty Server IO #1/INFO] [FML]: Client protocol version 1

[11:06:06] [Netty Server IO #1/INFO] [FML]: Client attempting to join with 5 mods : [email protected],[email protected],[email protected],[email protected],[email protected]

[11:06:06] [Netty Local Client IO #0/INFO] [FML]: [Netty Local Client IO #0] Client side modded connection established

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

[11:06:06] [server thread/INFO]: Player680[local:E:bc663994] logged in with entity id 312 at (-231.85697573168673, 77.0, 61.09418574985075)

[11:06:07] [server thread/INFO]: Player680 joined the game

[11:06:09] [server thread/INFO] [sTDOUT]: [com.rosecotton.shelvesmod.GuiHandlerShelf:getGuiID:19]: Called method: GuiHandlerShelf.getGuiID

[11:06:09] [server thread/INFO] [sTDOUT]: [com.rosecotton.shelvesmod.GuiHandlerShelf:getGuiID:19]: Called method: GuiHandlerShelf.getGuiID

[11:06:09] [server thread/INFO] [sTDOUT]: [com.rosecotton.shelvesmod.GuiHandlerShelf:getServerGuiElement:33]: Called method: GuiHandlerShelf.getServerGuiElement return good stuff

[11:06:09] [Client thread/INFO] [sTDOUT]: [com.rosecotton.shelvesmod.GuiHandlerShelf:getGuiID:19]: Called method: GuiHandlerShelf.getGuiID

[11:06:09] [Client thread/INFO] [sTDOUT]: [com.rosecotton.shelvesmod.GuiHandlerShelf:getClientGuiElement:51]: Called method: GuiHandlerShelf.getClientGuiElement return good stuff

[11:06:09] [server thread/INFO] [sTDOUT]: [com.rosecotton.shelvesmod.BlockShelf:onBlockActivated:283]: Called method: BlockShelf.onBlockActivated

[11:06:09] [Client thread/FATAL] [FML]: Exception caught executing FutureTask: java.util.concurrent.ExecutionException: java.lang.NullPointerException

java.util.concurrent.ExecutionException: java.lang.NullPointerException

at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_31]

at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_31]

at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:677) [FMLCommonHandler.class:?]

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1006) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:346) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_31]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_31]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_31]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_31]

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/:?]

Caused by: java.lang.NullPointerException

at com.rosecotton.shelvesmod.RenderShelfTileEntity.<init>(RenderShelfTileEntity.java:18) ~[RenderShelfTileEntity.class:?]

at com.rosecotton.shelvesmod.ShelfTitleEntity.setInventorySlotContents(ShelfTitleEntity.java:135) ~[shelfTitleEntity.class:?]

at net.minecraft.inventory.Slot.putStack(Slot.java:67) ~[slot.class:?]

at net.minecraft.inventory.Container.putStacksInSlots(Container.java:527) ~[Container.class:?]

at net.minecraft.client.network.NetHandlerPlayClient.handleWindowItems(NetHandlerPlayClient.java:1079) ~[NetHandlerPlayClient.class:?]

at net.minecraft.network.play.server.S30PacketWindowItems.func_180732_a(S30PacketWindowItems.java:61) ~[s30PacketWindowItems.class:?]

at net.minecraft.network.play.server.S30PacketWindowItems.processPacket(S30PacketWindowItems.java:72) ~[s30PacketWindowItems.class:?]

at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:18) ~[PacketThreadUtil$1.class:?]

at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_31]

at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_31]

at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:676) ~[FMLCommonHandler.class:?]

... 11 more

[11:06:09] [Client thread/FATAL] [FML]: Exception caught executing FutureTask: java.util.concurrent.ExecutionException: java.lang.NullPointerException

java.util.concurrent.ExecutionException: java.lang.NullPointerException

at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_31]

at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_31]

at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:677) [FMLCommonHandler.class:?]

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1006) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:346) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_31]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_31]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_31]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_31]

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/:?]

Caused by: java.lang.NullPointerException

at com.rosecotton.shelvesmod.RenderShelfTileEntity.<init>(RenderShelfTileEntity.java:18) ~[RenderShelfTileEntity.class:?]

at com.rosecotton.shelvesmod.ShelfTitleEntity.setInventorySlotContents(ShelfTitleEntity.java:135) ~[shelfTitleEntity.class:?]

at net.minecraft.inventory.Slot.putStack(Slot.java:67) ~[slot.class:?]

at net.minecraft.inventory.Container.putStackInSlot(Container.java:519) ~[Container.class:?]

at net.minecraft.client.network.NetHandlerPlayClient.handleSetSlot(NetHandlerPlayClient.java:1042) ~[NetHandlerPlayClient.class:?]

at net.minecraft.network.play.server.S2FPacketSetSlot.processPacket(S2FPacketSetSlot.java:30) ~[s2FPacketSetSlot.class:?]

at net.minecraft.network.play.server.S2FPacketSetSlot.processPacket(S2FPacketSetSlot.java:55) ~[s2FPacketSetSlot.class:?]

at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:18) ~[PacketThreadUtil$1.class:?]

at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_31]

at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_31]

at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:676) ~[FMLCommonHandler.class:?]

... 11 more

[11:06:10] [Client thread/FATAL] [FML]: Exception caught executing FutureTask: java.util.concurrent.ExecutionException: java.lang.NullPointerException

java.util.concurrent.ExecutionException: java.lang.NullPointerException

at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_31]

at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_31]

at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:677) [FMLCommonHandler.class:?]

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1006) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:346) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_31]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_31]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_31]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_31]

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/:?]

Caused by: java.lang.NullPointerException

at com.rosecotton.shelvesmod.RenderShelfTileEntity.<init>(RenderShelfTileEntity.java:18) ~[RenderShelfTileEntity.class:?]

at com.rosecotton.shelvesmod.ShelfTitleEntity.setInventorySlotContents(ShelfTitleEntity.java:135) ~[shelfTitleEntity.class:?]

at net.minecraft.inventory.Slot.putStack(Slot.java:67) ~[slot.class:?]

at net.minecraft.inventory.Container.putStackInSlot(Container.java:519) ~[Container.class:?]

at net.minecraft.client.network.NetHandlerPlayClient.handleSetSlot(NetHandlerPlayClient.java:1042) ~[NetHandlerPlayClient.class:?]

at net.minecraft.network.play.server.S2FPacketSetSlot.processPacket(S2FPacketSetSlot.java:30) ~[s2FPacketSetSlot.class:?]

at net.minecraft.network.play.server.S2FPacketSetSlot.processPacket(S2FPacketSetSlot.java:55) ~[s2FPacketSetSlot.class:?]

at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:18) ~[PacketThreadUtil$1.class:?]

at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_31]

at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_31]

at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:676) ~[FMLCommonHandler.class:?]

... 11 more

[11:06:10] [Client thread/FATAL] [FML]: Exception caught executing FutureTask: java.util.concurrent.ExecutionException: java.lang.NullPointerException

java.util.concurrent.ExecutionException: java.lang.NullPointerException

at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_31]

at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_31]

at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:677) [FMLCommonHandler.class:?]

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1006) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:346) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_31]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_31]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_31]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_31]

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/:?]

Caused by: java.lang.NullPointerException

at com.rosecotton.shelvesmod.RenderShelfTileEntity.<init>(RenderShelfTileEntity.java:18) ~[RenderShelfTileEntity.class:?]

at com.rosecotton.shelvesmod.ShelfTitleEntity.setInventorySlotContents(ShelfTitleEntity.java:135) ~[shelfTitleEntity.class:?]

at net.minecraft.inventory.Slot.putStack(Slot.java:67) ~[slot.class:?]

at net.minecraft.inventory.Container.putStackInSlot(Container.java:519) ~[Container.class:?]

at net.minecraft.client.network.NetHandlerPlayClient.handleSetSlot(NetHandlerPlayClient.java:1042) ~[NetHandlerPlayClient.class:?]

at net.minecraft.network.play.server.S2FPacketSetSlot.processPacket(S2FPacketSetSlot.java:30) ~[s2FPacketSetSlot.class:?]

at net.minecraft.network.play.server.S2FPacketSetSlot.processPacket(S2FPacketSetSlot.java:55) ~[s2FPacketSetSlot.class:?]

at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:18) ~[PacketThreadUtil$1.class:?]

at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_31]

at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_31]

at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:676) ~[FMLCommonHandler.class:?]

... 11 more

[11:06:10] [Client thread/FATAL] [FML]: Exception caught executing FutureTask: java.util.concurrent.ExecutionException: java.lang.NullPointerException

java.util.concurrent.ExecutionException: java.lang.NullPointerException

at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_31]

at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_31]

at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:677) [FMLCommonHandler.class:?]

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1006) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:346) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_31]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_31]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_31]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_31]

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/:?]

Caused by: java.lang.NullPointerException

at com.rosecotton.shelvesmod.RenderShelfTileEntity.<init>(RenderShelfTileEntity.java:18) ~[RenderShelfTileEntity.class:?]

at com.rosecotton.shelvesmod.ShelfTitleEntity.setInventorySlotContents(ShelfTitleEntity.java:135) ~[shelfTitleEntity.class:?]

at net.minecraft.inventory.Slot.putStack(Slot.java:67) ~[slot.class:?]

at net.minecraft.inventory.Container.putStackInSlot(Container.java:519) ~[Container.class:?]

at net.minecraft.client.network.NetHandlerPlayClient.handleSetSlot(NetHandlerPlayClient.java:1042) ~[NetHandlerPlayClient.class:?]

at net.minecraft.network.play.server.S2FPacketSetSlot.processPacket(S2FPacketSetSlot.java:30) ~[s2FPacketSetSlot.class:?]

at net.minecraft.network.play.server.S2FPacketSetSlot.processPacket(S2FPacketSetSlot.java:55) ~[s2FPacketSetSlot.class:?]

at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:18) ~[PacketThreadUtil$1.class:?]

at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_31]

at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_31]

at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:676) ~[FMLCommonHandler.class:?]

... 11 more

[11:06:16] [Client thread/FATAL]: Reported exception thrown!

net.minecraft.util.ReportedException: Updating screen events

at net.minecraft.client.Minecraft.runTick(Minecraft.java:1667) ~[Minecraft.class:?]

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1016) ~[Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:346) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_31]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_31]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_31]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_31]

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/:?]

Caused by: java.lang.NullPointerException

at com.rosecotton.shelvesmod.RenderShelfTileEntity.<init>(RenderShelfTileEntity.java:18) ~[RenderShelfTileEntity.class:?]

at com.rosecotton.shelvesmod.ShelfTitleEntity.setInventorySlotContents(ShelfTitleEntity.java:135) ~[shelfTitleEntity.class:?]

at com.rosecotton.shelvesmod.ShelfTitleEntity.decrStackSize(ShelfTitleEntity.java:102) ~[shelfTitleEntity.class:?]

at net.minecraft.inventory.Slot.decrStackSize(Slot.java:94) ~[slot.class:?]

at net.minecraft.inventory.Container.slotClick(Container.java:320) ~[Container.class:?]

at net.minecraft.client.multiplayer.PlayerControllerMP.windowClick(PlayerControllerMP.java:475) ~[PlayerControllerMP.class:?]

at net.minecraft.client.gui.inventory.GuiContainer.handleMouseClick(GuiContainer.java:637) ~[GuiContainer.class:?]

at net.minecraft.client.gui.inventory.GuiContainer.mouseClicked(GuiContainer.java:387) ~[GuiContainer.class:?]

at net.minecraft.client.gui.GuiScreen.handleMouseInput(GuiScreen.java:525) ~[GuiScreen.class:?]

at net.minecraft.client.gui.GuiScreen.handleInput(GuiScreen.java:497) ~[GuiScreen.class:?]

at net.minecraft.client.Minecraft.runTick(Minecraft.java:1653) ~[Minecraft.class:?]

... 11 more

[11:06:16] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:568]: ---- Minecraft Crash Report ----

// Hey, that tickles! Hehehe!

 

Time: 3/11/15 11:06 AM

Description: Updating screen events

 

java.lang.NullPointerException: Updating screen events

at com.rosecotton.shelvesmod.RenderShelfTileEntity.<init>(RenderShelfTileEntity.java:18)

at com.rosecotton.shelvesmod.ShelfTitleEntity.setInventorySlotContents(ShelfTitleEntity.java:135)

at com.rosecotton.shelvesmod.ShelfTitleEntity.decrStackSize(ShelfTitleEntity.java:102)

at net.minecraft.inventory.Slot.decrStackSize(Slot.java:94)

at net.minecraft.inventory.Container.slotClick(Container.java:320)

at net.minecraft.client.multiplayer.PlayerControllerMP.windowClick(PlayerControllerMP.java:475)

at net.minecraft.client.gui.inventory.GuiContainer.handleMouseClick(GuiContainer.java:637)

at net.minecraft.client.gui.inventory.GuiContainer.mouseClicked(GuiContainer.java:387)

at net.minecraft.client.gui.GuiScreen.handleMouseInput(GuiScreen.java:525)

at net.minecraft.client.gui.GuiScreen.handleInput(GuiScreen.java:497)

at net.minecraft.client.Minecraft.runTick(Minecraft.java:1653)

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1016)

at net.minecraft.client.Minecraft.run(Minecraft.java:346)

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.rosecotton.shelvesmod.RenderShelfTileEntity.<init>(RenderShelfTileEntity.java:18)

at com.rosecotton.shelvesmod.ShelfTitleEntity.setInventorySlotContents(ShelfTitleEntity.java:135)

at com.rosecotton.shelvesmod.ShelfTitleEntity.decrStackSize(ShelfTitleEntity.java:102)

at net.minecraft.inventory.Slot.decrStackSize(Slot.java:94)

at net.minecraft.inventory.Container.slotClick(Container.java:320)

at net.minecraft.client.multiplayer.PlayerControllerMP.windowClick(PlayerControllerMP.java:475)

at net.minecraft.client.gui.inventory.GuiContainer.handleMouseClick(GuiContainer.java:637)

at net.minecraft.client.gui.inventory.GuiContainer.mouseClicked(GuiContainer.java:387)

at net.minecraft.client.gui.GuiScreen.handleMouseInput(GuiScreen.java:525)

at net.minecraft.client.gui.GuiScreen.handleInput(GuiScreen.java:497)

 

-- Affected screen --

Details:

Screen name: com.rosecotton.shelvesmod.GuiInventoryShelf

 

-- Affected level --

Details:

Level name: MpServer

All players: 1 total; [EntityPlayerSP['Player680'/312, l='MpServer', x=-231.86, y=77.00, z=61.09]]

Chunk stats: MultiplayerChunkCache: 289, 289

Level seed: 0

Level generator: ID 00 - default, ver 1. Features enabled: false

Level generator options:

Level spawn location: -228.00,64.00,60.00 - World: (-228,64,60), Chunk: (at 12,4,12 in -15,3; contains blocks -240,0,48 to -225,255,63), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)

Level time: 25509 game time, 25509 day time

Level dimension: 0

Level storage version: 0x00000 - Unknown?

Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)

Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false

Forced entities: 61 total; [EntityChicken['Chicken'/135, l='MpServer', x=-262.53, y=71.00, z=-12.81], EntityChicken['Chicken'/136, l='MpServer', x=-262.50, y=78.00, z=14.44], EntityCow['Cow'/137, l='MpServer', x=-266.81, y=68.00, z=82.75], EntityChicken['Chicken'/138, l='MpServer', x=-262.50, y=66.00, z=91.28], EntityChicken['Chicken'/139, l='MpServer', x=-271.03, y=71.02, z=108.50], EntityChicken['Chicken'/140, l='MpServer', x=-271.38, y=75.00, z=114.41], EntityChicken['Chicken'/141, l='MpServer', x=-267.69, y=71.00, z=138.53], EntityChicken['Chicken'/142, l='MpServer', x=-263.50, y=70.00, z=139.09], EntityChicken['Chicken'/146, l='MpServer', x=-263.34, y=70.00, z=134.66], EntityChicken['Chicken'/147, l='MpServer', x=-265.47, y=70.00, z=134.59], EntityItem['item.item.egg'/2330, l='MpServer', x=-262.19, y=78.00, z=14.19], EntityChicken['Chicken'/157, l='MpServer', x=-245.72, y=67.00, z=-18.47], EntityChicken['Chicken'/158, l='MpServer', x=-253.66, y=71.00, z=-5.53], EntityBat['Bat'/160, l='MpServer', x=-253.72, y=16.06, z=130.00], EntityCow['Cow'/175, l='MpServer', x=-235.41, y=79.00, z=55.34], EntityBat['Bat'/177, l='MpServer', x=-234.63, y=20.28, z=132.25], EntityBat['Bat'/183, l='MpServer', x=-216.75, y=57.10, z=60.75], EntityChicken['Chicken'/190, l='MpServer', x=-207.31, y=64.00, z=-6.56], EntityChicken['Chicken'/191, l='MpServer', x=-202.50, y=64.00, z=-4.69], EntityChicken['Chicken'/192, l='MpServer', x=-201.59, y=64.00, z=12.09], EntityPig['Pig'/193, l='MpServer', x=-192.19, y=64.00, z=6.38], EntityPig['Pig'/194, l='MpServer', x=-201.03, y=64.00, z=9.00], EntityPig['Pig'/195, l='MpServer', x=-195.06, y=64.00, z=7.81], EntityChicken['Chicken'/196, l='MpServer', x=-206.63, y=64.00, z=4.84], EntityPig['Pig'/197, l='MpServer', x=-204.16, y=64.00, z=5.41], EntityChicken['Chicken'/69, l='MpServer', x=-311.41, y=82.00, z=9.59], EntityItem['item.item.egg'/198, l='MpServer', x=-200.66, y=64.00, z=12.50], EntityCow['Cow'/199, l='MpServer', x=-206.03, y=74.00, z=25.53], EntityChicken['Chicken'/200, l='MpServer', x=-202.66, y=67.00, z=21.50], EntityCow['Cow'/201, l='MpServer', x=-204.06, y=70.00, z=30.09], EntityChicken['Chicken'/75, l='MpServer', x=-308.50, y=78.00, z=87.50], EntityBat['Bat'/462, l='MpServer', x=-167.88, y=53.00, z=13.66], EntityChicken['Chicken'/78, l='MpServer', x=-311.31, y=73.00, z=102.34], EntityChicken['Chicken'/210, l='MpServer', x=-185.75, y=66.00, z=3.50], EntityChicken['Chicken'/211, l='MpServer', x=-188.63, y=64.00, z=12.41], EntityPlayerSP['Player680'/312, l='MpServer', x=-231.86, y=77.00, z=61.09], EntityChicken['Chicken'/216, l='MpServer', x=-163.28, y=70.00, z=2.56], EntityChicken['Chicken'/90, l='MpServer', x=-288.34, y=76.00, z=-17.56], EntityChicken['Chicken'/91, l='MpServer', x=-299.49, y=75.14, z=-3.53], EntityChicken['Chicken'/92, l='MpServer', x=-294.47, y=78.00, z=-7.38], EntityChicken['Chicken'/95, l='MpServer', x=-302.31, y=81.00, z=26.56], EntityItem['item.item.egg'/96, l='MpServer', x=-291.00, y=80.00, z=17.06], EntityChicken['Chicken'/97, l='MpServer', x=-291.44, y=80.00, z=17.31], EntityChicken['Chicken'/98, l='MpServer', x=-297.22, y=83.00, z=39.13], EntityChicken['Chicken'/100, l='MpServer', x=-296.41, y=83.00, z=39.75], EntityChicken['Chicken'/101, l='MpServer', x=-297.53, y=72.00, z=92.34], EntityChicken['Chicken'/229, l='MpServer', x=-151.88, y=68.00, z=-10.28], EntityChicken['Chicken'/102, l='MpServer', x=-291.69, y=71.00, z=99.34], EntityChicken['Chicken'/230, l='MpServer', x=-158.41, y=71.00, z=-12.34], EntityChicken['Chicken'/103, l='MpServer', x=-298.72, y=69.00, z=117.91], EntityBat['Bat'/489, l='MpServer', x=-168.52, y=47.82, z=68.06], EntityBat['Bat'/363, l='MpServer', x=-186.10, y=17.06, z=118.04], EntityChicken['Chicken'/115, l='MpServer', x=-274.66, y=77.00, z=12.34], EntityItem['item.item.egg'/116, l='MpServer', x=-273.75, y=79.00, z=16.19], EntityChicken['Chicken'/117, l='MpServer', x=-280.25, y=81.00, z=21.53], EntityChicken['Chicken'/118, l='MpServer', x=-282.66, y=74.00, z=81.66], EntityItem['item.item.egg'/119, l='MpServer', x=-283.31, y=70.00, z=106.88], EntityChicken['Chicken'/120, l='MpServer', x=-270.34, y=72.19, z=107.87], EntityChicken['Chicken'/121, l='MpServer', x=-283.66, y=70.00, z=106.50], EntitySquid['Squid'/379, l='MpServer', x=-172.38, y=56.06, z=110.97], EntityBat['Bat'/507, l='MpServer', x=-196.25, y=12.08, z=130.73]]

Retry entities: 0 total; []

Server brand: fml

Server type: Integrated singleplayer server

Stacktrace:

at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:350)

at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2586)

at net.minecraft.client.Minecraft.run(Minecraft.java:368)

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 (x86) version 6.1

Java Version: 1.8.0_31, Oracle Corporation

Java VM Version: Java HotSpot Client VM (mixed mode), Oracle Corporation

Memory: 802450408 bytes (765 MB) / 1060372480 bytes (1011 MB) up to 1060372480 bytes (1011 MB)

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

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

FML: MCP v9.10 FML v8.0.20.1023 5 mods loaded, 5 mods active

mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

FML{8.0.20.1023} [Forge Mod Loader] (fmlSrc-1.8-8.0.20.1023-1.8.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

testmod01{1.0} [Test Mod 01] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

oredetectmod{1.0} [Ore Detect Mod] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

shelvesmod{1.0} [shelves Mod] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

Launched Version: 1.8

LWJGL: 2.9.1

OpenGL: ATI Radeon HD 4800 Series GL version 3.3.11672 Compatibility Profile Context, ATI Technologies Inc.

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)

[11:06:16] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:568]: #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\Becky\Desktop\Forge ModLoader-1.8-8.0.20.1023-1.8-src\eclipse\.\crash-reports\crash-2015-03-11_11.06.16-client.txt

AL lib: (EE) alc_cleanup: 1 device not closed

Java HotSpot Client VM warning: Using incremental CMS is deprecated and will likely be removed in a future release

 

 

hw developer in a sw world

Posted

UPDATE:

I just stopped my mod from crashing when there's a null slot on my shelfblock (i.e. trying to render an empty item) by checking to make sure it's not null before doing the render.

 

however, it still doesn't render my items and when I remove them from my ShelfBlock storage slots, they disappear.  I must have broken something and not gotten the rendering right. 

 

package com.rosecotton.shelvesmod;

import net.minecraft.client.renderer.entity.RenderEntityItem;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.tileentity.TileEntity;

public class RenderShelfTileEntity 
{
public RenderShelfTileEntity(ShelfTitleEntity shelfTileEntity)
{
	RenderEntityItem renderEntityItem = new RenderEntityItem(null, null);
	double x = ((TileEntity)shelfTileEntity).getPos().getX();
	double y = ((TileEntity)shelfTileEntity).getPos().getY();
	double z = ((TileEntity)shelfTileEntity).getPos().getZ();
	EntityItem shelfEntityItem[] = new EntityItem[4];
	for (int n = 0; n <4; n++)
	{
		if (shelfEntityItem[n] != null)
		{
			shelfEntityItem[n].setEntityItemStack(shelfTileEntity.itemStacks[n]);
			double xPlus = x + (double)((4+(n%2)*8)/16);
			double yPlus = y + (double)((2+(n/2)*6)/16);
			double zPlus = z + (double)((13-(n/2)*8)/16);

			renderEntityItem.func_177075_a(shelfEntityItem[n], xPlus, yPlus, zPlus, 0.0625f, 1.05f);
		}


	}

}
}

hw developer in a sw world

Posted

Uhmm... that's not how you use a renderer. You probably have to use a

TESR (TileEntitySpecialRenderer)

.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted

hmmm...ok, I was hoping to get away from using that because it always led me down this trail of classes and methods until I got to arguments I couldn't figure out how to use, like RenderManager.

 

So to render an Item (any) that represents an ItemStack (any) held in a slot in the TileEntity (for me, ShelfTitleEntity because I misspelled it) of a Block (mine is BlockShelf), I need to use ShelfRenderer.renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f, int i) which extends TileEntitySpecialRenderer.

The example I found creates a model, so ModelShelf shelf = new ModelShelf() (which extends model base), and that has a render method, shelf.render(TileEntity te, double x, double y, double z) that's called in renderTileEntityAt.

 

So where do I create a ShelfRenderer object and call its renderTileEntityAt method? 

Do I do that when I close the GUI for the BlockShelf (i.e. after putting objects in or taking them out)?

hw developer in a sw world

Posted

The TileEntitySpecialRenderer itself hasn't changed, only the rendering you do inside them is different.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

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.