@@ -39,8 +39,9 @@ public void onCreateSpawnPosition(LevelEvent.CreateSpawnPosition event) {
3939 Level level = (Level ) event .getLevel ();
4040
4141 // 服务端 主世界 0 -64 0 基岩?
42- if (level .isClientSide () || level .dimension () != Level .OVERWORLD
43- || !level .isEmptyBlock (new BlockPos (0 , -64 , 0 ))) {
42+ if (level .isClientSide () // 客户端则返回
43+ || level .dimension () != Level .OVERWORLD // 非主世界则返回
44+ || level .getBlockState (new BlockPos (0 , 64 , 0 )).is (Blocks .CRYING_OBSIDIAN )) { // 已有哭泣黑曜石则返回
4445 return ;
4546 }
4647
@@ -148,26 +149,4 @@ public void onPlayerLoggedIn(PlayerEvent.PlayerLoggedInEvent event) {
148149
149150 LOGGER .info ("Initialize player attributes complete" );
150151 }
151-
152- @ SubscribeEvent
153- public void onChangePlayerGameMode (PlayerEvent .PlayerChangeGameModeEvent event ) {
154- Player player = event .getEntity ();
155- AttributeMap attributes = player .getAttributes ();
156- GameType newGameMode = event .getNewGameMode ();
157-
158- Identifier id = Identifier .fromNamespaceAndPath (MODID , "creative_modifier" );
159- AttributeModifier modifier = new AttributeModifier (id , 10 , AttributeModifier .Operation .ADD_VALUE );
160-
161- if (newGameMode == GameType .CREATIVE ) {
162- attributes .getInstance (Attributes .BLOCK_INTERACTION_RANGE ).addTransientModifier (modifier );
163- attributes .getInstance (Attributes .ENTITY_INTERACTION_RANGE ).addTransientModifier (modifier );
164-
165- LOGGER .info ("%s switched game mode to creative, add modifier complete." .formatted (player .getDisplayName ()));
166- } else {
167- attributes .getInstance (Attributes .BLOCK_INTERACTION_RANGE ).removeModifier (modifier );
168- attributes .getInstance (Attributes .ENTITY_INTERACTION_RANGE ).removeModifier (modifier );
169-
170- LOGGER .info ("%s switched other game mode, remove modifier removed." .formatted (player .getDisplayName ()));
171- }
172- }
173152}
0 commit comments