Jump to content

Ruukas

Members
  • Posts

    12
  • Joined

  • Last visited

Everything posted by Ruukas

  1. Items (or rather, ItemStacks) usually does not have an nbt tag, when first created.
  2. Remove "int cooldown" and instead use a getCooldown() and setCooldown(), which reads or updates the NBT.
  3. Haha, you are right. At first I got it to 2gb too, but then somehow I managed to get it to 2tb, after calculating a couple of times. I guess I kind of forced it.
  4. I'll try to break this down for you: First off, this shouldn't be handled on the client, so: if(dog.world.isRemote) return; Secondly there are the conditions for the dog to have this ability, you can add them to the same if statement: Since we reverse the conditions, we use "OR" instead of "AND", and we reverse each statement. if(dog.world.isRemote || masterOrder != 4 || dog.getHealth() <= Constants.lowHealthLevel || dog.isChild() || level < 1) return; Now, it's time to check the cooldown. First we check if the cooldown is more than 0, meaning it's still on cooldown. If it is we will return. We then reduce it by one, so that it will eventually be 0. if(cooldown > 0){ cooldown--; return; } cooldown = level == 5 ? 5 : 20; //5 will happen 4 times in a second and 20 will happen once in a second - are these really the values, you want? Then there's the damage, remember there was no reason to do this stuff, before you had even checked the cooldown: byte damage = (byte) (level == 5 ? 10 : level); //Or if 5 isn't the max level, maybe this is what you want: byte damage = (byte) (level > 4 ? level+5 : level); I don't know, if you know that operator (a ? b : c), but basically, it's like this: byte damage; if(level == 5) byte = (byte) 10; else byte = level; Now, it's time to do the action: for(EntityMob mob : list) {//There's no reason to check if the list is empty, the for loop won't be entered, if there are no elements in it //I believe all of these will run on the client as well, if called on the server dog.playSound(SoundEvents.ENTITY_WOLF_GROWL, 1f, 1f); mob.spawnExplosionParticle(); mob.attackEntityFrom(DamageSource.GENERIC, damage); } Then, that should work. I won't be posting the full code, as I want you to read all of it, and put it together yourself. It also might have some typos. One thing I am concerned about, though is the cooldown simply being a variable. I would probably store it in NBT or dataManager. You should also initialize the value.
  5. He means this : "Could not reserve enough space for 2097152KB", which is roughly 2tb. Are you sure you are using the correct launch arguments? Check the contents of your "run.bat" or whatever you use. Try this instead: -Xms256m -Xmx2048m
  6. When we made "Monsters and Dungeons", we used tileentities, which would spawn the entity and disappear, when a player came close enough.
  7. What if you replicate /time set and /gamerule doDayLightCycle to keep the sun in place, or skip some time? Not sure if that has the same implications as directly changing ticks.
  8. I remember seeing timelapse (speeding up time) mods. I'm not sure exactly how they worked, but I don't think they used WorldProvider
  9. But isn't time tied to game ticks?
  10. It's possible that you could bypass the WorldProvider, when rendering the sky, but I doubt that would be a good solution Edit: I almost forgot that the sky if far from the only difference between night and day
  11. As you say, you need a WorldProvider (although, "need" is rarely the correct word to use about coding)
  12. I'm sorry to revive this thread, but this is something I am kind of knowledgeable about, having made two mods that deals with clientside item editing. For one of them, I pretty much rewrote the creative gui (altering it to my needs). Now, I've moved on from using that, but I still use the CPacketCreativeInventoryAction packet. Here's how: int slot = mc.player.inventory.currentItem; mc.playerController.sendSlotPacket(stack, 36 + slot); To understand the index, you need to look at ContainerPlayer: The first 5 slots are for crafting The next 4 is for armor and offhand That means the actual inventory starts a 9. The actionbar starts at 27+9=36, which is what I use to override my current item. Beware that some servers alter the packet processing to require certain permissions for certain item, which the vanilla servers doesn't do. Feel free to contact me on discord Ruukas#9050, if you have any other questions related to this kind of stuff. If you use custom packets, that defeats the purpose of having a clientside mod, doesn't it?
×
×
  • Create New...

Important Information

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