question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Block placer causes NullPointerException for blocks using the placer entity

See original GitHub issue

Minecraft version & Mod Version: Minecraft 1.12.2 Cyclic 1.15.12

Single player or Server: Server

Describe problem (what you were doing / what happened): A player on the server decided to put a market from Farming for Blockheads into a block placer, which relies on the placer entity to determine its direction. Because the block placer passes null, it causes a NullPointerException which crashes the server. When the server crashes, the block placer doesn’t remove the item from its inventory, so the server gets stuck crashing on startup.

Crash log (if any): crash-2018-06-27_10.19.25-server.txt

Time: 6/27/18 10:19 AM
Description: Ticking block entity

java.lang.NullPointerException: Ticking block entity
	at net.blay09.mods.farmingforblockheads.block.BlockMarket.func_180642_a(BlockMarket.java:83)
	at net.minecraft.block.Block.getStateForPlacement(Block.java:2238)
	at com.lothrazar.cyclicmagic.core.util.UtilPlaceBlocks.placeItemblock(UtilPlaceBlocks.java:95)
	at com.lothrazar.cyclicmagic.block.placer.TileEntityPlacer.func_73660_a(TileEntityPlacer.java:144)
	at net.minecraft.world.World.func_72939_s(World.java:1832)
	at net.minecraft.world.WorldServer.func_72939_s(WorldServer.java:613)
	at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:767)
	at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:396)
	at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:668)
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526)
	at java.lang.Thread.run(Thread.java:748)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
BlayTheNinthcommented, Aug 9, 2018

Vanilla code is considered NonNull by default, with exceptions marked as @Nullable (though not in all cases, since they’ve only recently started doing that).

However, the fact that the Anvil also does not check for null is a clear indicator that this parameter is indeed NonNull and mods should not need to worry about null-checking the parameter.

From BlockAnvil, first line:

public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
        EnumFacing enumfacing = placer.getHorizontalFacing().rotateY();

For the fake player, check out FakePlayer or FakePlayerFactory classes, which are provided by Forge.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Industrial Foregoing Block Placer not placing blocks - Reddit
I play on my server with friend and block placer not working, i set spawn protection to 0 but nothing, any advices?
Read more >
[SOLVED]Null Pointer Exception when registering tile entity ...
Hello, I am following along with McJty's 1.12 modding tutorials and am at the point where I am creating a Tile Entity. I...
Read more >
Entity move to block position[1.7.10] - Minecraft Mods
I'm trying to make a custom AI where my custom mob moves to my custom block. I always get this crash report whenever...
Read more >
How To Fix The Ticking Entity Crash in Minecraft - YouTube
Learn How To Fix The Ticking Entity Crash in Minecraft with Apex Hosting. Apex Minecraft Hosting: https://apexminecrafthosting.com/24/7 ...
Read more >
Crashing when placing BC Quarry - ComputerCraft
I have tried placing the quarry my self with no problems at all. ... the block placers does... it must be how they...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found