Jump to content

Koi

Members
  • Posts

    5
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Koi's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Hello, fellow modders. I have a mob that spawns custom entities and saves references to those entities so that it can control them. The problem is that the references are not persistent when you leave the world. So when you rejoin the world, the mob can no longer control the entities it spawned. So how can I save persistent references to entities? I have tried so much but nothing seems to work. If you need more details in order to help I'd be happy to share any code.
  2. Hi there! I am making a mob that summons an entity on spawn. I rotate this entity around the mob every tick. To do this, I wrote this function that is called from aiStep(). Entity shield_0; // this is summoned onSpawn private void rotateShields() // this is called every tick from aiStep { rotation_0 = rotate(rotation_0, 5f); rotation_1 = rotation_0 + 90.0f; if (this.shield_0 != null) { double shieldX = this.getX() + Math.cos(Math.toRadians(rotation_0)) * 2; double shieldZ = this.getZ() + Math.sin(Math.toRadians(rotation_0)) * 2; this.shield_0.setPos(shieldX, this.getY() + 2, shieldZ); this.shield_0.setYRot((rotation_0 - 90.0f)); } } private float rotation_0; float rotate(float rot, float timePerLoop) { timePerLoop = 360.0f / (20 * timePerLoop); if (rot < 360) rot += timePerLoop; else { rot = 0; } return rot; } For some reason, the rotation of the entity works just fine while the y-pos of the entity slowly falls down until it hits the ground and jumps back up to where it is supposed to go. I even did a "System.out.println(this.shield_0.getY());" and that prints out the correct y-value at a stable rate while the actual entity position in-game is wonky. This strange behavior is leading me to believe that there is some weird syncing issue, but I have no idea how to solve it or why it's happening.
  3. Hi! im making a mod with a special type of enchantments that you get from something thats not an enchanting table, and I want to give these special enchantments a red glow. Is that possible?
  4. I am pretty new to modding MC and I have been trying to make a cooldown for my Staff that I have making for a long time and I just cant seem to get it right! This is what my code looks like right now. Thanks a lot if you help and could you tell me if I was close or on the right track? :) public int coolDown = 0; public boolean canUse; @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { ItemStack itemstack = playerIn.getHeldItem(handIn); if(canUse == true) Actions.chatAtPlayer(playerIn, "hi"); if(coolDown <= 0) { coolDown = 100; } if(coolDown > 0) Actions.chatAtPlayer(playerIn, "" + coolDown); return super.onItemRightClick(worldIn, playerIn, handIn); } @Override public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) { if(coolDown > 0) coolDown--; canUse = false; if(coolDown == 0) canUse = true; super.onUpdate(stack, worldIn, entityIn, itemSlot, isSelected); }
×
×
  • Create New...

Important Information

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