Jump to content

Thornack

Members
  • Posts

    629
  • Joined

  • Last visited

Everything posted by Thornack

  1. Im sorry Draco, I am not a JAVA Wizard. I am still learning the ins and outs of the language I dont really understand your comment. (not that good yet) but I am still learning. Could you please elaborate
  2. Hi so I am looking into the door class's func_150012_g function which I have renamed to be called rotateDoor as it seems to impart this functionality I think. I have been trying to understand how func_150012_g works and so far I seem to have found some bizarre behaviour. in particular boolean flag = (doorMetadata & != 0; I used System.out.println("doorMetadata variable equals:" + doorMetadata); right below the flag and I get a value between 1 and 8 inclusive printed to the console every tick it seems. Where this number seems to only be zero if the door isnt placed in the world. If I change the value of the 8 to something other than 8 the door halves arent aligned anymore. also at a value of 12 the door halves are once again aligned and at a value of 18 they are aligned but the top half is on the bottom and the bottom half is at the top. I am having a hard time figuring out exactly how this method works. Any helpful comments are appreciated. This is the function I am writing based off of func_150012_g to impart custom functionality to door rotation and change how doors open. But I need to understand them first public int rotateDoor(IBlockAccess blockAccess, int blockXCoord, int blockYCoord, int blockZCoord) { int doorMetadata = blockAccess.getBlockMetadata(blockXCoord, blockYCoord, blockZCoord); // for some reason the 8 has to be there otherwise the door halves arent aligned. // It isnt intuitive either at a value of 12 they are aligned again and also at a value of 18 but not as they should be int offsetDoorHalvesToAlign = 8; System.out.println("____________________________________" + doorMetadata); boolean flag = (doorMetadata & offsetDoorHalvesToAlign) != 0; int i1; int j1; if (flag) { i1 = blockAccess.getBlockMetadata(blockXCoord, blockYCoord - 1, blockZCoord); j1 = doorMetadata; } else { i1 = doorMetadata; j1 = blockAccess.getBlockMetadata(blockXCoord, blockYCoord + 1, blockZCoord); } boolean flag1 = (j1 & 1) != 0; return i1 & 7 | (flag ? 8 : 0) | (flag1 ? 16 : 0); }
  3. awesome thanks! But I am confused about one other thing in this method. there is a flag and i have no idea what this flag does boolean flag1 = world.isBlockIndirectlyGettingPowered(posX, posY, posZ) || world.isBlockIndirectlyGettingPowered(posX , posY + 1, posZ); I know that if this flag is true the method calls a function that I suspect opens the door. But I am not sure what exactly is happening here. I know that the isBlockIndirectlyGettingPowered method checks whether any adjacent block is recieving power. but I played around with this and tried boolean flag1 = world.isBlockIndirectlyGettingPowered(posX, posY, posZ) || world.isBlockIndirectlyGettingPowered(posX +3, posY , posZ); and a block 3 blocks away in the X direction and nothing happened. (I even powered all the blocks in a square and still the door didnt open so i must have my understanding of what is going on here messed up.
  4. inside the onNeighborBlockChange(World world, int posX, int posY, int posZ, Block neighbourBlock) method, inside the Block Door class there are the following if statements. I have been trying to figure out what they do by breaking the code so that I can understand the door class better and how doors work. But if i remove these methods completely I dont seem to get any noticeable change. Does anyone know what these if statements do?/why are they used if (world.getBlock(posX, posY + 1, posZ) != this) { world.setBlockToAir(posX, posY, posZ); flag = true; } if (!World.doesBlockHaveSolidTopSurface(world, posX, posY - 1, posZ)) { world.setBlockToAir(posX, posY, posZ); flag = true; if (world.getBlock(posX, posY + 1, posZ) == this) { world.setBlockToAir(posX, posY + 1, posZ); } }
  5. The method is public static void placeDoorBlock(World world, int p_150924_1_, int p_150924_2_, int p_150924_3_, int p_150924_4_, Block block) { } I am confused as to what the four int parameters are. My best guess would be posX, posY,posZ, and blockSide?
  6. What do you mean by if the entity is yours? Do you mean tamed by you or do you mean a custom entity that I have created and added as part of my mod? My ultimate goal is: I wish to use the item to "select" any entity in the world a custom entity to start but eventually try to extend the functionality to any entity found in the world and then pass on to it coordinates that the entity will use to create way-points and from those calculate a vector so that custom pathing can be achieved. I have been trying to break the problem down into smaller and smaller chunks as my thread involving custom pathing didnt generate specific enough responses.
  7. Hi, I have created an item that gets the x,y,z coordinates of whichever block that a player right clicks. These coordinates are then saved as NBT tag compounds in the following way item.stackTagCompound.setDouble("selectedBlockXCoord", x); item.stackTagCompound.setDouble("selectedBlockYCoord", y); item.stackTagCompound.setDouble("selectedBlockZCoord", z); I know that you can retrieve this data in the following way Double selectedBlockXCoord =item.stackTagCompound.getDouble("selectedBlockXCoord"); I wish to use this item to get world coordinates and then to pass these coordinates to any entity that I right click on. I am trying to figure out a way to accomplish this functionality. Does anyone have any ideas?
  8. I do it like this public class EventGetBlockThePlayerLooksAt { private Block previousBlock; @SubscribeEvent public void onPlayerTick(PlayerTickEvent event) { if (event.side == Side.CLIENT) { EntityPlayer player = event.player; World world = player.worldObj; //Gets the ray trace vector from the player using the arguments distance, partialTickTime MovingObjectPosition movingObjectPosition = player.rayTrace(5, 1.0F); //if the ray trace isnt null, and if the block isnt an air block and if the ray trace hits a block then do stuff so that you dont always get an air block if (movingObjectPosition != null && !world.isAirBlock(movingObjectPosition.blockX, movingObjectPosition.blockY, movingObjectPosition.blockZ) && movingObjectPosition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { Block selectedBlock = world.getBlock(movingObjectPosition.blockX, movingObjectPosition.blockY, movingObjectPosition.blockZ); //if the last block you looked at isnt the new block your looking at (this is done so that you dont spam the block you are looking at if (previousBlock != selectedBlock) { // gets the blocks MetaData specifically the x,y,z coordinates of the block that is ray traced against int blockMetaData = world.getBlockMetadata(movingObjectPosition.blockX, movingObjectPosition.blockY, movingObjectPosition.blockZ); //gets the item from the block Item item = Item.getItemFromBlock(selectedBlock); //gets the unlocalized name for the blocks itemstack String unlocalizedName = item.getUnlocalizedName(new ItemStack(selectedBlock, 1, blockMetaData)); // translates the unlocalized name stat to the name String selectedBlocksName = StatCollector.translateToLocal(unlocalizedName + ".name"); event.player.addChatMessage(new ChatComponentText(EnumChatFormatting.WHITE + "This is a " + selectedBlocksName)); System.out.println("You looked at a " + selectedBlocksName); previousBlock = selectedBlock; } } } } } [code]
  9. I have been looking into this topic further and also into ray tracing. is there a way to get the coordinates of a block based on a ray trace. I plan to use those coordinates inside a function to get an entity to move to whichever coordinate I specify by the ray trace. I know that the following line gets a ray trace vector //Gets the ray trace vector from the player using the arguments distance, partialTickTime MovingObjectPosition movingObjectPosition = player.rayTrace(5, 1.0F); [code]
  10. Ok So I have had a breakthrough in this topic. I tried Jabelar's suggestion and it works, this seems like a really inefficient way to implement this functionality though. Basically all that it took was adding this code to the entity file of whatever entity I wanted to extend its range. I am now looking at trying to figure out a way to calculate a movement vector for my entity based on in game coordinates that are specified by a player (ie have a player click on a block and use those coordinates to calculate a movement vector for the entity so that it moves to where the player clicked) protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(100.0D); //this distance controls how far you can make a mob move. the value can be up to 2048 but the larger the value the more paths are possible so the game will lag if the value is too large }
  11. Ok So I have been playing around with this and have written an AI that makes entities wander around in a square indefinitely. The problem is the square can only be a max of 15 x 15 (entities wont move if it is 16 x 16 in size or greater) and I would need this limitation taken off. I started out with a straight line and for that too the entities can only move up to 15 blocks in whatever direction I specified (but if I set it to 16 or higher they dont move at all and this is a problem. I was wondering if anyone has any ideas on how to remove this distance limitation. Also, the entity does not align itself with the vector perfectly which results in ridiculous looking behaviour (for bipeds as an example the legs move in the X directions but the entity moves in the Z direction or slightly off the X direction and this makes the walk look really weird. Any ideas? My eventual goal to be achieved from this playing around with AI's and entity motion: I want to figure out a way to make them move in a shape that I specify via an item that obtains the worlds coordinates at each block I click where clicking subsequent blocks would "draw the path of the entity" but for now baby steps. My EntityAICustomWander class that I have been messing around with to try and understand vectoring and entity movement
  12. Does anyone know of any methods/ what classes to look in to find some sort of way to access each individual Mob Entity's motion data and change it (force the mob to move for a longer or shorter period of time and directionally).
  13. If anyone knows how to solve this issue please help. I have tried reinstalling java jdk re-setting up the dev environment and even copied over my entire modding folder from my laptops working dev environment which included eclipse and all other files and nothing works. I still get the same
  14. I tried gradlew extractNatives eclipse and I get the folowwing errors [19:30:40] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLTweaker [19:30:40] [main/INFO] [LaunchWrapper]: Using primary tweak class name cpw.mods.fml.common.launcher.FMLTweaker [19:30:40] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLTweaker [19:30:40] [main/INFO] [FML]: Forge Mod Loader version 7.2.156.1060 for Minecraft 1.7.2 loading [19:30:40] [main/INFO] [FML]: Java is Java HotSpot 64-Bit Server VM, version 1.7.0_25, running on Windows 7:amd64:6.1, installed at C:\Program Files\Java\jre7 [19:30:40] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation [19:30:40] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker [19:30:40] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLDeobfTweaker [19:30:40] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker [19:30:40] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker [19:30:40] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper [19:30:40] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work! [19:30:41] [main/ERROR] [FML]: The minecraft jar file:/C:/Users/%7bLukasz/.gradle/caches/minecraft/net/minecraftforge/forge/1.7.2-10.12.1.1060/forgeSrc-1.7.2-10.12.1.1060.jar!/net/minecraft/client/ClientBrandRetriever.class appears to be corrupt! There has been CRITICAL TAMPERING WITH MINECRAFT, it is highly unlikely minecraft will work! STOP NOW, get a clean copy and try again! [19:30:41] [main/ERROR] [FML]: FML has been ordered to ignore the invalid or missing minecraft certificate. This is very likely to cause a problem! [19:30:41] [main/ERROR] [FML]: Technical information: ClientBrandRetriever was at jar:file:/C:/Users/%7bLukasz/.gradle/caches/minecraft/net/minecraftforge/forge/1.7.2-10.12.1.1060/forgeSrc-1.7.2-10.12.1.1060.jar!/net/minecraft/client/ClientBrandRetriever.class, there were 0 certificates for it [19:30:41] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing [19:30:41] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper [19:30:41] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLDeobfTweaker [19:30:42] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main} [19:30:42] [main/ERROR] [LaunchWrapper]: Unable to launch java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_25] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_25] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_25] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_25] 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: java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) ~[?:1.7.0_25] at java.lang.Runtime.loadLibrary0(Unknown Source) ~[?:1.7.0_25] at java.lang.System.loadLibrary(Unknown Source) ~[?:1.7.0_25] at org.lwjgl.Sys$1.run(Sys.java:73) ~[lwjgl-2.9.0.jar:?] at java.security.AccessController.doPrivileged(Native Method) ~[?:1.7.0_25] at org.lwjgl.Sys.doLoadLibrary(Sys.java:66) ~[lwjgl-2.9.0.jar:?] at org.lwjgl.Sys.loadLibrary(Sys.java:95) ~[lwjgl-2.9.0.jar:?] at org.lwjgl.Sys.<clinit>(Sys.java:112) ~[lwjgl-2.9.0.jar:?] at net.minecraft.client.Minecraft.getSystemTime(Minecraft.java:2688) ~[Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:40) ~[Main.class:?] ... 6 more
  15. This is what is displayed in the console when I try to run minecraft from eclipse. Anyone know how to fix? [23:15:35] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLTweaker [23:15:35] [main/INFO] [LaunchWrapper]: Using primary tweak class name cpw.mods.fml.common.launcher.FMLTweaker [23:15:35] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLTweaker [23:15:35] [main/INFO] [FML]: Forge Mod Loader version 7.2.156.1060 for Minecraft 1.7.2 loading [23:15:35] [main/INFO] [FML]: Java is Java HotSpot 64-Bit Server VM, version 1.7.0_25, running on Windows 7:amd64:6.1, installed at C:\Program Files\Java\jre7 [23:15:35] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation [23:15:35] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker [23:15:35] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLDeobfTweaker [23:15:35] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker [23:15:35] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker [23:15:35] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper [23:15:35] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work! [23:15:36] [main/ERROR] [FML]: The minecraft jar file:/C:/Users/%7bLukasz/.gradle/caches/minecraft/net/minecraftforge/forge/1.7.2-10.12.1.1060/forgeSrc-1.7.2-10.12.1.1060.jar!/net/minecraft/client/ClientBrandRetriever.class appears to be corrupt! There has been CRITICAL TAMPERING WITH MINECRAFT, it is highly unlikely minecraft will work! STOP NOW, get a clean copy and try again! [23:15:36] [main/ERROR] [FML]: FML has been ordered to ignore the invalid or missing minecraft certificate. This is very likely to cause a problem! [23:15:36] [main/ERROR] [FML]: Technical information: ClientBrandRetriever was at jar:file:/C:/Users/%7bLukasz/.gradle/caches/minecraft/net/minecraftforge/forge/1.7.2-10.12.1.1060/forgeSrc-1.7.2-10.12.1.1060.jar!/net/minecraft/client/ClientBrandRetriever.class, there were 0 certificates for it [23:15:36] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing [23:15:36] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper [23:15:36] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLDeobfTweaker [23:15:37] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main} [23:15:37] [main/ERROR] [LaunchWrapper]: Unable to launch java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_25] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_25] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_25] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_25] 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: java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) ~[?:1.7.0_25] at java.lang.Runtime.loadLibrary0(Unknown Source) ~[?:1.7.0_25] at java.lang.System.loadLibrary(Unknown Source) ~[?:1.7.0_25] at org.lwjgl.Sys$1.run(Sys.java:73) ~[lwjgl-2.9.0.jar:?] at java.security.AccessController.doPrivileged(Native Method) ~[?:1.7.0_25] at org.lwjgl.Sys.doLoadLibrary(Sys.java:66) ~[lwjgl-2.9.0.jar:?] at org.lwjgl.Sys.loadLibrary(Sys.java:95) ~[lwjgl-2.9.0.jar:?] at org.lwjgl.Sys.<clinit>(Sys.java:112) ~[lwjgl-2.9.0.jar:?] at net.minecraft.client.Minecraft.getSystemTime(Minecraft.java:2688) ~[Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:40) ~[Main.class:?] ... 6 more
  16. Check out my [1.7.2] Rideable Vehicle Question thread thread link The Vehicle does everything except jump (still working on that)
  17. Hi Everyone, I have a mob called "Slave". My goal is to create an item maybe called "Whip" that allows you to specify a custom path for this mob by clicking on the blocks in the world so that the player can set the specified mob entity's path (example this could be used to give a mob a rectangular path so that it walks around in a rectangle forever or any other custom shape you want (to simulate a soldiers patrol or whatever) basically just by using the item to specify the path shape you want the mob to take). I think Custom NPC mod has achieved this result successfully but I am not sure. I was wondering if anyone has any ideas as to how to achieve this result.
  18. After alot of messing around I still havent figured out why the jump code doesnt work. for some reason the jump power is always 0 and I am not sure why. Any help will be appreciated. (the code is posted above)
  19. I have been looking into it, the problem is that I cannot scale buttons or the sizes of item slots. they seem to be hard coded somehow and I havent found a way to access that
  20. Also Try Neale Gaming
  21. Does Anyone have any ideas regarding this issue?
  22. I have been looking at the jump code and so far havent gotten anywhere. Does anyone have any idea why jump wont work my code is posted above this message
  23. [some Success] I figured out how to get the bike to move, it moves up slopes too which is awesome. But I still cannot find why it wont Jump. I cleaned up the class a lot and got rid of a lot more Horse stuff (this is how I noticed where moveForeward and moveStrafing were zero and I fixed it) Currently I have a bunch of print statements and in the console it prints jumpPower: 0.0 if (this.onGround) and nothing else. So for some reason I dont think it is recognizing my user input maybe? But this is a guess I am not really sure where to go at this point. I am comparing minecrafts horse class to mine and looking at the Jump functions to see if I accidentally deleted something. If anyone has an Idea of how to get the Jump working that would be amazing. EntityBicycle class (the working movement code || but non working jump code)
  24. And to clarify, I want my GUI (which is a custom Inventory that contains some of the 18 x 18 pixel item slots) to re-size as the Minecraft Window Size changes so that it remains a constant distance from the edge of the screen and also re-sizes The item slots as well. (to prevent the GUI from bleeding outside of the playable area (so that it remains use-able for different screen resolutions) and to keep it's configuration relative to other GUI's (that I wish to introduce once this problem is solved) relatively constant. Hopefully This clears up my goal.
  25. So I Have created a GUI and I am have the following scaling issues (see The Following Images For explanation) My goal is to have the GUI scale so that its border remains a constant value from each edge of the minecraft window (lets say from the top and bottom edges the GUI will remain some number (x) pixels away, and for the left and right edges it will remain some other number (y) pixels away. So that when the minecraft window is scaled the GUI gets larger and smaller smoothly and remains in the same place relative to the screen size and keeps its aspect ratio. The problem is that The Minecraft Screen scales weirdly (as indicated in the photo examples) and I cannot seem to scale the item slots that have to be 18 x 18 virtual pixels to work it seems. But somehow as you can see in the pictures the item slots are scaled by minecraft and I am not sure how this works. Definitions: In the image screenSize equals this.width and this.height, and guiRECT is the green GUI Rectangle which is a constant size of 200 x 180 and the x and y offsets are calculated so that the GUI is always centered in the middle of the screen. Also, why does the apparent size of the green rectangle vary so oddly/largely and isnt scaled smoothly
×
×
  • Create New...

Important Information

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