Java Code Examples for net.minecraft.entity.player.EntityPlayer#closeScreen()

The following examples show how to use net.minecraft.entity.player.EntityPlayer#closeScreen() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: GokiStats   File: GokiKeyHandler.java    License: MIT License 6 votes vote down vote up
@SubscribeEvent
public void keyDown(InputEvent.KeyInputEvent event) {
    Minecraft mc = Minecraft.getMinecraft();
    EntityPlayer player = mc.player;
    if (statsMenu.isPressed()) {
        player.closeScreen();
        player.openGui(GokiStats.instance,
                0,
                player.world,
                (int) player.posX,
                (int) player.posY,
                (int) player.posZ);

    } else if (compatibilityMenu.isPressed()) {
        player.openGui(GokiStats.instance,
                1,
                player.world,
                (int) player.posX,
                (int) player.posY,
                (int) player.posZ);
    }
}
 
Example 2
Source Project: AdvancedRocketry   File: ItemBiomeChanger.java    License: MIT License 6 votes vote down vote up
@Override
public void useNetworkData(EntityPlayer player, Side side, byte id,
		NBTTagCompound nbt, ItemStack stack) {
	if(id == -1) {
		//If -1 then discover current biome
		((SatelliteBiomeChanger)getSatellite(stack)).addBiome(Biome.getIdForBiome(player.world.getBiome(new BlockPos((int)player.posX, 0, (int)player.posZ))));
		player.closeScreen();
	}
	if(id == 0) {
		int biomeId = nbt.getInteger("biome");

		
			setBiomeId(stack, biomeId);
		player.closeScreen();
	}
}
 
Example 3
public void clickOffer(int offerId, int mouseButton, boolean sneaking, EntityPlayer player){
    problemState = EnumProblemState.NO_PROBLEMS;
    int cartSlot = getCartSlot(offerId);
    if(cartSlot >= 0) {
        if(mouseButton == 2) {
            shoppingAmounts[cartSlot] = 0;
        } else if(sneaking) {
            if(mouseButton == 0) shoppingAmounts[cartSlot] /= 2;
            else {
                AmadronOffer offer = offers.get(offerId);
                if(offer instanceof AmadronOfferCustom) {
                    AmadronOfferCustom custom = (AmadronOfferCustom)offer;
                    if(custom.getPlayerId().equals(player.getGameProfile().getId().toString())) {
                        if(AmadronOfferManager.getInstance().removeStaticOffer(custom)) {
                            if(AmadronOfferSettings.notifyOfTradeRemoval) NetworkHandler.sendToAll(new PacketAmadronTradeRemoved(custom));
                            custom.returnStock();
                            try {
                                AmadronOfferStaticConfig.INSTANCE.writeToFile();
                            } catch(IOException e) {
                                e.printStackTrace();
                            }
                            player.closeScreen();
                        }
                    }
                }
                shoppingAmounts[cartSlot] *= 2;
                if(shoppingAmounts[cartSlot] == 0) shoppingAmounts[cartSlot] = 1;
            }
        } else {
            if(mouseButton == 0) shoppingAmounts[cartSlot]--;
            else shoppingAmounts[cartSlot]++;
        }
        if(shoppingAmounts[cartSlot] <= 0) {
            shoppingAmounts[cartSlot] = 0;
            shoppingItems[cartSlot] = -1;
        } else {
            shoppingAmounts[cartSlot] = capShoppingAmount(offerId, shoppingAmounts[cartSlot], player);
            if(shoppingAmounts[cartSlot] > 0) shoppingItems[cartSlot] = offerId;
            else shoppingItems[cartSlot] = -1;
        }
    }
}