Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Wulfre

Members
  • Joined

  • Last visited

Everything posted by Wulfre

  1. I was using some of the variables for tick calculations in some other class and never set them back. Thank you for reminding me. Would you mind explaining to me how to make things run server side? I took some recommendations from a friend while writing this -- mostly on checking if the world is remote, which is what I am assuming is the issue. EDIT: I changed world.isRemote to !world.isRemote and everything works as intended now.
  2. I realized that after following the usages in the potion class. Thank you.
  3. I tried looking for that, but I could not find the class for it in the vanilla library.
  4. I am trying to levitate entities that are within a radius from the player when a related item is right clicked with (not yet implemented -- currently tries to levitate as soon as a mob is within the radius). The idea is to gradually move them into a position that is two blocks above the player, but no mobs seem to be reacting to EntityMob#motionY. If I use EntityMob#setPositionAndUpdate they will jerk between their original location and the new location every time the AI tries to preform a task. Another implementation I am planning is to have any mobs that are being levitated to move synchronously with the player, if anyone has insight on that. Not necessarily the actual code, but a rough idea on how to accomplish it. public class ItemFissuredLimiter extends Item { public ItemFissuredLimiter() { setMaxStackSize(1); setCreativeTab(KinesisReference.KINESIS_TAB); } public static int grabRadius = 5; // Blocks. public static int grabLimit = 5; // Mobs. public static int grabDuration = 10; // Seconds. @Override public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) { return super.onItemRightClick(itemStackIn, worldIn, playerIn, hand); } @Override public void onUpdate(ItemStack itemStackIn, World worldIn, Entity entity, int someInt, boolean someBoolean) { EntityPlayer playerIn = (EntityPlayer) entity; if(worldIn.isRemote && playerIn.getHeldItemMainhand() == itemStackIn) { // Create bounds around the player, based on the grab radius of the limiter, to check for entities in. double playerX = playerIn.getPosition().getX(); double playerY = playerIn.getPosition().getY(); double playerZ = playerIn.getPosition().getZ(); int radiusHeightDifference = grabRadius - KinesisReference.PLAYER_HEIGHT; BlockPos posMin = new BlockPos(playerX - grabRadius, playerY - grabRadius, playerZ - grabRadius); BlockPos posMax = new BlockPos(playerX + grabRadius, playerY + radiusHeightDifference, playerZ + grabRadius); AxisAlignedBB radiusBox = new AxisAlignedBB(posMin, posMax); // Check for entities that are both in the grab radius and are mobs. List<EntityMob> mobsInRadius = worldIn.getEntitiesWithinAABB(EntityMob.class, radiusBox); // Levitate entities that are within the required radius while restrictions are not yet met. for(EntityMob mob : mobsInRadius) { // Don't levitate boss mobs, that is silly. if(mob.isNonBoss()) { double mobX = mob.getPosition().getX(); double mobY = mob.getPosition().getY(); double mobZ = mob.getPosition().getZ(); System.out.println(mob); System.out.println(mob.motionY); mob.fallDistance = 0; if(mobY < playerY + 2) { mob.motionY = 0.2; } if(mobY > playerY + 2) { mob.motionY = -0.2; } } } } } }

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.