TLHPoE
Members-
Posts
638 -
Joined
-
Last visited
Everything posted by TLHPoE
-
I looked around in the code, and there's an IItemRenderer class. You can make a class that implements it, and register it in the MinecraftForgeClient class.
-
Why are you doing this? if (itemstack1.itemID != CanadianMod.skates.itemID This would return true if it wasn't skates. Anyways, you have to check all armor slots. ItemStack helmet = this.getEquipmentInSlot(4); ItemStack chestplate = this.getEquipmentInSlot(3); ItemStack leggings = this.getEquipmentInSlot(2); ItemStack boots = this.getEquipmentInSlot(1); Also make sure to check if the item stack isn't null! From what I can tell, you don't really know Java. I would recommend learning Java before modding Minecraft.
-
Ok, now the menu is just black now. The only change's I've made was some of the text I think. package legions.gui; import legions.ClientProxyL; import legions.UtilL; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; public class GuiMenuL extends GuiScreen { public static final ResourceLocation TEXTURE = UtilL.newResource("textures/gui/icons.png"); public void draw(ScaledResolution sr) { GL11.glPushMatrix(); GL11.glTranslatef(0, ClientProxyL.guiY, 0); UtilL.MC.renderEngine.bindTexture(TEXTURE); this.drawTexturedModalRect(0, 0, 0, 0, 128, 65); int x = (int) UtilL.getScaledX(12, sr); UtilL.drawOutlinedString("Menu", x, (int) UtilL.getScaledY(10, sr), 0xFFFFFF, 0x000000); switch(ClientProxyL.currentMenu) { case (0): { UtilL.drawString("1-Summon troops", x, (int) UtilL.getScaledY(30, sr), 0x000000); UtilL.drawString("2-Order troops", x, (int) UtilL.getScaledY(48, sr), 0x000000); UtilL.drawString("3-", x, (int) UtilL.getScaledY(66, sr), 0x000000); UtilL.drawString("4-", x, (int) UtilL.getScaledY(84, sr), 0x000000); UtilL.drawString("5-", x, (int) UtilL.getScaledY(102, sr), 0x000000); break; } case (1): { UtilL.drawString("1-All troops", x, (int) UtilL.getScaledY(30, sr), 0x000000); UtilL.drawString("2-Group 1", x, (int) UtilL.getScaledY(48, sr), 0x000000); UtilL.drawString("3-Group 2", x, (int) UtilL.getScaledY(66, sr), 0x000000); UtilL.drawString("4-Group 3", x, (int) UtilL.getScaledY(84, sr), 0x000000); UtilL.drawString("5-Group 4", x, (int) UtilL.getScaledY(102, sr), 0x000000); break; } } GL11.glPopMatrix(); } }
-
Ok, I have an overlay that slides in and out of the screen on a key press. While it's sliding, it creates some weird delay shadows behind it. This is what the delayed shadow looks like: Here's my render code: package legions.gui; import legions.ClientProxyL; import legions.UtilL; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import com.sun.org.apache.xml.internal.security.utils.I18n; public class GuiMenuL extends GuiScreen { public static final ResourceLocation TEXTURE = UtilL.newResource("textures/gui/icons.png"); public void draw(ScaledResolution sr) { GL11.glPushMatrix(); GL11.glTranslatef(0, ClientProxyL.guiY, 0); UtilL.MC.renderEngine.bindTexture(TEXTURE); this.drawTexturedModalRect(0, 0, 0, 0, 128, 65); int x = (int) UtilL.getScaledX(12, sr); UtilL.drawOutlinedString("Menu", x, (int) UtilL.getScaledY(10, sr), 0xFFFFFF, 0x000000); switch(ClientProxyL.currentMenu) { case (0): { UtilL.drawString("1-Summon troops", x, (int) UtilL.getScaledY(30, sr), 0x000000); UtilL.drawString("2-Order troops", x, (int) UtilL.getScaledY(48, sr), 0x000000); UtilL.drawString("3-", x, (int) UtilL.getScaledY(66, sr), 0x000000); UtilL.drawString("4-", x, (int) UtilL.getScaledY(84, sr), 0x000000); UtilL.drawString("5-", x, (int) UtilL.getScaledY(102, sr), 0x000000); break; } case (1): { UtilL.drawString("1-All troops", x, (int) UtilL.getScaledY(30, sr), 0x000000); UtilL.drawString("2-Group 1", x, (int) UtilL.getScaledY(48, sr), 0x000000); UtilL.drawString("3-Group 2", x, (int) UtilL.getScaledY(66, sr), 0x000000); UtilL.drawString("4-Group 3", x, (int) UtilL.getScaledY(84, sr), 0x000000); UtilL.drawString("5-Group 4", x, (int) UtilL.getScaledY(102, sr), 0x000000); break; } } GL11.glPopMatrix(); } }
-
Everything seems alright. It might be your file location? The file oliv.png should be in /assets/pizzamod/textures/items/.
-
The entity constructing event is in the code I already posted. Here's my registering code: package poop; import net.minecraftforge.common.MinecraftForge; import poop.handler.GuiHandlerP; import poop.handler.ServerEventHandlerP; import poop.handler.ServerTickHandlerP; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.network.NetworkRegistry; public class ServerProxyP { public void initServer() { MinecraftForge.EVENT_BUS.register(new ServerEventHandlerP()); FMLCommonHandler.instance().bus().register(new ServerTickHandlerP()); NetworkRegistry.INSTANCE.registerGuiHandler(Poop.instance, new GuiHandlerP()); } public void initClient() { } }
-
Ok, I'll do that. In my first event (entity constructing) I add it. I'm keeping count of how many food bars the player has eaten. Like when the player eats steak, it adds 8. I'm trying to avoid using packets to sync the data.
-
[1.7.2] Consuming inventory item based on item damage/metadata
TLHPoE replied to Jacknoshima's topic in Modder Support
You could go through all of the item stacks that are in the slots and check the item and meta data. -
Forgot the crash report: ---- Minecraft Crash Report ---- // Oops. Time: 4/10/14 5:36 PM Description: Unexpected error java.lang.NullPointerException: Unexpected error at net.minecraft.entity.DataWatcher.getWatchableObjectInt(DataWatcher.java:98) at poop.handler.ServerEventHandlerP.bowlUsed(ServerEventHandlerP.java:49) at cpw.mods.fml.common.eventhandler.ASMEventHandler_8_ServerEventHandlerP_bowlUsed_PlayerInteractEvent.invoke(.dynamic) at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:51) at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:122) at net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(ForgeEventFactory.java:57) at net.minecraft.client.Minecraft.func_147121_ag(Minecraft.java:1525) at net.minecraft.client.Minecraft.runTick(Minecraft.java:2011) at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:996) at net.minecraft.client.Minecraft.run(Minecraft.java:912) at net.minecraft.client.main.Main.main(Main.java:112) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at net.minecraft.entity.DataWatcher.getWatchableObjectInt(DataWatcher.java:98) at poop.handler.ServerEventHandlerP.bowlUsed(ServerEventHandlerP.java:49) at cpw.mods.fml.common.eventhandler.ASMEventHandler_8_ServerEventHandlerP_bowlUsed_PlayerInteractEvent.invoke(.dynamic) at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:51) at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:122) at net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(ForgeEventFactory.java:57) at net.minecraft.client.Minecraft.func_147121_ag(Minecraft.java:1525) -- Affected level -- Details: Level name: MpServer All players: 1 total; [EntityClientPlayerMP['Player270'/210, l='MpServer', x=-244.73, y=71.62, z=235.97]] Chunk stats: MultiplayerChunkCache: 255, 255 Level seed: 0 Level generator: ID 00 - default, ver 1. Features enabled: false Level generator options: Level spawn location: World: (-256,64,244), Chunk: (at 0,4,4 in -16,15; contains blocks -256,0,240 to -241,255,255), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511) Level time: 676 game time, 676 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: 107 total; [EntityBat['Bat'/1360, l='MpServer', x=-290.25, y=15.78, z=219.59], EntityBat['Bat'/1659, l='MpServer', x=-284.75, y=34.10, z=188.75], EntityBat['Bat'/1658, l='MpServer', x=-284.75, y=25.84, z=193.25], EntityCaveBatRF['Cave Bat'/269, l='MpServer', x=-287.50, y=37.00, z=189.50], EntityCaveBatRF['Cave Bat'/314, l='MpServer', x=-169.50, y=32.00, z=253.50], EntityCaveBatRF['Cave Bat'/319, l='MpServer', x=-175.50, y=21.00, z=262.50], EntityCaveBatRF['Cave Bat'/318, l='MpServer', x=-178.50, y=21.00, z=261.50], EntityCaveBatRF['Cave Bat'/2491, l='MpServer', x=-240.50, y=30.00, z=290.50], EntityCaveBatRF['Cave Bat'/529, l='MpServer', x=-322.50, y=54.00, z=178.50], EntityCaveBatRF['Cave Bat'/1570, l='MpServer', x=-263.50, y=42.00, z=315.50], EntityCreeper['Creeper'/622, l='MpServer', x=-286.50, y=41.00, z=296.50], EntityFireCreeper['Fire Creeper'/623, l='MpServer', x=-292.50, y=53.00, z=189.50], EntityCreeper['Creeper'/621, l='MpServer', x=-284.59, y=44.00, z=291.00], EntityFireCreeper['Fire Creeper'/624, l='MpServer', x=-292.50, y=53.00, z=186.50], EntityCaveBatRF['Cave Bat'/634, l='MpServer', x=-299.50, y=56.00, z=235.50], EntityBat['Bat'/2514, l='MpServer', x=-167.15, y=30.82, z=245.66], EntityChicken['Chicken'/102, l='MpServer', x=-297.56, y=64.00, z=241.41], EntityChicken['Chicken'/100, l='MpServer', x=-300.50, y=64.00, z=235.50], EntityChicken['Chicken'/101, l='MpServer', x=-298.50, y=64.00, z=236.50], EntityChicken['Chicken'/99, l='MpServer', x=-298.47, y=65.00, z=225.56], EntityFireCreeper['Fire Creeper'/368, l='MpServer', x=-276.50, y=46.00, z=290.50], EntityBat['Bat'/2538, l='MpServer', x=-289.64, y=31.00, z=196.93], EntityChicken['Chicken'/110, l='MpServer', x=-286.50, y=64.00, z=246.50], EntityChicken['Chicken'/111, l='MpServer', x=-295.50, y=63.00, z=310.50], EntityChicken['Chicken'/108, l='MpServer', x=-282.59, y=64.00, z=244.53], EntityBat['Bat'/2534, l='MpServer', x=-172.48, y=59.09, z=164.63], EntityChicken['Chicken'/109, l='MpServer', x=-290.59, y=67.00, z=249.41], EntityChicken['Chicken'/107, l='MpServer', x=-289.75, y=70.00, z=252.64], EntityMinecartChest['entity.MinecartChest.name'/119, l='MpServer', x=-250.50, y=33.50, z=317.50], EntityChicken['Chicken'/118, l='MpServer', x=-251.50, y=68.00, z=301.50], EntityCaveBatRF['Cave Bat'/1567, l='MpServer', x=-296.50, y=54.00, z=233.50], EntityChicken['Chicken'/117, l='MpServer', x=-251.50, y=68.00, z=301.50], EntityCaveBatRF['Cave Bat'/2284, l='MpServer', x=-318.50, y=51.00, z=212.50], EntityChicken['Chicken'/116, l='MpServer', x=-250.50, y=68.00, z=301.50], EntityCaveBatRF['Cave Bat'/1324, l='MpServer', x=-318.50, y=55.00, z=211.50], EntityChicken['Chicken'/115, l='MpServer', x=-248.50, y=77.00, z=302.50], EntityCaveBatRF['Cave Bat'/2282, l='MpServer', x=-314.50, y=51.00, z=210.50], EntityChicken['Chicken'/114, l='MpServer', x=-293.50, y=64.00, z=310.50], EntityCaveBatRF['Cave Bat'/1325, l='MpServer', x=-247.50, y=14.00, z=240.50], EntityCaveBatRF['Cave Bat'/2281, l='MpServer', x=-316.50, y=51.00, z=211.50], EntityChicken['Chicken'/113, l='MpServer', x=-294.50, y=63.00, z=310.50], EntityChicken['Chicken'/112, l='MpServer', x=-293.50, y=64.00, z=310.50], EntityCaveBatRF['Cave Bat'/2279, l='MpServer', x=-310.50, y=51.00, z=211.50], EntityBat['Bat'/1559, l='MpServer', x=-289.91, y=29.10, z=171.22], EntityPig['Pig'/125, l='MpServer', x=-233.50, y=67.00, z=161.50], EntityPig['Pig'/124, l='MpServer', x=-233.81, y=71.00, z=164.50], EntityPig['Pig'/123, l='MpServer', x=-236.94, y=71.00, z=165.03], EntityPig['Pig'/122, l='MpServer', x=-232.47, y=71.00, z=164.50], EntitySkeleton['Skeleton'/607, l='MpServer', x=-320.44, y=30.00, z=181.94], EntityCaveBatRF['Cave Bat'/1500, l='MpServer', x=-292.50, y=58.00, z=234.50], EntityCaveBatRF['Cave Bat'/1501, l='MpServer', x=-280.50, y=58.00, z=229.50], EntityPig['Pig'/152, l='MpServer', x=-187.50, y=73.00, z=214.50], EntityBat['Bat'/1478, l='MpServer', x=-190.26, y=41.10, z=309.55], EntityPig['Pig'/153, l='MpServer', x=-176.97, y=72.00, z=202.94], EntityCaveBatRF['Cave Bat'/2321, l='MpServer', x=-191.50, y=12.00, z=236.50], EntityBat['Bat'/1477, l='MpServer', x=-206.75, y=39.64, z=305.50], EntityPig['Pig'/154, l='MpServer', x=-185.50, y=64.00, z=273.50], EntityPig['Pig'/155, l='MpServer', x=-185.50, y=64.00, z=275.50], EntityPig['Pig'/156, l='MpServer', x=-187.50, y=64.00, z=274.50], EntityPig['Pig'/157, l='MpServer', x=-188.50, y=64.00, z=272.50], EntityCreeper['Creeper'/939, l='MpServer', x=-202.50, y=39.00, z=313.50], EntityPig['Pig'/158, l='MpServer', x=-174.34, y=72.00, z=203.13], EntityCreeper['Creeper'/938, l='MpServer', x=-206.50, y=39.00, z=314.50], EntityPig['Pig'/159, l='MpServer', x=-174.19, y=71.00, z=206.22], EntityDirtCreeper['Dirt Creeper'/933, l='MpServer', x=-188.50, y=39.00, z=314.50], EntityDirtCreeper['Dirt Creeper'/932, l='MpServer', x=-191.50, y=39.00, z=312.50], EntityFireCreeper['Fire Creeper'/692, l='MpServer', x=-198.97, y=15.00, z=289.50], EntityIceCreeper['Ice Creeper'/690, l='MpServer', x=-192.50, y=15.00, z=288.50], EntityDirtCreeper['Dirt Creeper'/691, l='MpServer', x=-197.50, y=15.00, z=289.50], EntityPig['Pig'/150, l='MpServer', x=-184.50, y=75.00, z=213.50], EntityPig['Pig'/151, l='MpServer', x=-187.50, y=73.00, z=214.50], EntityBat['Bat'/2336, l='MpServer', x=-316.25, y=23.70, z=234.31], EntityCaveBatRF['Cave Bat'/1525, l='MpServer', x=-178.50, y=24.00, z=245.50], EntityPig['Pig'/175, l='MpServer', x=-167.50, y=70.00, z=184.50], EntityPig['Pig'/163, l='MpServer', x=-174.19, y=69.00, z=235.50], EntityPig['Pig'/162, l='MpServer', x=-175.78, y=69.00, z=235.50], EntityPig['Pig'/161, l='MpServer', x=-173.03, y=72.00, z=202.50], EntityPig['Pig'/160, l='MpServer', x=-172.50, y=71.00, z=202.50], EntityPig['Pig'/165, l='MpServer', x=-178.50, y=69.00, z=236.50], EntityPig['Pig'/164, l='MpServer', x=-175.50, y=69.00, z=232.50], EntityCreeper['Creeper'/660, l='MpServer', x=-238.50, y=30.00, z=298.50], EntityPig['Pig'/176, l='MpServer', x=-167.50, y=70.00, z=186.50], EntityCreeper['Creeper'/658, l='MpServer', x=-240.50, y=30.00, z=297.50], EntityCreeper['Creeper'/659, l='MpServer', x=-238.84, y=30.00, z=296.84], EntitySnowCreeper['Snow Creeper'/1156, l='MpServer', x=-308.50, y=22.00, z=241.50], EntityCaveBatRF['Cave Bat'/1434, l='MpServer', x=-293.50, y=55.00, z=226.50], EntityCaveBatRF['Cave Bat'/1435, l='MpServer', x=-296.50, y=55.00, z=227.50], EntityBat['Bat'/1437, l='MpServer', x=-275.67, y=55.02, z=228.66], EntityIceCreeper['Ice Creeper'/1415, l='MpServer', x=-198.50, y=48.00, z=295.50], EntityIceCreeper['Ice Creeper'/1414, l='MpServer', x=-196.50, y=48.00, z=295.50], EntityCaveBatRF['Cave Bat'/2124, l='MpServer', x=-323.50, y=36.00, z=159.50], EntitySnowCreeper['Snow Creeper'/1416, l='MpServer', x=-316.50, y=27.00, z=222.50], EntityBat['Bat'/2120, l='MpServer', x=-199.75, y=32.10, z=314.75], EntityCaveBatRF['Cave Bat'/978, l='MpServer', x=-294.50, y=25.00, z=185.50], EntityIceCreeper['Ice Creeper'/500, l='MpServer', x=-286.50, y=51.00, z=262.50], EntityCaveBatRF['Cave Bat'/1465, l='MpServer', x=-315.50, y=12.00, z=247.50], EntityIceCreeper['Ice Creeper'/501, l='MpServer', x=-285.50, y=51.00, z=266.50], EntityIceCreeper['Ice Creeper'/502, l='MpServer', x=-284.50, y=51.00, z=263.50], EntityCaveBatRF['Cave Bat'/982, l='MpServer', x=-323.50, y=27.00, z=219.50], EntityCaveBatRF['Cave Bat'/710, l='MpServer', x=-180.50, y=41.00, z=246.50], EntityCaveBatRF['Cave Bat'/730, l='MpServer', x=-279.50, y=56.00, z=238.50], EntityCaveBatRF['Cave Bat'/1921, l='MpServer', x=-230.50, y=36.00, z=306.50], EntityClientPlayerMP['Player270'/210, l='MpServer', x=-244.73, y=71.62, z=235.97], EntityBat['Bat'/723, l='MpServer', x=-221.25, y=40.10, z=309.75], EntityCaveBatRF['Cave Bat'/724, l='MpServer', x=-224.50, y=39.00, z=316.50], EntityCaveBatRF['Cave Bat'/726, l='MpServer', x=-313.50, y=44.00, z=200.50], EntityCaveBatRF['Cave Bat'/482, l='MpServer', x=-292.50, y=30.00, z=196.50]] Retry entities: 0 total; [] Server brand: fml,forge Server type: Integrated singleplayer server Stacktrace: at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:412) at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2517) at net.minecraft.client.Minecraft.run(Minecraft.java:941) at net.minecraft.client.main.Main.main(Main.java:112) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) -- System Details -- Details: Minecraft Version: 1.7.2 Operating System: Windows 7 (amd64) version 6.1 Java Version: 1.7.0_51, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 712513128 bytes (679 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M AABB Pool Size: 10003 (560168 bytes; 0 MB) allocated, 2 (112 bytes; 0 MB) used IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95 FML: MCP v9.01-pre FML v7.2.137.1055 Minecraft Forge 10.12.0.1055 11 mods loaded, 11 mods active mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available FML{7.2.137.1055} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.0.1055.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Forge{10.12.0.1055} [Minecraft Forge] (forgeSrc-1.7.2-10.12.0.1055.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available examplemod{1.0} [Example Mod] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available deathchest{1.0} [Death Chest] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available enderStorage{1.0} [Ender Storage] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available increasedHealth{1.0} [increased Health] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available moretools{1.0} [More Tools] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available poop{1.0} [The Excrement Mod] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available realmoffera{Indev 1} [Realm of Fera] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available variedcreepers{1.0} [Varied Creepers] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Launched Version: 1.6 LWJGL: 2.9.0 OpenGL: GeForce GT 520/PCIe/SSE2 GL version 4.3.0, NVIDIA Corporation Is Modded: Definitely; Client brand changed to 'fml,forge' Type: Client (map_client.txt) Resource Packs: [] Current Language: English (US) Profiler Position: N/A (disabled) Vec3 Pool Size: 2152 (120512 bytes; 0 MB) allocated, 17 (952 bytes; 0 MB) used Anisotropic Filtering: Off (1)
-
For some reason it returns a null pointer when I try retrieving data from the data watcher using the ID of 19. Code: package poop.handler; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemFood; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ChatComponentText; import net.minecraftforge.event.entity.EntityEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action; import net.minecraftforge.event.entity.player.PlayerUseItemEvent; import poop.Poop; import cpw.mods.fml.common.eventhandler.SubscribeEvent; public class ServerEventHandlerP { @SubscribeEvent public void playerConstruct(EntityEvent.EntityConstructing event) { if(!event.entity.worldObj.isRemote) { Entity entity = event.entity; if(entity instanceof EntityPlayer) { NBTTagCompound nbt = entity.getEntityData(); if(!nbt.hasKey("Food Eaten")) { nbt.setInteger("Food Eaten", 0); } entity.getDataWatcher().addObject(19, Integer.valueOf(nbt.getInteger("Food Eaten"))); } } } @SubscribeEvent public void foodEaten(PlayerUseItemEvent.Finish event) { if(!event.entityPlayer.worldObj.isRemote) { if(event.item.getItem() instanceof ItemFood) { System.err.println("FOOD EATEN"); NBTTagCompound nbt = event.entityPlayer.getEntityData(); nbt.setInteger("Food Eaten", nbt.getInteger("Food Eaten") + ((ItemFood) event.item.getItem()).func_150905_g(event.item)); event.entityPlayer.getDataWatcher().addObject(19, Integer.valueOf(nbt.getInteger("Food Eaten"))); } } } @SubscribeEvent public void bowlUsed(PlayerInteractEvent event) { if(event.action == Action.RIGHT_CLICK_AIR) { EntityPlayer player = event.entityPlayer; if(player.getHeldItem().getItem() == Items.bowl) { System.err.println("BOWL USED"); if(player.getDataWatcher().getWatchableObjectInt(19) >= { //Crash player.openGui(Poop.instance, 0, player.worldObj, (int) player.posX, (int) player.posY, (int) player.posZ); if(!event.entityPlayer.worldObj.isRemote) ServerTickHandlerP.addTimer(player); } else { player.addChatComponentMessage(new ChatComponentText("You haven't eaten enough to food!")); } } } } }
-
Is there anyway to stop the game from pausing in a GuiScreen? package poop.gui; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.resources.I18n; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import poop.Poop; public class GuiPooping extends GuiScreen { public static final ResourceLocation TEXTURE = new ResourceLocation("poop:textures/gui/icons.png"); @Override public void drawScreen(int par1, int par2, float par3) { this.drawDefaultBackground(); GL11.glPushMatrix(); GL11.glScalef(2.0F, 2.0F, 2.0F); this.drawCenteredString(this.fontRendererObj, EnumChatFormatting.YELLOW + I18n.format("gui.pooping", new Object[0]), this.width / 2 / 2, 30, 16777215); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glScalef(1.5F, 1.5F, 1.5F); this.drawCenteredString(this.fontRendererObj, EnumChatFormatting.YELLOW + I18n.format("gui.ready", new Object[0]) + Poop.countDown + "...", this.width / 2 / 2, 50, 16777215); GL11.glPopMatrix(); this.mc.getTextureManager().bindTexture(TEXTURE); this.drawTexturedModalRect((this.width - 256) / 2, ((this.height - 10) / 2) + this.height / 4, 0, 0, 256, 10); } }
-
My mod is going to be client-side only.
-
Is there anyway to make the player drop an item stack on client side? Better question, is there anyway of doing this by getting the slot of a container? I have the slot, but I'm not sure how to make the player drop the item stack that is inside the slot.
-
Mazetar: Does a tab count as a character? sequituri: Nope, { "mob.mummy.say": { "category": "hostile", "sounds": [{ "mob/mummy/say" }] }, "mob.mummy.death": { "category": "hostile", "sounds": [{ "name": "mob/mummy/death" }] }, "mob.mummy.hurt": { "category": "hostile", "sounds": [{ "name": "mob/mummy/hurt" }] }, "mob.paladin.death": { "category": "hostile", "sounds": [{ "name": "mob/paladin/death" }] }, "mob.paladin.hurt": { "category": "hostile", "sounds": [{ "name": "mob/paladin/hurt" }] }, "coinBag.pickUp": { "category": "player", "sounds": [{ "name": "coinBag/pickUp1", "coinBag/pickUp2", "coinBag/pickUp3" }] } } Edit: I got it to work, but I had to cut the amout of sounds in 1 name to 1. { "mob.mummy.say": { "category": "hostile", "sounds": [{ "name": "mob/mummy/say" }] }, "mob.mummy.death": { "category": "hostile", "sounds": [{ "name": "mob/mummy/death" }] }, "mob.mummy.hurt": { "category": "hostile", "sounds": [{ "name": "mob/mummy/hurt" }] }, "mob.paladin.death": { "category": "hostile", "sounds": [{ "name": "mob/paladin/death" }] }, "mob.paladin.hurt": { "category": "hostile", "sounds": [{ "name": "mob/paladin/hurt" }] }, "coinBag.pickUp": { "category": "player", "sounds": [{ "name": "coinBag/pickUp1" }] } }
-
You didn't give the player anything. The method returns an item, it doesn't automatically give the player the item.
-
Ok, I've gotten the method to work. It also returns blocks too, since each block has an ItemBlock version. public static Item getRandomItem() { Item i = null; int length = Item.itemRegistry.getKeys().toArray().length; Object select = Item.itemRegistry.getObjectById(UtilRF.RANDOM.nextInt(length)); if(select != null && select instanceof Item) { i = (Item) select; } else { return getRandomItem(); } return i; } 100% sure to work, tested.
-
I was just scrolling through my console, and I found this: [11:16:42] [Client thread/WARN]: Invalid sounds.json com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Unterminated array at line 5 column 11 at com.google.gson.internal.Streams.parse(Streams.java:56) ~[streams.class:?] at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:54) ~[TreeTypeAdapter.class:?] at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:40) ~[TypeAdapterRuntimeTypeWrapper.class:?] at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.read(MapTypeAdapterFactory.java:187) ~[MapTypeAdapterFactory$Adapter.class:?] at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.read(MapTypeAdapterFactory.java:145) ~[MapTypeAdapterFactory$Adapter.class:?] at com.google.gson.Gson.fromJson(Gson.java:803) ~[Gson.class:?] at com.google.gson.Gson.fromJson(Gson.java:768) ~[Gson.class:?] at net.minecraft.client.audio.SoundHandler.onResourceManagerReload(SoundHandler.java:83) [soundHandler.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:124) [simpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.startGame(Minecraft.java:527) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:892) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:112) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_51] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_51] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_51] at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_51] at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?] Caused by: com.google.gson.stream.MalformedJsonException: Unterminated array at line 5 column 11 at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1505) ~[JsonReader.class:?] at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:465) ~[JsonReader.class:?] at com.google.gson.stream.JsonReader.hasNext(JsonReader.java:403) ~[JsonReader.class:?] at com.google.gson.internal.bind.TypeAdapters$25.read(TypeAdapters.java:658) ~[TypeAdapters$25.class:?] at com.google.gson.internal.bind.TypeAdapters$25.read(TypeAdapters.java:667) ~[TypeAdapters$25.class:?] at com.google.gson.internal.bind.TypeAdapters$25.read(TypeAdapters.java:642) ~[TypeAdapters$25.class:?] at com.google.gson.internal.Streams.parse(Streams.java:44) ~[streams.class:?] ... 17 more I know something is wrong with line 5 at column 11 (I don't know how to count columns?), but it doesn't seem like anything is wrong.
-
For some reason it returns it everytime. And, why is there: UtilRF.RANDOM.nextInt()? Instead of UtilRF.nextInt() I don't use UtilRF.nextInt() because UtilRF doesn't have a method called nextInt. I keep a static Random object in the class whenever I need to use one.
-
I don't know what went wrong, but a couple of versions back (1024), the sounds were working perfectly. Now, they don't. I call the sounds like this: worldObj.playSoundAtEntity(player, "realmoffera:coinBag.pickUp", 0.1F, 0.5F * ((UtilRF.RANDOM.nextFloat() - UtilRF.RANDOM.nextFloat()) * 0.7F + 1.8F)); I get this in the console: [10:58:31] [Client thread/WARN]: Unable to play unknown soundEvent: realmoffera:coinBag.pickUp Here are my folders: Finally, here's my sounds.json file: { "mob.mummy.say": { "category": "hostile", "sounds": [ "name": "mob/mummy/say" ] }, "mob.mummy.death": { "category": "hostile", "sounds": [ "name": "mob/mummy/death" ] }, "mob.mummy.hurt": { "category": "hostile", "sounds": [ "name": "mob/mummy/hurt" ] }, "mob.paladin.death": { "category": "hostile", "sounds": [ "name": "mob/paladin/death" ] }, "mob.paladin.hurt": { "category": "hostile", "sounds": [ "name": "mob/paladin/hurt" ] }, "coinBag.pickUp": { "category": "player", "sounds": [ "name": "coinBag/pickUp1", "coinBag/pickUp2", "coinBag/pickUp3" ] } }
-
It only returns it if the object isn't an instance of an item, which is unlikely.
-
This screws up the rendering a little bit: Render Code: package realmoffera.client.render; import net.minecraft.client.renderer.entity.Render; import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import realmoffera.UtilRF; import realmoffera.client.model.ModelCoinBagRF; import realmoffera.entity.EntityCoinBagRF; public class RenderCoinBagRF extends Render { public static final ResourceLocation TEX = UtilRF.newResource("textures/entity/coinBag.png"); public static final ModelCoinBagRF model = new ModelCoinBagRF(); public RenderCoinBagRF() { super(); } @Override public void doRender(Entity entity, double x, double y, double z, float yaw, float partialTick) { GL11.glPushMatrix(); GL11.glTranslated(x, y, z); GL11.glScalef(0.5F, 0.5F, 0.5F); GL11.glRotated(180, 0, 0, 0); bindTexture(getEntityTexture(entity)); model.render(entity, 0, 0, 0, 0, 0, 0.0625F); GL11.glPopMatrix(); } @Override protected ResourceLocation getEntityTexture(Entity e) { return TEX; } }
-
I haven't tested this code yet, so yeah: public static Item getRandomItem() { Item i = null; Object[] objects = Item.itemRegistry.getKeys().toArray(); Object select = objects[utilRF.RANDOM.nextInt(objects.length)]; if(select instanceof Item) { i = (Item) select; } else { return getRandomItem(); } return i; } UtilRF.RANDOM is a Random object.
-
I have this model: It renders in game, but upsidedown: Model Code: // Date: 4/6/2014 5:32:28 PM // Template version 1.1 // Java generated by Techne // Keep in mind that you still need to fill in some blanks // - ZeuX package realmoffera.client.model; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; public class ModelCoinBagRF extends ModelBase { //fields ModelRenderer Shape1; ModelRenderer Shape2; ModelRenderer Shape3; ModelRenderer Shape4; ModelRenderer Shape6; ModelRenderer Shape5; public ModelCoinBagRF() { textureWidth = 64; textureHeight = 64; Shape1 = new ModelRenderer(this, 0, 0); Shape1.addBox(0F, 0F, 0F, 16, 10, 16); Shape1.setRotationPoint(-8F, 12F, -8F); Shape1.setTextureSize(64, 64); Shape1.mirror = true; setRotation(Shape1, 0F, 0F, 0F); Shape2 = new ModelRenderer(this, 0, 26); Shape2.addBox(0F, 0F, 0F, 14, 2, 14); Shape2.setRotationPoint(-7F, 22F, -7F); Shape2.setTextureSize(64, 64); Shape2.mirror = true; setRotation(Shape2, 0F, 0F, 0F); Shape3 = new ModelRenderer(this, 0, 26); Shape3.addBox(0F, 0F, 0F, 14, 2, 14); Shape3.setRotationPoint(-7F, 10F, -7F); Shape3.setTextureSize(64, 64); Shape3.mirror = true; setRotation(Shape3, 0F, 0F, 0F); Shape4 = new ModelRenderer(this, 0, 42); Shape4.addBox(0F, 0F, 0F, 4, 2, 4); Shape4.setRotationPoint(-2F, 8F, -2F); Shape4.setTextureSize(64, 64); Shape4.mirror = true; setRotation(Shape4, 0F, 0F, 0F); Shape6 = new ModelRenderer(this, 0, 48); Shape6.addBox(0F, 0F, 0F, 6, 2, 6); Shape6.setRotationPoint(-3F, 6F, -3F); Shape6.setTextureSize(64, 64); Shape6.mirror = true; setRotation(Shape6, 0F, 0F, 0F); Shape5 = new ModelRenderer(this, 16, 42); Shape5.addBox(0F, 0F, 0F, 1, 2, 4); Shape5.setRotationPoint(-2F, 8F, 1F); Shape5.setTextureSize(64, 64); Shape5.mirror = true; setRotation(Shape5, 0F, -0.7853982F, 0F); } public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); Shape1.render(f5); Shape2.render(f5); Shape3.render(f5); Shape4.render(f5); Shape6.render(f5); Shape5.render(f5); } private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); } }
-
One small question, what do I plugin for i and j when finding the mouse's position? int k = Mouse.getX() * i / this.mc.displayWidth; int l = j - Mouse.getY() * j / this.mc.displayHeight - 1;