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.

Nintolak

Members
  • Joined

  • Last visited

Everything posted by Nintolak

  1. My problem has been fixed. As far as I can tell the playerLocation field in the EntityPlayer class is never used at all in Minecraft. I got a BlockPos from the player by using the getPosition() method in the Entity class, and now the code runs like a charm.
  2. Wait playerIn is my character because my testing was based off of changing playerIn.experienceLevel, which I was able to do successfully. So my character just has a null playerLocation... for some reason.
  3. playerIn.playerLocation is null... I was under the impression that playerIn was the player that clicked the block. Anyone willing to provide clarification here?
  4. Upon further testing I've discovered that the issue is with the getX() and not the playerLocation. This makes no sense because playerLocation is an instance of BlockPos which extends Vec3i which has a getX() method. So if I am able to get the playerLocation I should be able to get the X coordinate of that location. Any ideas friends?
  5. I'm making a drone mod and I'm trying to make a console block that, when right clicked, searches for a nearby drone block. Whenever I right click the console block in game, the internal server crashes because of a null pointer exception at the first integer assignment ( int rX = playerIn.playerLocation.getX(); ). My code is as follows: [embed=425,349] @Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) { BlockPos checkPos; int rX = playerIn.playerLocation.getX(); int rY = playerIn.playerLocation.getY(); int rZ = playerIn.playerLocation.getZ(); for (int oX = -5; oX <= 5; oX++) { for(int oY = -5; oY <= 5; oY++) { for (int oZ = -5; oZ <= 5; oZ++) { checkPos = new BlockPos(rX + oX,rY + oY,rZ + oZ); if (worldIn.getBlockState(checkPos).getBlock().getMaterial()== DroneMaterials.drone) { playerIn.experienceLevel = 60; return true; } } } } return false; }[/embed] Stacktrace: at nintolak.blocks.BlockConsole.func_180639_a(BlockConsole.java:37) at net.minecraft.client.multiplayer.PlayerControllerMP.func_178890_a(PlayerControllerMP.java:381) at net.minecraft.client.Minecraft.func_147121_ag(Minecraft.java:1483) I have no idea why this is not working. Any help would be greatly appreciated.

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.