July 8, 20178 yr 59 minutes ago, TheRPGAdventurer said: how abut this one? private boolean getSheared() { return true; } public boolean setSheared(boolean sheared) { return sheared; } This does nothing useful. You're saying "this dragon is now sheared" and the function goes "Ok!" and the state of the dragon (whether or not it has been sheared) doesn't change. There's a reason it's called a setter. It sets a field. 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.
July 8, 20178 yr Author Just now, Draco18s said: This does nothing useful. You're saying "this dragon is now sheared" and the function goes "Ok!" and the state of the dragon (whether or not it has been sheared) doesn't change. There's a reason it's called a setter. It sets a field. @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos) { return (item != null && item.getItem() == ModTools.DiamondShears && !this.isChild()); } @Override public java.util.List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) { java.util.List<ItemStack> ret = new java.util.ArrayList<ItemStack>(); ret.add(new ItemStack(this.getShearDropItem())); this.playSound(SoundEvents.ENTITY_SHEEP_SHEAR, 1.0F, 1.0F); return ret; } } It works now but how do I make it like, shear once wait another time to shear agan not comtinously keep shearing it and shearing items.
July 8, 20178 yr 50 minutes ago, TheRPGAdventurer said: It works now but how do I make it like, shear once wait another time to shear agan not comtinously keep shearing it and shearing items. I am literally telling you how to make it so in this entire thread but you are doing something else and asking why is it not working. 1. Create a field/DataManager param that stores the amount of ticks left before the mob can be sheared. 2. Check if this value lequals 0 in your isShearable method 3. Set it to the desired cooldown in onSheared method 4. Decrement it each tick. And you are done.
February 26, 20187 yr Author On 7/8/2017 at 9:32 PM, diesieben07 said: A better solution would be to store the world time when the entity is sheared and then check how long has passed by calculating the difference to the current time. Sorry for necroing but the time I posted this I didn't really understand java and modding itself and didn't obey the advice to learn java before modding minecraft, I improved now. So can I ask the question, if world.getWorldTime to get the World time how do I get the current time.
February 26, 20187 yr Author 54 minutes ago, diesieben07 said: I really don't understand that sentence, sorry. World::getTotalWorldTime will always give you the current world age in ticks. getWorldTime will reset when people sleep or use /time. getTotalWorldTime will not, it always ticks up. damn one of those misleading names again, these arent that misleading tho.
February 28, 20187 yr Author On 2/26/2018 at 5:48 PM, diesieben07 said: I really don't understand that sentence, sorry. World::getTotalWorldTime will always give you the current world age in ticks. getWorldTime will reset when people sleep or use /time. getTotalWorldTime will not, it always ticks up. can you give me some examples tho?
February 28, 20187 yr Author Just now, diesieben07 said: What for? the get world time, the one that you need to wait to do something via using getWorldTime etc.
February 28, 20187 yr Author Just now, diesieben07 said: I really don't know what you need an example for. It's a simple method, you call it to get the current age (in ticks) of the world. It's really my first time to encounter the WorldTime. But guess Ill try.
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.