Jump to content

Tinker

Members
  • Posts

    26
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

Tinker's Achievements

Tree Puncher

Tree Puncher (2/8)

-1

Reputation

  1. Hey again everyone, sorry it's been so long. Life got in the way of modding a bit. But here we go again, new problems. I'm now able to determine if the player has the correct rotation to be viewing the sun, which is great. Issue is, now I need to make sure they can actually see the sun. I'm trying to accomplish this through raytracing. I found this really useful piece of code on Jabelar's blog. MovingObjectPosition mop = Minecraft.getMinecraft().renderViewEntity.rayTrace(200, 1.0F); if(mop != null) { Block blockLookingAt = worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ) ; } Checking if the player is rotated towards the sun and that blockLookingAt is air is almost there. The only issue is transparent blocks: I want the player to be able to see the sun through glass, leaves, etc. So my question now, is there a way I can raytrace while ignoring certain blocks? Ex: if the trace encounters glass, pretend it didn't and keep on going? Thanks!
  2. Ill just send you a bit of code that I use whenever I get home. I know this is an older thread, but mind sharing that code with everyone if you can? I'm trying to solve this same problem.
  3. Thanks for the tip! I'm gonna give this a shot tonight and get back to you guys.
  4. Hello everyone, I'm about to undertake trying to detect whether or not the player is looking at the sun, within a certain degree of error. I want to spitball my ideas with all of you before I attempt to implement this, in case there's a much better way to do this or someone has already implemented it. My idea: using player.rotationPitch and rotationYaw, I can relatively easily correlate their look direction with the current time of day, obtained by player.worldObj.getWorldTime() % 24000. Experimentation will let me figure out what angles fit nicely with what times. I'm sure I could find something precise by looking at the render code for the actual sun's movement, but I honestly think it would take me longer to figure that one out than whip up some tables. I'm still not entirely sure if this is altitude-dependent or not. Next, I haven't really looked into it too much yet, but I think there's decent support for ray-tracing/getting the block the player is looking at. Basically, I need to make sure that the sun isn't obscured by a non-transparent block. Is this efficient/possible? This is the part I don't know how to do yet. Some obvious problems: if the player is underground in an enormous cave, the sun will still show up. Hence, it will probably be considered visible to them. But this is such an edge-case that I think I'd be fine just dealing with it. Has anyone else tried this? Does anyone have suggestions? Thanks!
  5. Hello Forge, I've made appeals for help on other modding threads related specifically to this API and Smart Moving, but since I've gotten such excellent support here in the past, it's worth a shot asking for help here too. The issue: I've created custom 3D armor models. When worn, they project their models appropriately and rotate as planned with the character. However, when running alongside Smart Moving, the items from my mod do not rotate or move with the new player model. They are stuck constantly facing north. The solution to this is reworking my mod to use the Render Player API, detailed in the thread here: http://www.minecraftforum.net/topic/1261354-172api-render-player-api/. However, there is no tutorial provided and the write-up is such that I can't really begin to make sense of this on my own... Is there anyone here who has worked with or is familiar with this API that could give me a brief tutorial or some guidance on how to adapt my mod for use with it? All of my source code for the plugin is here: https://github.com/TimTinkers/FractumArmor, if that would help anyone describe to me anything. Thanks!
  6. Ah, thank you. That makes things a lot clearer. I really appreciate you swooping to my rescue. Mod working, playing nicely with others, and ready to go again. Solved.
  7. Oh! I didn't even think to test it. The whole, "That would work the same." thing made me think it was just bad coding practice on my part. I'll give that a shot in the morning and come back with the results. Thanks a ton. Any reason why that one would work, while using .equals() wouldn't though? I'm just not understanding it from a Java perspective.
  8. @ForgeSubscribe public void onRenderingCoordinates(RenderGameOverlayEvent.Pre event) { if (event.type.equals(RenderGameOverlayEvent.ElementType.TEXT)) { event.setCanceled(true); } } This code has to be the problem. It's definitely not a fine enough comb to capture only the F3 menu rendering. Is there any way I can check to see which class triggered this event, and only act if it was GuiInGame? Deperate for help here. Thanks.
  9. Is there perhaps any way to disallow the user to rebind keys? If I can override what happens when F3 is pressed, without allowing my key to appear on the "Controls" tab, I can continue implementing this.
  10. Sadly I am not using the newest version of BattleGear, I'm developing for a 1.6.4 MCPC+ server. This is my event, in all its glorious simplicity: @ForgeSubscribe public void onRenderingCoordinates(RenderGameOverlayEvent.Pre event) { if (event.type.equals(RenderGameOverlayEvent.ElementType.TEXT)) { event.setCanceled(true); } } Is there anything I can do, working within the constraints of my version right now, to fix this? Thanks.
  11. I'm reopening my plea for help here...my mod is screwing with BattleGear 2 in how they both attempt to modify the GUI. This error is thrown whenever BattleGear 2 tries rendering its own GUI. As far as I can tell, there shouldn't be any conflict since I'm only canceling the TEXT pre event. But here's the error. java.lang.NullPointerException at us.teamtinker.hide.HideEventHandler.onRenderingCoordinates(HideEventHandler.java:10) at net.minecraftforge.event.ASMEventHandler_14_HideEventHandler_onRenderingCoordinates_Pre.invoke(.dynamic) at net.minecraftforge.event.ASMEventHandler.invoke(ASMEventHandler.java:39) at net.minecraftforge.event.EventBus.post(EventBus.java:108) at mods.battlegear2.client.gui.BattlegearInGameGUI.renderGameOverlay(BattlegearInGameGUI.java:123) at mods.battlegear2.client.BattlegearClientEvents.postRenderOverlay(BattlegearClientEvents.java:55) at net.minecraftforge.event.ASMEventHandler_51_BattlegearClientEvents_postRenderOverlay_Post.invoke(.dynamic) at net.minecraftforge.event.ASMEventHandler.invoke(ASMEventHandler.java:39) at net.minecraftforge.event.EventBus.post(EventBus.java:108) at net.minecraftforge.client.GuiIngameForge.post(GuiIngameForge.java:874) at net.minecraftforge.client.GuiIngameForge.renderHotbar(GuiIngameForge.java:212) at net.minecraftforge.client.GuiIngameForge.func_73830_a(GuiIngameForge.java:141) at net.minecraft.client.renderer.EntityRenderer.func_78480_b(EntityRenderer.java:1014) at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:946) at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:838) at net.minecraft.client.main.Main.main(SourceFile:101) 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:131) at net.minecraft.launchwrapper.Launch.main(Launch.java:27) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at us.teamtinker.hide.HideEventHandler.onRenderingCoordinates(HideEventHandler.java:10) at net.minecraftforge.event.ASMEventHandler_14_HideEventHandler_onRenderingCoordinates_Pre.invoke(.dynamic) at net.minecraftforge.event.ASMEventHandler.invoke(ASMEventHandler.java:39) at net.minecraftforge.event.EventBus.post(EventBus.java:108) at mods.battlegear2.client.gui.BattlegearInGameGUI.renderGameOverlay(BattlegearInGameGUI.java:123) at mods.battlegear2.client.BattlegearClientEvents.postRenderOverlay(BattlegearClientEvents.java:55) at net.minecraftforge.event.ASMEventHandler_51_BattlegearClientEvents_postRenderOverlay_Post.invoke(.dynamic) at net.minecraftforge.event.ASMEventHandler.invoke(ASMEventHandler.java:39) at net.minecraftforge.event.EventBus.post(EventBus.java:108) at net.minecraftforge.client.GuiIngameForge.post(GuiIngameForge.java:874) at net.minecraftforge.client.GuiIngameForge.renderHotbar(GuiIngameForge.java:212) at net.minecraftforge.client.GuiIngameForge.func_73830_a(GuiIngameForge.java:141) Can anyone offer a bit of input? Thanks.
  12. Ah well, such is the price they pay for excellent survival servers. Thanks for all your help guys, couldn't have done it without you all.
  13. Ah, thank you all so much. Canceling the RenderGameOverlayEvent.Pre worked so much better. The plugin appears to be working as planned right now...and chat/signs/hotbar are all still functioning as expected. Just off the top of your collective heads, do any of you know of any definite drawbacks canceling all TEXT RenderGameOverlayEvents might cause, which I should be aware of? Thanks for all the help.
  14. Okay, I see that now. Thanks. Still having problems here though. package us.teamtinker.hide; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.event.ForgeSubscribe; public class HideEventHandler { @ForgeSubscribe public void onRenderingCoordinates(RenderGameOverlayEvent event) { if (event.type.equals(RenderGameOverlayEvent.ElementType.TEXT)) { event.setCanceled(true); } } } I have this event which hopefully cancels the rendering of the debug menu. None of the other sub-events I looked at seemed to apply to it. However, as soon as I attempt to load the world with this code in place, I get the following crash: java.lang.IllegalArgumentException: Attempted to cancel a uncancelable event 2014-03-19 11:32:58 [iNFO] [sTDOUT] at net.minecraftforge.event.Event.setCanceled(Event.java:104) 2014-03-19 11:32:58 [iNFO] [sTDOUT] at us.teamtinker.hide.HideEventHandler.onRenderingCoordinates(HideEventHandler.java:11) 2014-03-19 11:32:58 [iNFO] [sTDOUT] at net.minecraftforge.event.ASMEventHandler_5_HideEventHandler_onRenderingCoordinates_RenderGameOverlayEvent.invoke(.dynamic) 2014-03-19 11:32:58 [iNFO] [sTDOUT] at net.minecraftforge.event.ASMEventHandler.invoke(ASMEventHandler.java:39) 2014-03-19 11:32:58 [iNFO] [sTDOUT] at net.minecraftforge.event.EventBus.post(EventBus.java:108) 2014-03-19 11:32:58 [iNFO] [sTDOUT] at net.minecraftforge.client.GuiIngameForge.post(GuiIngameForge.java:874) 2014-03-19 11:32:58 [iNFO] [sTDOUT] at net.minecraftforge.client.GuiIngameForge.renderHUDText(GuiIngameForge.java:696) 2014-03-19 11:32:58 [iNFO] [sTDOUT] at net.minecraftforge.client.GuiIngameForge.renderGameOverlay(GuiIngameForge.java:155) 2014-03-19 11:32:58 [iNFO] [sTDOUT] at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1014) 2014-03-19 11:32:58 [iNFO] [sTDOUT] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:946) 2014-03-19 11:32:58 [iNFO] [sTDOUT] at net.minecraft.client.Minecraft.run(Minecraft.java:838) 2014-03-19 11:32:58 [iNFO] [sTDOUT] at net.minecraft.client.main.Main.main(Main.java:93) 2014-03-19 11:32:58 [iNFO] [sTDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 2014-03-19 11:32:58 [iNFO] [sTDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 2014-03-19 11:32:58 [iNFO] [sTDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 2014-03-19 11:32:58 [iNFO] [sTDOUT] at java.lang.reflect.Method.invoke(Unknown Source) 2014-03-19 11:32:58 [iNFO] [sTDOUT] at net.minecraft.launchwrapper.Launch.launch(Launch.java:131) 2014-03-19 11:32:58 [iNFO] [sTDOUT] at net.minecraft.launchwrapper.Launch.main(Launch.java:27) So it looks like the TEXT sub-event is uncancelable. Is there anything I can do here?
  15. Thank you for your help so far, I'm definitely making progress. I've managed to properly setup the RenderGameOverlayEvent, and to cancel it. However, this stops the rendering of all GUIs on the screen--no pause menus, no hotbar, no inventory, nada. This is too indiscriminate for my purposes, although it does stop the use of F3. Is there any data I can pull from the event object which would allow me to cancel only the debug menu which appears when F3 is pressed? Or maybe a way in which I can cancel/uncancel the event when F3 is toggled?
×
×
  • Create New...

Important Information

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