Jump to content

NomNuggetNom

Members
  • Posts

    92
  • Joined

  • Last visited

Everything posted by NomNuggetNom

  1. If I wanted to allow this to happen in-game, how would I create a GuiScreen without disrupting the environment? I have a custom HUD that I want to allow players to manipulate when they want. I hope this makes sense. EDIT: I was thinking about it some more, and I might not even need this. I could just set a boolean when I wanted to allow editing. The problem is, chat goes to it's "focused height" and takes up a larger area of the screen. Hmm. I would need a GuiScreen to override mouseClickMove anyway.
  2. I am a total noobscrub at this. Can you link me a tutorial. I have no clue what people mean when they say "Use Java 7" Does that mean that i change my variable so it goes to the java 7 folder or does it mean i install Java 7 or java JDK 7? Install JRE 7 and JDK 7, then uninstall JRE/JDK 8.
  3. So, in Eclipse, the resulting path would be "src/main/resources/assets/modid/image.png", and the resulting code would be: new ResourceLocation("modid", "image.png") Correct?
  4. Thank you for your post. Yes, I am trying to render an image on a HUD (I already have lots of text and other info displaying, mind you). My main problem is storing and referencing my image. From what I've seen, I reference my image like this: private static final ResourceLocation resource = new ResourceLocation("modid", "textures/image.png"); But where am I actually putting "image.png"? In "src/main/resources/textures/"? Then to draw, I bind the texture and draw a rectangle. I think I can handle that part.
  5. Yes yes, but.. how?! Where do I put my image, how do I reference it, how do I draw it? Fromw hat I've seen, I reference it like this: private static final ResourceLocation resource = new ResourceLocation("modid", "textures/image.png"); But where am I actually putting "image.png"? In "src/main/resources/textures/"? Then to draw, I bind the texture and draw a rectangle. I think I can handle that part.
  6. I was trying not to use the word item. I don't want to add an item to the game, I just want to draw a simple image on the HUD. The tutorial requires creating an entity and such, I was hoping to do it without all that.
  7. I just mean a 2D image. It's not really a texture, as in it won't be used for an block or item. Just imagine drawing a Google logo or something on the screen. No animation or anything, nothing on a block, etc.
  8. I am trying to render an image on a HUD. My main problem is storing and referencing my image. From what I've seen, I reference my image like this: private static final ResourceLocation resource = new ResourceLocation("modid", "textures/image.png"); But where am I actually putting "image.png"? In "src/main/resources/textures/"? Then to draw, I bind the texture and draw a rectangle. I think I can handle that part.
  9. This is the solution. Thank you very much.
  10. I'm not sure what you mean. The only purpose of the class is to play a sound on a chat event. I posted the whole class.
  11. I am not overriding any other method, and the class is not extending anything.
  12. You can use the event LivingDeathEvent and check the instanceof. For example: @SubscribeEvent public void onDeath(LivingDeathEvent event) { if (event.entity instanceof EntityEnderman) { // Increase your count here. } } I haven't personally been able to figure out how to check the source entity type. event.source.getEntity() only returns null (seriously, it's hard coded in).
  13. You're either trolling, or were dropped on your head as a child. That is not the entire method. That doesn't even validate as java. Reread my post or read the post above this. Sorry guys, I misunderstood. To make it much easier, I have separated it into it's own class - both to make sure nothing is interfering, and to make it easier to debug. import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraft.client.Minecraft; import net.minecraftforge.client.event.ClientChatReceivedEvent; public class ChatSound { public static Minecraft mc = Minecraft.getMinecraft(); @SubscribeEvent public void onChat(ClientChatReceivedEvent event) { System.out.println("About to play a sound."); mc.theWorld.playSoundAtEntity(mc.thePlayer, "random.levelup", 1.0F, 1.0F); System.out.println("Done playing a sound."); } } Every time chat comes in, the lines are being printed, so I know the event is being called. My apologies for the misunderstanding. Thank you guys for trying to help, I really appreciate it. If I am still giving you the wrong things, please tell me - I'm not trying to make it hard for you guys to help .
  14. You're misunderstanding. For people to help you you'll need to show the entire class, not just that method. playSoundAtEntity() works just fine. Its a vanilla method. If it didn't, than there'd be no sound in the vanilla game. In order to see what is happening to cause it to not work, we need to see the rest of the .java file's contents to understand where the problem is. You can't expect help on something without providing people with the thing you need help on. I understand. I posted the method above.
  15. The thing is, the rest of the code is really messy and completely unrelated. I've posted only the relevant code because I didn't want people to be confused . But here, I moved it out of where it is, and into a more general spot (still not working): @SubscribeEvent public void onChat(ClientChatReceivedEvent event) { mc.theWorld.playSoundAtEntity(mc.thePlayer, "random.levelup", 1.0F, 1.0F); ChatFilter.handleChat(event); }
  16. It's not, and I'd rather not share the code right now. Perhaps you could just copy the bit I pasted and see if it works?
  17. It's a very large method, with lots of unrelated bits. What could possibly be affecting it in the method? So, here's proof it's making it there: System.out.println("abc123"); mc.theWorld.playSoundAtEntity(mc.thePlayer, "random.levelup", 0.75F, 1.0F); System.out.println("123abc"); Which results as abc123 123abc on the console. So, jabelar, no errors or anything :\
  18. Plain and simple, sounds are not playing. I am trying to use vanilla sounds. Here's an example: mc.theWorld.playSoundAtEntity(mc.thePlayer, "random.levelup", 0.75F, 1.0F); I'm sure it's reaching this code. I copied the "random.levelup" from the EntityPlayerMP class, where the player is leveling up. But I don't hear anything. My mod is client-side only on a vanilla server. Any help is appreciated EDIT: This is the solution: mc.thePlayer.playSound("random.levelup", 0.75F, 1.0F);
  19. Just to be clear, I am creating a client-side only mod for playing on a vanilla server. Does it still trigger? Oops, I doubt it. Client-only mods can process and reveal data from the server (hence the notorious "X-ray" mods), but they can't change the world. You might eventually program something client-side that will tell you that you earned an achievement, but your vanilla client won't fire via the usual vanilla client pathways (it's not receiving the server packets telling it to do so). If you walk through the vanilla code behind your stat call, you'll probably find one of those pesky "!isRemote()" tests barring the gate. Thank you, that must be the problem. I'm having a similar problem with playing custom sounds. What a shame .
  20. Just to be clear, I am creating a client-side only mod for playing on a vanilla server. Does it still trigger?
  21. That event doesn't seem to be firing. Also, what if I wanted to trigger an achievement outside of an event, or with an event that doesn't include the player as a parameter? EDIT: Worked in single player, which doesn't make any sense at all. Especially because I checked the IP. Now I'm not sure what the problem is... EDIT 2: I'm thinking it checked the IP of the last server I joined.. or something. Is it possible to trigger custom achievements while logged onto a vanilla server?
  22. I followed on creating custom achievements. My achievement page is appear correctly, but my achievements are not being rewarded. Here's my first achievement: public static Achievement playCTF = new Achievement("achievement.playCTF", "playCTF", 0, 0, Items.nether_star, (Achievement)null).initIndependentStat().registerStat(); Again, it's in the achievement page and everything, so that's fine. Basically, the purpose of the achievement is to detect when I log onto a certain server. So, I use the event onJoin to detect this: @SubscribeEvent public void onJoin(EntityJoinWorldEvent event) { if (mc.func_147104_D().serverIP.endsWith("ip removed")) { EntityPlayer p = (EntityPlayer)event.entity; System.out.println("Trigger achievement!"); p.addStat(Achievements.playCTF, 1); } Now, "Trigger achievement" is getting printed out, but nothing else is happening. It is not saying my achievement is "Taken!" or anything. Any ideas?
  23. I figured it out. It's the same as 1.7.2 but I had to remove the code about ignoring invalid credentials.
  24. Ah, sorry, I wasn't clear. My mod is client-side but it's not for my server.
  25. Yes, I realize that. My mod is for a server though, so I have to log in to the server. Thank you anyway.
×
×
  • Create New...

Important Information

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