Jump to content
Search In
  • More options...
Find results that contain...
Find results in...


  • Posts

  • Joined

  • Last visited


  • Gender
  • Personal Text
    I am new!

Recent Profile Visitors

1226 profile views

DeadPix's Achievements

Tree Puncher

Tree Puncher (2/8)



  1. Alright guys, thank you all for wonderful replies. As @jabelar asked, what I am trying to achieve - I am trying to write an 'AI' that will be walking through the lands and completing some goals (the AI takes over the player). At the very moment I am trying to come up with some reasonable path finding algo that I could further extend. I pretty much want to set target destination to which from player.posX/posY/posZ the AI will travel, and so I need to probably start with creating a structure that will represent visible surface. Is it correct? And would something like this be a good approach? Start with figuring out on what block I am currently standing. Check block bellow and the block above on whether it is an air block to determine that I am on 'some sort' of a surface. Continue with all blocks around (all eight of them) the same way as above, storing only those that have 2 (or 3 - possible to jump) air blocks above them. Extend the 'circle' and so on and so forth, up until some distance. Output of this function would then be sort of a map of my surroundings on which I could then start calculating the best path. Also when I would need some specific item or tool or ore to mine, I would take it into account in the algorithm I mentioned and store these values there too so I could feed my path finding with that.
  2. Hello again! I need to get an information about the blocks that are around the player (or a certain location) - probably for few chunks around the player. I understand that I can loop through coordinates around the player and create a BlockPos structure for each block around the player and then query them (pretty much check them in condition) on what they are, but it seems to me, that this functionality is something that should be already implemented in the game/forge itself. I looked through the documentation and there is nothing except for BlockStates, I also tried looking into the code, but am pretty much clueless at the moment. What is the best way to do the following. Get information about 'any' block? Is it to create a BlockPos object for it and then somehow convert it to Block and find info from there? And how would I convert BlockPos to Block correctly, please? Get information about chunk and its composure (e.g. what blocks are in there at specific positions, or to specified 3D-depth from some position? Are there dedicated structures that can be loaded easily, or do I have to manually specify every block I am interested in inspecting? Thank you!
  3. @jabelar, @Animefan8888 Alright, thank you guys for your input - in the end, I decided to create a weaker version of aforementioned SharedPreferences (for boolean value only) and it seems to work exactly as I wanted it to. I need it only client side - and the scenario when player edits those values, is not a problem. I do not need it to persist between game loads, so I also do not save it anywhere, but in the future I will need some persistent functionality for something else, so I am also grateful for your suggestion on reading around it, jabelar. Thanks.
  4. I am only a little bit smarter after reading it now, than I have been after reading it the last time. But also I am now certain that I need it client side only. So, what does it mean for my original question, please?
  5. I am not sure how to exactly determine that. But probably only client side? It will be mostly client relevant values like 'is this thing on or off' and similar. Is that client side only?
  6. Hello, in mod I am working on I have a need to store some values that I would need to check on in multiple places in my mod. I know that this value will be unique for every player (pretty much every instance of Minecraft running the mod will have this value different). In Android, there are SharedPreferences into which one can store such information. Is there dedicated class/space in forge that I should take advantage of? Is there a recommended approach for this? Or will it be okay just to create a public static class, let's say SharedPreferences with HashMap and getters and setters for indexes in the HashMap? Thank you in advance.
  7. Most likely to make development more user friendly. I believe the original names func_xxx are a result of decompilation, and the new names are user friendly aliases for them.
  8. coolAlias: I am sorry for my necromancy here, but I'd like to ask related question. You said: Note, the emphasizes is mine. What do you exactly mean by changing direction smoothly? Is there a way to change direction smoothly in a sense that player will get more than 20 FPS when rotating? I already tried hooking my yaw rotation changing code onto drawScreen() method and onRenderTick() methods and I never get the smooth feeling out of it. It is always capped at 20 changes per second (so... it updates every tick, which makes the transition 20 FPS, despite the rest of the world runs nicely 60fps). Any advice here?
  9. Hello, I know 1.9.4 is fairly old version, but I figured not much has changed since then regarding the tick/render mechanics, so answers for current version should apply as well. I am working on something that controls player's yaw/pitch and I bumped into following problem: * I do most work when onPlayerTick() occurs - which basically means to calculate next pitch/yaw correction, add it to Minecraft.getMinecraft().thePlayer.rotation(Yaw|Pitch) and move on to next iteration. * My computer has steady 60 FPS, there are 20 ticks per second, the pitch/yaw rotation updates do not look smooth, because I am only allowed to change it once per 3 frames rendered. * I know it is possible to make it look smooth, because it looks smooth when I control the yaw/pitch with my mouse when playing. * This video illustrates my problem. I did some Googling and found out, that I might be able to use partialTicks and subscribing to drawScreen() method, so I tried onFrame method, which does following: // Helper variables static float previousYaw = 0; static float previousPitch = 0; static float desiredNextYaw = 0; static float desiredNextPitch = 0; static float desiredYaw; static float desiredPitch; public static void onFrame(float partialTicks) { Minecraft.getMinecraft().thePlayer.rotationPitch = (desiredNextPitch - previousPitch) * partialTicks + previousPitch; Minecraft.getMinecraft().thePlayer.rotationYaw = (desiredNextYaw - previousYaw) * partialTicks + previousYaw; } Then I subscribe this to GuiScreenEvent.DrawScreenEvent event like this: @SubscribeEvent public void drawScreen(GuiScreenEvent.DrawScreenEvent event) { // Help with smoothing transitions between yaws/pitches if (this.currentTask.taskName.equals("DawdleAroundTask")) { DawdleAroundTask.onFrame(event.getRenderPartialTicks()); } } And finally, I still, every onPlayerTick occurrence, during ClientTickEvent.Phase.START, run method of the DawdleAroundTask.runTick() which looks like this (yaw/pitch corrections are unimportant and therefore I removed them to provide minimal readable sample): // Mimicking pre-tick-phase Minecraft.getMinecraft().thePlayer.rotationYaw = desiredNextYaw; Minecraft.getMinecraft().thePlayer.rotationPitch = desiredNextPitch; // /Mimicking pre-tick-phase /* HERE IS WHERE I EXPECT A MUCH MORE LOGIC TO BE DONE AND THEREFORE PRETEND PRE-TICK-PHASE AND POST-TICK-PHASE */ // Mimicking post-tick-phase desiredYaw += getRandom()[0]; desiredPitch += getRandom()[1]; // Corrections desiredNextPitch = previousPitch - pitchDistance; // Mimicking post-tick-phase When I run this now, it still looks like it is updating only every third frame/once per tick, which is not nearly enough. How do I make it look smoothly? I would like it to look as if I am controlling the mouse and the game smoothly turns player around when I move the mouse. Is it possible that I am using wrong events? I am sorry for rather a long post, but I feel like that just reading the text part describing what events and what methods I use, could tell enough to you, ultra smart people around here, on what I am doing wrong. I always come here to beg for help as a last resort and I seriously admire the level of understanding and insight into it that you guys here have. Looking forward to your replies!
  10. Thank you for replying. Now I am looking into the implementation as you suggested and can't wrap my mind around this - in EntityPlayerSP on lines 913~917 I see following code: boolean flag = this.movementInput.jump; boolean flag1 = this.movementInput.sneak; float f = 0.8F; boolean flag2 = this.movementInput.moveForward >= f; this.movementInput.updatePlayerMoveState(); When I look into MovementInput#updatePlayerMoveState(), its implementation is blank. Why? And what is the purpose of this in a bigger picture? What I am pretty much trying to do is essentially simulate player control - I want my mode to take over control and do some actions. My current idea is to implement logic that would every tick (onPlayerTick?) check the state of current task to be performed (for example "travel to coordinates", "break a block" and similar). I will have probably a lot of smaller classes representing tasks to be executed and will be executing them in order to accomplish bigger tasks: e.g. "get to x,y,z" will be composed of "travel to x+1, z+1, adjust y if needed" where "adjust y if needed" would be composed of some logic that would determine when to jump/place a block, how many blocks to place. For this, will I need to know stuff like "how long in ticks does it take for this particular block to break"? And what do you think of my current approach? Do you see possible weak spots in doing this the way I am currently planning to do it? Also, would you recommend to me to use something else than setting up MovementInput value properly and putting it to getMinecraft().thePlayer.movementInput? Thanks in advance for any help provided!
  11. I am looking for something like documentation to mechanics of the game and the values of different attributes (right now, for example I would like to know what number should I put in MovementInput.moveForward and MovementInput.moveStrafe to make it the same values as is normal for walking & sprinting in Minecraft. But in the future I am sure I will have to handle more stuff like this and I will have to look up other values for other attributes. Where can I find those things? I checked for example this: http://minecraft.gamepedia.com/Sprinting, but it has certainly different values than those I should put in the mentioned class.
  12. Technically, yes he does have mental ownership of the name - he created the name earlier than you and it does not matter that he is doing nothing with it. TheBest (haha) you can do is do the following: Find out who's the author, ask him to hand over the name (with reasonable points), Go with what others usually go with - name your mod: 'thebest108's inventors toolbox'. If your mode becomes successful, they will start to omit your name in it, and your mod will be highest in a Google search for inventors toolbox search so you won't be penalized for slightly different mod name.
  13. This may actually be a buggy behavior. I have rewritten this to 1.9.4: @SubscribeEvent public void clickOnLadder(PlayerInteractEvent event) { if (event.getPos() != null) { System.out.println(event.getPos().getX() + " " + event.getPos().getY() + " " +event.getPos().getZ()); System.out.println(event.getWorld().getBlockState(event.getPos()).getBlock().getLocalizedName()); } } And it produces following output: Empty handed: Ladder in hand: It all looks the same to me. I also tried right clicking the block with other placeable items and it produced the same output. Strange thing though is that the code snipped is apparently called multiple times.
  14. Unfortunatelly I can not provide you with tutorial, but I figured out that Immersive Engineering mod is open source so I suggest you to take a look to their code and maybe you will find something useful to your goals. :-)
  15. Ernio: Thank you for your input, I will have a look into materials you provided. Just one more question to clarify exactly what you meant: 'While code itself if not bad in mean of ticks/timing, it is bad regarding design.' Is there a typo in 'itself if not bad' or not? Like if you meant to say 'is not bad' implying that it is correct to subscribe to PlayerTickEvent, or you meant to say that I am questionably wrong with subscribing to that event? Thanks in Advance. :-)
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.