Posted November 17, 20168 yr I'm trying to create an item where if the player holds right-click on a specific block for a certain amount of time, the block spawns an item. After some searching, I figured I could use onUsingTick to achieve this. However, onUsingTick never gets called. I have a PlayerInteractEvent set up that does get called every time I right click. Is it perhaps interrupting or preventing onUsingTick? Or am I doing something else wrong? @Override public void onUsingTick(ItemStack stack, EntityPlayer player, int tick) { System.out.println("onUsingTick started!"); MovingObjectPosition mop = this.getMovingObjectPositionFromPlayer(player.worldObj, player, true); if (mop != null && mop.typeOfHit == MovingObjectType.BLOCK) { World world = player.worldObj; BlockPos pos = mop.getBlockPos(); if (world.getBlockState(pos) != null) { if (!world.isRemote && tick ==1) { System.out.println("onUsingTick successful!"); } } } } @Override public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) { System.out.println("onItemRightClick started!"); player.setItemInUse(itemStack, this.getMaxItemUseDuration(itemStack)); return itemStack; } @Override public int getMaxItemUseDuration(ItemStack itemStack) { return 20; }
November 17, 20168 yr In 1.10.2, Item#onUsingTick takes an EntityLivingBase instead of an EntityPlayer . Also, update to 1.10.2. There's already a beta for 1.11, which will soon be the standard meaning we won't support <1.8.9 anymore. Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
November 17, 20168 yr Author Will do. I still have this problem either way, so additional comments are welcome.
November 17, 20168 yr Author Can't get gradle setupdecompworkspace to work. It keeps failing on recompileMc. This crap is why I hadn't tried updating yet. I have precious little free time for this little modding hobby as it is.
November 17, 20168 yr If recompileMC is failing with "GC overhead limit exceeded", you need to give Gradle more memory. Forge's documentation explains this here. If it's failing with a different error, post the full output from Gradle. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
November 17, 20168 yr gradlew -Dorg.gradle.jvmargs=-Xmx2048m setupDecompWorkspace gives 2GB to gradle Disclaimer: I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.
November 17, 20168 yr gradlew -Dorg.gradle.jvmargs=-Xmx2048m setupDecompWorkspace gives 2GB to gradle Unsurprisingly, -Xmx2G does too. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
November 17, 20168 yr Author I got it to work after a couple hours. It wasn't "GC overhead limit exceeded." I finally fixed it by replacing my entire gradle properties file with a fresh copy from a new download of Forge. So now begins the laborious process of updating all my code. In the meantime, I still need an answer to the original question. I can't figure out why onUsingTick is never called.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.