Java Code Examples for net.minecraft.client.entity.EntityPlayerSP#sendChatMessage()

The following examples show how to use net.minecraft.client.entity.EntityPlayerSP#sendChatMessage() . 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 check out the related API usage on the sidebar.
Example 1
Source File: TaskPasteSchematicPerChunkCommand.java    From litematica with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void sendSetBlockCommand(int x, int y, int z, IBlockState state, EntityPlayerSP player)
{
    Block block = state.getBlock();
    ResourceLocation rl = Block.REGISTRY.getNameForObject(block);

    if (rl == null)
    {
        return;
    }

    String blockName = rl.toString();
    String cmdName = Configs.Generic.PASTE_COMMAND_SETBLOCK.getStringValue();
    String strCommand = String.format("/%s %d %d %d %s %d", cmdName, x, y, z, blockName, block.getMetaFromState(state));

    player.sendChatMessage(strCommand);
    ++this.sentCommandsTotal;
}
 
Example 2
Source File: MissionQuitCommandsImplementation.java    From malmo with MIT License 6 votes vote down vote up
@Override
protected boolean onExecute(String verb, String parameter, MissionInit missionInit)
{
    EntityPlayerSP player = Minecraft.getMinecraft().player;
    if (player == null)
    {
        return false;
    }

    if (!verb.equalsIgnoreCase(MissionQuitCommand.QUIT.value()))
    {
        return false;
    }

    player.sendChatMessage( "Quitting mission" );
    this.iWantToQuit = true;
    return true;
}
 
Example 3
Source File: ChatCommandsImplementation.java    From malmo with MIT License 6 votes vote down vote up
@Override
protected boolean onExecute(String verb, String parameter, MissionInit missionInit)
{
    EntityPlayerSP player = Minecraft.getMinecraft().player;
    if (player == null)
    {
        return false;
    }
    
    if (!verb.equalsIgnoreCase(ChatCommand.CHAT.value()))
    {
        return false;
    }
    
    player.sendChatMessage( parameter );
    return true;
}
 
Example 4
Source File: CommandQueue.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void check() {
    if (!commands.isEmpty()) {
        EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer;
        if (thePlayer != null && commands.peek() != null) {
            String poll = commands.poll();
            Runnable runnable = asyncCallbacks.get(poll);
            thePlayer.sendChatMessage(poll);
            if (runnable != null) {
                runnable.run();
            }
        }
    }
}
 
Example 5
Source File: TaskPasteSchematicPerChunkCommand.java    From litematica with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void summonEntities(IntBoundingBox box, WorldSchematic worldSchematic, EntityPlayerSP player)
{
    AxisAlignedBB bb = new AxisAlignedBB(box.minX, box.minY, box.minZ, box.maxX + 1, box.maxY + 1, box.maxZ + 1);
    List<Entity> entities = worldSchematic.getEntitiesWithinAABBExcludingEntity(null, bb);

    for (Entity entity : entities)
    {
        ResourceLocation rl = EntityList.getKey(entity);

        if (rl != null)
        {
            String entityName = rl.toString();
            /*
            NBTTagCompound nbt = new NBTTagCompound();
            entity.writeToNBTOptional(nbt);
            String nbtString = nbt.toString();
            */

            String strCommand = String.format(Locale.ROOT, "/summon %s %f %f %f", entityName, entity.posX, entity.posY, entity.posZ);
            /*
            String strCommand = String.format("/summon %s %f %f %f %s", entityName, entity.posX, entity.posY, entity.posZ, nbtString);
            System.out.printf("entity: %s\n", entity);
            System.out.printf("%s\n", strCommand);
            System.out.printf("nbt: %s\n", nbtString);
            */

            player.sendChatMessage(strCommand);
        }
    }
}