Jump to content

NateKomodo

Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by NateKomodo

  1. Yep, im going to move over to the tick event for breaking block and control that via a boolean, seems to be the easiest and most effective solution for my particular situation.
  2. I'm assuming you mean this in a way similar to the way the java.util timer works. Unfortunately due to the way my codebase is setup, this isnt going to work efficiently. Plus, the while loop in the break block code has a tendency to kill the game if its not threaded. For the time being i will just write some code for thread cross talk to execute the player controller stuffs on the main thread, seeing as its usually idle at this point, or see if java has an async system similar to .NET
  3. As i need to pause execution of my mod until this is done while not blocking the game, i also need to be able to sleep the thread to ensure timing while not blocking the game
  4. I have the following code (Note it is being run in a separate thread, and the entire thread needs to pause until its done): public void BreakBlock(boolean enforceRotation){ Minecraft mc = Minecraft.getMinecraft(); RayTraceResult result = rayTrace(5); int rotation = (int)mc.player.rotationYaw; int pitch = (int)mc.player.rotationPitch; try { int elapsed = 0; while (mc.world.getBlockState(result.getBlockPos()).getMaterial() != Material.AIR && elapsed < 15000) { if (enforceRotation) HardSetFacing(rotation, pitch); if (mc.playerController.onPlayerDamageBlock(result.getBlockPos(), result.sideHit)) mc.player.swingArm(EnumHand.MAIN_HAND); Thread.sleep(40); elapsed += 40; } } catch (Exception ex) { Main.logger.error(ex.getMessage()); } } However, occasionally, this will lead to the following crash (Game fully crashes and returns to launcher): [21:55:28] [main/FATAL] [net.minecraft.client.Minecraft]: Unreported exception thrown! java.util.ConcurrentModificationException: null at com.google.common.collect.HashBiMap$Itr.hasNext(HashBiMap.java:401) ~[guava-21.0.jar:?] at net.minecraft.client.audio.SoundManager.func_148605_d(SoundManager.java:252) ~[chm.class:?] at net.minecraft.client.audio.SoundHandler.func_73660_a(SoundHandler.java:293) ~[cho.class:?] at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1857) ~[bib.class:?] at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1097) ~[bib.class:?] at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:397) [bib.class:?] at net.minecraft.client.main.Main.main(SourceFile:123) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_51] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_51] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_51] at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_51] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] Any thoughts on how to solve this?
  5. i have an item obtained from player.inventory.getStackInSlot(i).getItem(); I was expecting to just be able to compare it as item == Items.DIRT However, it appears items does not contain any blocks, and you cannot compare it to the Blocks enum. How would i go about seeing if the item in question was a dirt block? Edit: forgot to mention, forge for 1.12.2
×
×
  • Create New...

Important Information

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