@@ -115,21 +115,26 @@ public void onEntityCollision(BlockState state, World world, BlockPos pos, Entit
115115 tryCollect (world , player , be );
116116 }
117117 }
118-
118+
119119 @ Override
120120 public ItemStack getPickStack (WorldView world , BlockPos pos , BlockState state ) {
121-
121+
122122 BlockEntity entity = world .getBlockEntity (pos );
123123 if (world .isClient () && entity instanceof ShardBlockEntity shardEntity ) {
124124 Identifier shardId = shardEntity .getShardId ();
125125 ShardLibrary library = ScatteredShardsAPI .getClientLibrary ();
126+
127+ if (shardId == null || library == null ) {
128+ return super .getPickStack (world , pos , state );
129+ }
130+
126131 return createShardBlock (library , shardId , shardEntity .canInteract (), shardEntity .getGlowSize (), shardEntity .getGlowStrength ());
127132 } else {
128-
133+
129134 return super .getPickStack (world , pos , state );
130135 }
131136 }
132-
137+
133138 /**
134139 * Creates a shard block
135140 *
@@ -165,10 +170,10 @@ public static ItemStack createShardBlock(ShardLibrary library, Identifier shardI
165170
166171 return stack;*/
167172 }
168-
173+
169174 public static ItemStack createShardBlock (ShardType shardType , Identifier shardId , Shard shard , boolean canInteract , float glowSize , float glowStrength ) {
170175 ItemStack stack = new ItemStack (ScatteredShardsContent .SHARD_BLOCK );
171-
176+
172177 NbtCompound blockEntityTag = new NbtCompound ();
173178 blockEntityTag .putString ("id" , ScatteredShardsContent .SHARD_BLOCK_ID .toString ()); // required, see NbtComponent.CODEC_WITH_ID
174179 blockEntityTag .putString ("Shard" , shardId .toString ());
0 commit comments