public void drawScreen(int par1, int par2, float par3) {
   super.drawScreen(par1, par2, par3);
   boolean op = false; // TODO: Check if player is OP
   if (Keyboard.isKeyDown(Keyboard.KEY_O) && op) {
     player.openGui(ModUncrafting.instance, 1, worldObj, x, y, z);
   }
 }
Beispiel #2
0
 public void respawn(boolean flag, int i) {
   if (!theWorld.multiplayerWorld && !theWorld.worldProvider.canRespawnHere()) {
     usePortal();
   }
   ChunkCoordinates chunkcoordinates = null;
   ChunkCoordinates chunkcoordinates1 = null;
   boolean flag1 = true;
   if (thePlayer != null && !flag) {
     chunkcoordinates = thePlayer.getPlayerSpawnCoordinate();
     if (chunkcoordinates != null) {
       chunkcoordinates1 = EntityPlayer.func_25060_a(theWorld, chunkcoordinates);
       if (chunkcoordinates1 == null) {
         thePlayer.addChatMessage("tile.bed.notValid");
       }
     }
   }
   if (chunkcoordinates1 == null) {
     chunkcoordinates1 = theWorld.getSpawnPoint();
     flag1 = false;
   }
   net.minecraft.src.IChunkProvider ichunkprovider = theWorld.getIChunkProvider();
   if (ichunkprovider instanceof ChunkProviderLoadOrGenerate) {
     ChunkProviderLoadOrGenerate chunkproviderloadorgenerate =
         (ChunkProviderLoadOrGenerate) ichunkprovider;
     chunkproviderloadorgenerate.setCurrentChunkOver(
         chunkcoordinates1.x >> 4, chunkcoordinates1.z >> 4);
   }
   theWorld.setSpawnLocation();
   theWorld.updateEntityList();
   int j = 0;
   if (thePlayer != null) {
     j = thePlayer.entityId;
     theWorld.setEntityDead(thePlayer);
   }
   renderViewEntity = null;
   thePlayer = (EntityPlayerSP) playerController.createPlayer(theWorld);
   thePlayer.dimension = i;
   renderViewEntity = thePlayer;
   thePlayer.preparePlayerToSpawn();
   if (flag1) {
     thePlayer.setPlayerSpawnCoordinate(chunkcoordinates);
     thePlayer.setLocationAndAngles(
         (float) chunkcoordinates1.x + 0.5F,
         (float) chunkcoordinates1.y + 0.1F,
         (float) chunkcoordinates1.z + 0.5F,
         0.0F,
         0.0F);
   }
   playerController.flipPlayer(thePlayer);
   theWorld.spawnPlayerWithLoadedChunks(thePlayer);
   thePlayer.movementInput = new MovementInputFromOptions(gameSettings);
   thePlayer.entityId = j;
   thePlayer.func_6420_o();
   playerController.func_6473_b(thePlayer);
   func_6255_d("Respawning");
   if (currentScreen instanceof GuiGameOver) {
     displayGuiScreen(null);
   }
 }