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

The following are Jave code examples for showing how to use sendStatusMessage() of the net.minecraft.entity.player.EntityPlayer class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: pnc-repressurized   File: NetworkConnectionPlayerHandler.java   Source Code and License Vote up 6 votes
@Override
protected void onSlotHack(int slot, boolean nuked) {
    if (!nuked && gui instanceof GuiSecurityStationHacking) {
        ((GuiSecurityStationHacking) gui).onSlotHack(slot);
    }
    ItemStack stack = station.getPrimaryInventory().getStackInSlot(slot);
    if (stack.getItemDamage() == ItemNetworkComponents.NETWORK_REGISTRY || stack.getItemDamage() == ItemNetworkComponents.DIAGNOSTIC_SUBROUTINE) {
        hackedSuccessfully = true;
        EntityPlayer player = FMLClientHandler.instance().getClient().player;
        NetworkHandler.sendToServer(new PacketSecurityStationAddHacker(station, player.getName()));
        FMLClientHandler.instance().getClient().player.closeScreen();
        player.sendStatusMessage(new TextComponentString(TextFormatting.GREEN + "Hacking successful! This Security Station now doesn't protect the area any longer!"), false);
        if (gui instanceof GuiSecurityStationHacking)
            ((GuiSecurityStationHacking) gui).removeUpdatesOnConnectionHandlers();
    }
}
 
Example 2
Project: pnc-repressurized   File: PacketAmadronTradeAdd.java   Source Code and License Vote up 6 votes
@Override
public void handleServerSide(PacketAmadronTradeAdd message, EntityPlayer player) {
    AmadronOfferCustom offer = message.getOffer();
    offer.updatePlayerId();
    if (AmadronOfferManager.getInstance().hasOffer(offer.copy().invert())) {
        player.sendStatusMessage(new TextComponentTranslation("message.amadron.duplicateReversedOffer"), false);
    } else if (AmadronOfferManager.getInstance().addStaticOffer(offer)) {
        if (AmadronOfferSettings.notifyOfTradeAddition) NetworkHandler.sendToAll(message);
        try {
            AmadronOfferStaticConfig.INSTANCE.writeToFile();
        } catch (IOException e) {
            e.printStackTrace();
        }
    } else {
        player.sendStatusMessage(new TextComponentTranslation("message.amadron.duplicateOffer"), false);
    }
}
 
Example 3
Project: pnc-repressurized   File: ItemRemote.java   Source Code and License Vote up 6 votes
private boolean isAllowedToEdit(EntityPlayer player, ItemStack remote) {
    NBTTagCompound tag = remote.getTagCompound();
    if (tag != null) {
        if (tag.hasKey("securityX")) {
            int x = tag.getInteger("securityX");
            int y = tag.getInteger("securityY");
            int z = tag.getInteger("securityZ");
            int dimensionId = tag.getInteger("securityDimension");
            WorldServer world = DimensionManager.getWorld(dimensionId);
            if (world != null) {
                TileEntity te = world.getTileEntity(new BlockPos(x, y, z));
                if (te instanceof TileEntitySecurityStation) {
                    boolean canAccess = ((TileEntitySecurityStation) te).doesAllowPlayer(player);
                    if (!canAccess) {
                        player.sendStatusMessage(new TextComponentTranslation("gui.remote.noEditRights", x, y, z), false);
                    }
                    return canAccess;
                }
            }
        }
    }
    return true;
}
 
Example 4
Project: pnc-repressurized   File: ItemManometer.java   Source Code and License Vote up 6 votes
@Override
public boolean itemInteractionForEntity(ItemStack iStack, EntityPlayer player, EntityLivingBase entity, EnumHand hand) {
    if (!player.world.isRemote) {
        if (entity instanceof IManoMeasurable) {
            if (((IPressurizable) iStack.getItem()).getPressure(iStack) > 0F) {
                List<String> curInfo = new ArrayList<String>();
                ((IManoMeasurable) entity).printManometerMessage(player, curInfo);
                if (curInfo.size() > 0) {
                    ((IPressurizable) iStack.getItem()).addAir(iStack, -30);
                    for (String s : curInfo) {
                        player.sendStatusMessage(new TextComponentTranslation(s), false);
                    }
                    return true;
                }
            } else {
                player.sendStatusMessage(new TextComponentTranslation(TextFormatting.RED + "The Manometer doesn't have any charge!"), false);
            }
        }
    }
    return false;
}
 
Example 5
Project: pnc-repressurized   File: BlockSecurityStation.java   Source Code and License Vote up 6 votes
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float par7, float par8, float par9) {
    if (player.isSneaking()) return false;
    else {
        if (!world.isRemote) {
            TileEntitySecurityStation te = (TileEntitySecurityStation) world.getTileEntity(pos);
            if (te != null) {
                if (te.isPlayerOnWhiteList(player)) {
                    player.openGui(PneumaticCraftRepressurized.instance, EnumGuiId.SECURITY_STATION_INVENTORY.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
                } else if (!te.hasValidNetwork()) {
                    player.sendStatusMessage(new TextComponentString(TextFormatting.GREEN + "This Security Station is out of order: Its network hasn't been properly configured."), false);
                } else if (te.hasPlayerHacked(player)) {
                    player.sendStatusMessage(new TextComponentString(TextFormatting.GREEN + "You've already hacked this Security Station!"), false);
                } else if (getPlayerHackLevel(player) < te.getSecurityLevel()) {
                    player.sendStatusMessage(new TextComponentString(TextFormatting.RED + "You can't access or hack this Security Station. To hack it you need at least a Pneumatic Helmet upgraded with " + te.getSecurityLevel() + " Security upgrade(s)."), false);
                } else {
                    player.openGui(PneumaticCraftRepressurized.instance, EnumGuiId.HACKING.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
                }
            }
        }
        return true;
    }
}
 
Example 6
Project: pnc-repressurized   File: TileEntitySecurityStation.java   Source Code and License Vote up 6 votes
@Override
public void handleGUIButtonPress(int buttonID, EntityPlayer player) {
    if (buttonID == 0) {
        redstoneMode++;
        if (redstoneMode > 2) redstoneMode = 0;
        updateNeighbours();
    } else if (buttonID == 2) {
        rebootStation();
    } else if (buttonID == 3) {
        if (!hasValidNetwork()) {
            player.sendStatusMessage(new TextComponentTranslation(TextFormatting.GREEN + "This Security Station is out of order: Its network hasn't been properly configured."), false);
        } else {
            player.openGui(PneumaticCraftRepressurized.instance, EnumGuiId.HACKING.ordinal(), getWorld(), getPos().getX(), getPos().getY(), getPos().getZ());
        }
    } else if (buttonID > 3 && buttonID - 4 < sharedUsers.size()) {
        sharedUsers.remove(buttonID - 4);
    }
    sendDescriptionPacket();
}
 
Example 7
Project: Geolosys   File: BlockSampleVanilla.java   Source Code and License Vote up 6 votes
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
    if (Config.getInstance().boringSamples)
    {
        String resource = Types.Vanilla.byMetadata(state.getBlock().getMetaFromState(state)).getResource();
        playerIn.sendStatusMessage(new TextComponentString("You break the sample to find " + resource), true);
    }
    else
    {
        this.dropBlockAsItem(worldIn, pos, state, 0);
    }
    worldIn.setBlockToAir(pos);
    playerIn.swingArm(EnumHand.MAIN_HAND);
    return true;
}
 
Example 8
Project: harshencastle   File: HarshenDimensionalGate.java   Source Code and License Vote up 6 votes
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,
		EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) 
{
	if(!worldIn.isRemote)
		if(((Boolean)state.getValue(ACTIVE)).booleanValue())
		{
			Boolean goHome = playerIn.dimension == DimensionPontus.DIMENSION_ID;
			if(playerIn instanceof EntityPlayerMP)
				if(goHome) 
					HarshenUtils.transferPlayerToDimension((EntityPlayerMP) playerIn, 0, pos);
				else
					HarshenUtils.transferPlayerToDimension((EntityPlayerMP) playerIn, DimensionPontus.DIMENSION_ID, pos, getStateFromMeta(3));
		}
		else
			playerIn.sendStatusMessage(new TextComponentTranslation("block.gate.reactivate"), true);
	return super.onBlockActivated(worldIn, pos, state, playerIn, hand, facing, hitX, hitY, hitZ);
}
 
Example 9
Project: pnc-repressurized   File: EntityDrone.java   Source Code and License Vote up 5 votes
@Override
public void onDeath(DamageSource par1DamageSource) {
    for (int i = 0; i < inventory.getSlots(); i++) {
        if (!inventory.getStackInSlot(i).isEmpty()) {
            entityDropItem(inventory.getStackInSlot(i), 0);
            inventory.setStackInSlot(i, ItemStack.EMPTY);
        }
    }
    if (naturallySpawned) {

    } else {
        ItemStack drone = getDroppedStack();
        if (hasCustomName()) drone.setStackDisplayName(getCustomNameTag());
        entityDropItem(drone, 0);

        if (!world.isRemote) {
            EntityPlayer owner = getOwner();
            if (owner != null) {
                int x = (int) Math.floor(posX);
                int y = (int) Math.floor(posY);
                int z = (int) Math.floor(posZ);
                if (hasCustomName()) {
                    owner.sendStatusMessage(new TextComponentTranslation("death.drone.named", getCustomNameTag(), x, y, z), false);
                } else {
                    owner.sendStatusMessage(new TextComponentTranslation("death.drone", x, y, z), false);
                }
            }
        }
    }
    if (!world.isRemote) getFakePlayer().interactionManager.cancelDestroyingBlock();
    super.onDeath(par1DamageSource);
}
 
Example 10
Project: pnc-repressurized   File: PacketAmadronTradeRemoved.java   Source Code and License Vote up 5 votes
@Override
public void handleClientSide(PacketAmadronTradeRemoved message, EntityPlayer player) {
    if (AmadronOfferSettings.notifyOfTradeRemoval)
        player.sendStatusMessage(new TextComponentTranslation("message.amadron.playerRemovedTrade",
                message.getOffer().getVendor(),
                WidgetAmadronOffer.getStringForObject(message.getOffer().getInput()),
                WidgetAmadronOffer.getStringForObject(message.getOffer().getOutput())),
                false);
}
 
Example 11
Project: pnc-repressurized   File: PacketAmadronTradeNotifyDeal.java   Source Code and License Vote up 5 votes
@Override
public void handleClientSide(PacketAmadronTradeNotifyDeal message, EntityPlayer player) {
    if (AmadronOfferSettings.notifyOfDealMade)
        player.sendStatusMessage(new TextComponentTranslation("message.amadron.playerBought",
                message.buyingPlayer,
                WidgetAmadronOffer.getStringForObject(message.getOffer().getOutput(), message.offerAmount),
                WidgetAmadronOffer.getStringForObject(message.getOffer().getInput(), message.offerAmount)),
                false);
}
 
Example 12
Project: pnc-repressurized   File: PacketAmadronTradeAdd.java   Source Code and License Vote up 5 votes
@Override
public void handleClientSide(PacketAmadronTradeAdd message, EntityPlayer player) {
    if (AmadronOfferSettings.notifyOfTradeAddition)
        player.sendStatusMessage(new TextComponentTranslation("message.amadron.playerAddedTrade",
                message.getOffer().getVendor(),
                WidgetAmadronOffer.getStringForObject(message.getOffer().getOutput()),
                WidgetAmadronOffer.getStringForObject(message.getOffer().getInput())), false);
}
 
Example 13
Project: pnc-repressurized   File: PacketCommandGetGlobalVariableOutput.java   Source Code and License Vote up 5 votes
@Override
public void handleClientSide(PacketCommandGetGlobalVariableOutput message, EntityPlayer player) {
    player.sendStatusMessage(new TextComponentTranslation("command.getGlobalVariable.output",
                    message.varName,
                    message.pos.getX(), message.pos.getY(), message.pos.getZ(),
                    message.stack.isEmpty() ? "-" : message.stack.getDisplayName()),
            false);
}
 
Example 14
Project: pnc-repressurized   File: ItemSeismicSensor.java   Source Code and License Vote up 5 votes
@Override
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    if (!world.isRemote) {
        int startY = pos.getY();
        while (pos.getY() > 0) {
            pos = pos.offset(EnumFacing.DOWN);
            if (world.getBlockState(pos).getBlock() == FluidRegistry.getFluid(Fluids.OIL.getName()).getBlock()) {
                Set<BlockPos> oilPositions = new HashSet<>();
                Stack<BlockPos> pendingPositions = new Stack<>();
                pendingPositions.add(new BlockPos(pos));
                while (!pendingPositions.empty()) {
                    BlockPos checkingPos = pendingPositions.pop();
                    for (EnumFacing d : EnumFacing.VALUES) {
                        BlockPos newPos = checkingPos.offset(d);
                        if (world.getBlockState(newPos).getBlock() == Fluids.OIL.getBlock() && FluidUtils.isSourceBlock(world, newPos) && oilPositions.add(newPos)) {
                            pendingPositions.add(newPos);
                        }
                    }
                }
                player.sendStatusMessage(new TextComponentTranslation(
                        "message.seismicSensor.foundOilDetails",
                        TextFormatting.GREEN.toString() + (startY - pos.getY()),
                        TextFormatting.GREEN.toString() + oilPositions.size() / 10 * 10),
                        false);
                return EnumActionResult.SUCCESS;
            }
        }
        player.sendStatusMessage(new TextComponentTranslation("message.seismicSensor.noOilFound"), false);
    }
    return EnumActionResult.SUCCESS; // we don't want to use the item.

}
 
Example 15
Project: pnc-repressurized   File: BlockAphorismTile.java   Source Code and License Vote up 5 votes
private void sendEditorMessage(EntityPlayer player) {
    ITextComponent msg = new TextComponentString(TextFormatting.WHITE.toString())
            .appendSibling(new TextComponentTranslation("gui.aphorismTileEditor"))
            .appendSibling(new TextComponentString(": "))
            .appendSibling(new TextComponentTranslation("gui.holdF1forHelp"));
    player.sendStatusMessage(msg, true);
}
 
Example 16
Project: pnc-repressurized   File: ContainerAmadron.java   Source Code and License Vote up 5 votes
@Override
public boolean canInteractWith(EntityPlayer player) {
    if (player.getHeldItemMainhand().getItem() == Itemss.AMADRON_TABLET) {
        IPressurizable pressurizable = (IPressurizable) Itemss.AMADRON_TABLET;
        pressurizable.addAir(player.getHeldItemMainhand(), -1);
        if (pressurizable.getPressure(player.getHeldItemMainhand()) > 0) {
            return true;
        } else {
            player.sendStatusMessage(new TextComponentTranslation("gui.tab.problems.notEnoughPressure"), false);
        }
    }
    return false;
}
 
Example 17
Project: Bewitchment   File: TileEntityTarotsTable.java   Source Code and License Vote up 5 votes
public void read(@Nonnull ItemStack tarotDeck, @Nonnull EntityPlayer reader) {
	if (!reader.world.isRemote) {
		if (checkDeck(tarotDeck) && consumePower(READ_COST, false)) {
			reader.openGui(Bewitchment.instance, LibGui.TAROT.ordinal(), reader.world, pos.getX(), pos.getY(), pos.getZ());
			PacketHandler.HANDLER.sendTo(new TarotMessage(reader), (EntityPlayerMP) reader);
		} else {
			reader.sendStatusMessage(new TextComponentTranslation("item.tarots.error_reading"), true);
		}
	}
}
 
Example 18
Project: Bewitchment   File: TileEntityCrystalBall.java   Source Code and License Vote up 5 votes
public boolean fortune(EntityPlayer reader) {
	if (consumePower(5000, false)) {
		return readFortune(reader, null);
	}
	reader.sendStatusMessage(new TextComponentTranslation("crystal_ball.error.no_power"), true);
	return false;
}
 
Example 19
Project: harshencastle   File: HandlerRendererGuiInventory.java   Source Code and License Vote up 4 votes
@SubscribeEvent
public void onGameOverlay(RenderGameOverlayEvent.Post event)
{
	Minecraft minecraft = Minecraft.getMinecraft();
       EntityPlayer player = minecraft.player;

	if(event.getType() != RenderGameOverlayEvent.ElementType.ALL || minecraft.currentScreen != null)
		return;
	ArrayList<Block> blocks = new ArrayList<>();
	ItemStack xrayStack = ItemStack.EMPTY;
	for(int i = 0; i < player.inventory.getSizeInventory(); i++)
		if(player.inventory.getStackInSlot(i).getItem() == HarshenItems.XRAY_PENDANT)
		{
			xrayStack = player.inventory.getStackInSlot(i);
			if(player.inventory.getStackInSlot(i).hasTagCompound())
				blocks.addAll(HarshenUtils.getBlocksFromString(player.inventory.getStackInSlot(i).getTagCompound().getString("BlockToSearch")));
		}
	if(HarshenUtils.getFirstOccuringItem(player,  HarshenItems.XRAY_PENDANT).hasTagCompound())
		blocks.addAll(HarshenUtils.getBlocksFromString(HarshenUtils.getFirstOccuringItem(player,  HarshenItems.XRAY_PENDANT).getTagCompound().getString("BlockToSearch")));
	ItemStack testStack = HarshenUtils.getFirstOccuringItem(player,  HarshenItems.XRAY_PENDANT);
	xrayStack = testStack.isEmpty() ? xrayStack : testStack;
	boolean flag = false;
	if(xrayStack.isEmpty())
		flag = true;
	if(!flag)
	{
		String brokenBlock = "";
		if(xrayStack.hasTagCompound())
			brokenBlock = xrayStack.getTagCompound().getString("BlockToSearch");
		if(blocks.isEmpty() && !previousXrayBlock.equalsIgnoreCase(brokenBlock))
		{
			player.sendStatusMessage(new TextComponentString(TextFormatting.DARK_RED + new TextComponentTranslation("xray.blocknotfound", brokenBlock).getUnformattedText()), true); 
			previousXrayBlock = brokenBlock;
		}
	}
	
	for(int i = 0; i < HarshenUtils.getHandler(player).getSlots(); i++)
       {
       	ItemStack stack  = HarshenUtils.getHandler(player).getStackInSlot(i);
           if(!stack.isEmpty())
           {
        	   float f = (float)stack.getAnimationsToGo() - event.getPartialTicks();
        	   int x = event.getResolution().getScaledWidth() - (20 * (5 - i));
              int y = event.getResolution().getScaledHeight() - 19;
               if (f > 0.0F)
               {
                   GlStateManager.pushMatrix();
                   float f1 = 1.0F + f / 5.0F;
                   GlStateManager.translate((float)(x + 8), (float)(y + 12), 0.0F);
                   GlStateManager.scale(1.0F / f1, (f1 + 1.0F) / 2.0F, 1.0F);
                   GlStateManager.translate((float)(-(x + 8)), (float)(-(y + 12)), 0.0F);
               }

               minecraft.getRenderItem().renderItemAndEffectIntoGUI(player, stack, x, y);
               
               if (f > 0.0F)
                   GlStateManager.popMatrix();
               minecraft.getRenderItem().renderItemOverlays(minecraft.fontRenderer, stack, x, y);
           }
       }
}
 
Example 20
Project: Geolosys   File: ItemProPick.java   Source Code and License Vote up 4 votes
private void foundMessage(EntityPlayer player, IBlockState state, EnumFacing facing)
{
    player.sendStatusMessage(new TextComponentString("Found " + new ItemStack(state.getBlock(), 1, state.getBlock().getMetaFromState(state)).getDisplayName() + " " + facing.getOpposite() + " from you."), true);
}