Java 类net.minecraft.tileentity.CommandBlockBaseLogic 实例源码

项目:Backmemed    文件:GuiCommandBlock.java   
public void updateGui()
{
    CommandBlockBaseLogic commandblockbaselogic = this.commandBlock.getCommandBlockLogic();
    this.commandTextField.setText(commandblockbaselogic.getCommand());
    this.trackOutput = commandblockbaselogic.shouldTrackOutput();
    this.commandBlockMode = this.commandBlock.getMode();
    this.conditional = this.commandBlock.isConditional();
    this.automatic = this.commandBlock.isAuto();
    this.updateCmdOutput();
    this.updateMode();
    this.updateConditional();
    this.updateAutoExec();
    this.doneBtn.enabled = true;
    this.outputBtn.enabled = true;
    this.modeBtn.enabled = true;
    this.conditionalBtn.enabled = true;
    this.autoExecBtn.enabled = true;
}
项目:Backmemed    文件:GuiCommandBlock.java   
private void updateCmdOutput()
{
    CommandBlockBaseLogic commandblockbaselogic = this.commandBlock.getCommandBlockLogic();

    if (commandblockbaselogic.shouldTrackOutput())
    {
        this.outputBtn.displayString = "O";

        if (commandblockbaselogic.getLastOutput() != null)
        {
            this.previousOutputTextField.setText(commandblockbaselogic.getLastOutput().getUnformattedText());
        }
    }
    else
    {
        this.outputBtn.displayString = "X";
        this.previousOutputTextField.setText("-");
    }
}
项目:CustomWorldGen    文件:GuiCommandBlock.java   
public void updateGui()
{
    CommandBlockBaseLogic commandblockbaselogic = this.commandBlock.getCommandBlockLogic();
    this.commandTextField.setText(commandblockbaselogic.getCommand());
    this.trackOutput = commandblockbaselogic.shouldTrackOutput();
    this.commandBlockMode = this.commandBlock.getMode();
    this.conditional = this.commandBlock.isConditional();
    this.automatic = this.commandBlock.isAuto();
    this.updateCmdOutput();
    this.updateMode();
    this.updateConditional();
    this.updateAutoExec();
    this.doneBtn.enabled = true;
    this.outputBtn.enabled = true;
    this.modeBtn.enabled = true;
    this.conditionalBtn.enabled = true;
    this.autoExecBtn.enabled = true;
}
项目:CustomWorldGen    文件:GuiCommandBlock.java   
private void updateCmdOutput()
{
    CommandBlockBaseLogic commandblockbaselogic = this.commandBlock.getCommandBlockLogic();

    if (commandblockbaselogic.shouldTrackOutput())
    {
        this.outputBtn.displayString = "O";

        if (commandblockbaselogic.getLastOutput() != null)
        {
            this.previousOutputTextField.setText(commandblockbaselogic.getLastOutput().getUnformattedText());
        }
    }
    else
    {
        this.outputBtn.displayString = "X";
        this.previousOutputTextField.setText("-");
    }
}
项目:ExpandedRailsMod    文件:GuiCommandBlock.java   
public void updateGui()
{
    CommandBlockBaseLogic commandblockbaselogic = this.commandBlock.getCommandBlockLogic();
    this.commandTextField.setText(commandblockbaselogic.getCommand());
    this.trackOutput = commandblockbaselogic.shouldTrackOutput();
    this.commandBlockMode = this.commandBlock.getMode();
    this.conditional = this.commandBlock.isConditional();
    this.automatic = this.commandBlock.isAuto();
    this.updateCmdOutput();
    this.updateMode();
    this.updateConditional();
    this.updateAutoExec();
    this.doneBtn.enabled = true;
    this.outputBtn.enabled = true;
    this.modeBtn.enabled = true;
    this.conditionalBtn.enabled = true;
    this.autoExecBtn.enabled = true;
}
项目:ExpandedRailsMod    文件:GuiCommandBlock.java   
private void updateCmdOutput()
{
    CommandBlockBaseLogic commandblockbaselogic = this.commandBlock.getCommandBlockLogic();

    if (commandblockbaselogic.shouldTrackOutput())
    {
        this.outputBtn.displayString = "O";

        if (commandblockbaselogic.getLastOutput() != null)
        {
            this.previousOutputTextField.setText(commandblockbaselogic.getLastOutput().getUnformattedText());
        }
    }
    else
    {
        this.outputBtn.displayString = "X";
        this.previousOutputTextField.setText("-");
    }
}
项目:UniversalRemote    文件:EntityPlayerMPProxy.java   
@Override
public void displayGuiEditCommandCart(CommandBlockBaseLogic commandBlock) {
    if (m_realPlayer == null) {
        super.displayGuiEditCommandCart(commandBlock);
    } else {
        syncToRealPlayer();
        m_realPlayer.displayGuiEditCommandCart(commandBlock);
        syncPublicFieldsFromReal();
    }
}
项目:UniversalRemote    文件:EntityPlayerProxy.java   
@Override
public void displayGuiEditCommandCart(CommandBlockBaseLogic commandBlock) {
    if (m_realPlayer == null) {
        super.displayGuiEditCommandCart(commandBlock);
    } else {
        m_realPlayer.displayGuiEditCommandCart(commandBlock);
    }
}
项目:Backmemed    文件:BlockCommandBlock.java   
/**
 * Called by ItemBlocks after a block is set in the world, to allow post-place logic
 */
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
    TileEntity tileentity = worldIn.getTileEntity(pos);

    if (tileentity instanceof TileEntityCommandBlock)
    {
        TileEntityCommandBlock tileentitycommandblock = (TileEntityCommandBlock)tileentity;
        CommandBlockBaseLogic commandblockbaselogic = tileentitycommandblock.getCommandBlockLogic();

        if (stack.hasDisplayName())
        {
            commandblockbaselogic.setName(stack.getDisplayName());
        }

        if (!worldIn.isRemote)
        {
            NBTTagCompound nbttagcompound = stack.getTagCompound();

            if (nbttagcompound == null || !nbttagcompound.hasKey("BlockEntityTag", 10))
            {
                commandblockbaselogic.setTrackOutput(worldIn.getGameRules().getBoolean("sendCommandFeedback"));
                tileentitycommandblock.setAuto(this == Blocks.CHAIN_COMMAND_BLOCK);
            }

            if (tileentitycommandblock.getMode() == TileEntityCommandBlock.Mode.SEQUENCE)
            {
                boolean flag = worldIn.isBlockPowered(pos);
                tileentitycommandblock.setPowered(flag);
            }
        }
    }
}
项目:Backmemed    文件:GuiCommandBlock.java   
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
public void initGui()
{
    final CommandBlockBaseLogic commandblockbaselogic = this.commandBlock.getCommandBlockLogic();
    Keyboard.enableRepeatEvents(true);
    this.buttonList.clear();
    this.doneBtn = this.addButton(new GuiButton(0, this.width / 2 - 4 - 150, this.height / 4 + 120 + 12, 150, 20, I18n.format("gui.done", new Object[0])));
    this.cancelBtn = this.addButton(new GuiButton(1, this.width / 2 + 4, this.height / 4 + 120 + 12, 150, 20, I18n.format("gui.cancel", new Object[0])));
    this.outputBtn = this.addButton(new GuiButton(4, this.width / 2 + 150 - 20, 135, 20, 20, "O"));
    this.modeBtn = this.addButton(new GuiButton(5, this.width / 2 - 50 - 100 - 4, 165, 100, 20, I18n.format("advMode.mode.sequence", new Object[0])));
    this.conditionalBtn = this.addButton(new GuiButton(6, this.width / 2 - 50, 165, 100, 20, I18n.format("advMode.mode.unconditional", new Object[0])));
    this.autoExecBtn = this.addButton(new GuiButton(7, this.width / 2 + 50 + 4, 165, 100, 20, I18n.format("advMode.mode.redstoneTriggered", new Object[0])));
    this.commandTextField = new GuiTextField(2, this.fontRendererObj, this.width / 2 - 150, 50, 300, 20);
    this.commandTextField.setMaxStringLength(32500);
    this.commandTextField.setFocused(true);
    this.previousOutputTextField = new GuiTextField(3, this.fontRendererObj, this.width / 2 - 150, 135, 276, 20);
    this.previousOutputTextField.setMaxStringLength(32500);
    this.previousOutputTextField.setEnabled(false);
    this.previousOutputTextField.setText("-");
    this.doneBtn.enabled = false;
    this.outputBtn.enabled = false;
    this.modeBtn.enabled = false;
    this.conditionalBtn.enabled = false;
    this.autoExecBtn.enabled = false;
    this.tabCompleter = new TabCompleter(this.commandTextField, true)
    {
        @Nullable
        public BlockPos getTargetBlockPos()
        {
            return commandblockbaselogic.getPosition();
        }
    };
}
项目:CustomWorldGen    文件:BlockCommandBlock.java   
/**
 * Called by ItemBlocks after a block is set in the world, to allow post-place logic
 */
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
    TileEntity tileentity = worldIn.getTileEntity(pos);

    if (tileentity instanceof TileEntityCommandBlock)
    {
        TileEntityCommandBlock tileentitycommandblock = (TileEntityCommandBlock)tileentity;
        CommandBlockBaseLogic commandblockbaselogic = tileentitycommandblock.getCommandBlockLogic();

        if (stack.hasDisplayName())
        {
            commandblockbaselogic.setName(stack.getDisplayName());
        }

        if (!worldIn.isRemote)
        {
            NBTTagCompound nbttagcompound = stack.getTagCompound();

            if (nbttagcompound == null || !nbttagcompound.hasKey("BlockEntityTag", 10))
            {
                commandblockbaselogic.setTrackOutput(worldIn.getGameRules().getBoolean("sendCommandFeedback"));
                tileentitycommandblock.setAuto(this == Blocks.CHAIN_COMMAND_BLOCK);
            }

            if (tileentitycommandblock.getMode() == TileEntityCommandBlock.Mode.SEQUENCE)
            {
                boolean flag = worldIn.isBlockPowered(pos);
                tileentitycommandblock.setPowered(flag);
            }
        }
    }
}
项目:CustomWorldGen    文件:GuiCommandBlock.java   
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
public void initGui()
{
    final CommandBlockBaseLogic commandblockbaselogic = this.commandBlock.getCommandBlockLogic();
    Keyboard.enableRepeatEvents(true);
    this.buttonList.clear();
    this.doneBtn = this.addButton(new GuiButton(0, this.width / 2 - 4 - 150, this.height / 4 + 120 + 12, 150, 20, I18n.format("gui.done", new Object[0])));
    this.cancelBtn = this.addButton(new GuiButton(1, this.width / 2 + 4, this.height / 4 + 120 + 12, 150, 20, I18n.format("gui.cancel", new Object[0])));
    this.outputBtn = this.addButton(new GuiButton(4, this.width / 2 + 150 - 20, 135, 20, 20, "O"));
    this.modeBtn = this.addButton(new GuiButton(5, this.width / 2 - 50 - 100 - 4, 165, 100, 20, I18n.format("advMode.mode.sequence", new Object[0])));
    this.conditionalBtn = this.addButton(new GuiButton(6, this.width / 2 - 50, 165, 100, 20, I18n.format("advMode.mode.unconditional", new Object[0])));
    this.autoExecBtn = this.addButton(new GuiButton(7, this.width / 2 + 50 + 4, 165, 100, 20, I18n.format("advMode.mode.redstoneTriggered", new Object[0])));
    this.commandTextField = new GuiTextField(2, this.fontRendererObj, this.width / 2 - 150, 50, 300, 20);
    this.commandTextField.setMaxStringLength(32500);
    this.commandTextField.setFocused(true);
    this.previousOutputTextField = new GuiTextField(3, this.fontRendererObj, this.width / 2 - 150, 135, 276, 20);
    this.previousOutputTextField.setMaxStringLength(32500);
    this.previousOutputTextField.setEnabled(false);
    this.previousOutputTextField.setText("-");
    this.doneBtn.enabled = false;
    this.outputBtn.enabled = false;
    this.modeBtn.enabled = false;
    this.conditionalBtn.enabled = false;
    this.autoExecBtn.enabled = false;
    this.tabCompleter = new TabCompleter(this.commandTextField, true)
    {
        @Nullable
        public BlockPos getTargetBlockPos()
        {
            return commandblockbaselogic.getPosition();
        }
    };
}
项目:Easy-Editors    文件:GuiNewCommandBlock.java   
private void updateCmdOutput() {
    CommandBlockBaseLogic logic = commandBlock.getCommandBlockLogic();

    if (logic.shouldTrackOutput()) {
        outputBtn.displayString = Translate.GUI_COMMANDBLOCK_TRACKINGOUTPUT;
        // Previous output text field text already set by superclass
    } else {
        outputBtn.displayString = Translate.GUI_COMMANDBLOCK_IGNORINGOUTPUT;
        previousOutputTextField.setText(Translate.GUI_COMMANDBLOCK_NOOUTPUT);
    }
}
项目:ExpandedRailsMod    文件:BlockCommandBlock.java   
/**
 * Called by ItemBlocks after a block is set in the world, to allow post-place logic
 */
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
    TileEntity tileentity = worldIn.getTileEntity(pos);

    if (tileentity instanceof TileEntityCommandBlock)
    {
        TileEntityCommandBlock tileentitycommandblock = (TileEntityCommandBlock)tileentity;
        CommandBlockBaseLogic commandblockbaselogic = tileentitycommandblock.getCommandBlockLogic();

        if (stack.hasDisplayName())
        {
            commandblockbaselogic.setName(stack.getDisplayName());
        }

        if (!worldIn.isRemote)
        {
            NBTTagCompound nbttagcompound = stack.getTagCompound();

            if (nbttagcompound == null || !nbttagcompound.hasKey("BlockEntityTag", 10))
            {
                commandblockbaselogic.setTrackOutput(worldIn.getGameRules().getBoolean("sendCommandFeedback"));
                tileentitycommandblock.setAuto(this == Blocks.CHAIN_COMMAND_BLOCK);
            }

            if (tileentitycommandblock.getMode() == TileEntityCommandBlock.Mode.SEQUENCE)
            {
                boolean flag = worldIn.isBlockPowered(pos);
                tileentitycommandblock.setPowered(flag);
            }
        }
    }
}
项目:ExpandedRailsMod    文件:GuiCommandBlock.java   
/**
 * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
 * window resizes, the buttonList is cleared beforehand.
 */
public void initGui()
{
    final CommandBlockBaseLogic commandblockbaselogic = this.commandBlock.getCommandBlockLogic();
    Keyboard.enableRepeatEvents(true);
    this.buttonList.clear();
    this.doneBtn = this.func_189646_b(new GuiButton(0, this.width / 2 - 4 - 150, this.height / 4 + 120 + 12, 150, 20, I18n.format("gui.done", new Object[0])));
    this.cancelBtn = this.func_189646_b(new GuiButton(1, this.width / 2 + 4, this.height / 4 + 120 + 12, 150, 20, I18n.format("gui.cancel", new Object[0])));
    this.outputBtn = this.func_189646_b(new GuiButton(4, this.width / 2 + 150 - 20, 135, 20, 20, "O"));
    this.modeBtn = this.func_189646_b(new GuiButton(5, this.width / 2 - 50 - 100 - 4, 165, 100, 20, I18n.format("advMode.mode.sequence", new Object[0])));
    this.conditionalBtn = this.func_189646_b(new GuiButton(6, this.width / 2 - 50, 165, 100, 20, I18n.format("advMode.mode.unconditional", new Object[0])));
    this.autoExecBtn = this.func_189646_b(new GuiButton(7, this.width / 2 + 50 + 4, 165, 100, 20, I18n.format("advMode.mode.redstoneTriggered", new Object[0])));
    this.commandTextField = new GuiTextField(2, this.fontRendererObj, this.width / 2 - 150, 50, 300, 20);
    this.commandTextField.setMaxStringLength(32500);
    this.commandTextField.setFocused(true);
    this.previousOutputTextField = new GuiTextField(3, this.fontRendererObj, this.width / 2 - 150, 135, 276, 20);
    this.previousOutputTextField.setMaxStringLength(32500);
    this.previousOutputTextField.setEnabled(false);
    this.previousOutputTextField.setText("-");
    this.doneBtn.enabled = false;
    this.outputBtn.enabled = false;
    this.modeBtn.enabled = false;
    this.conditionalBtn.enabled = false;
    this.autoExecBtn.enabled = false;
    this.tabCompleter = new TabCompleter(this.commandTextField, true)
    {
        @Nullable
        public BlockPos getTargetBlockPos()
        {
            return commandblockbaselogic.getPosition();
        }
    };
}
项目:Zombe-Modpack    文件:EntityPlayer.java   
public void displayGuiEditCommandCart(CommandBlockBaseLogic commandBlock)
{
}
项目:Zombe-Modpack    文件:EntityPlayerSP.java   
public void displayGuiEditCommandCart(CommandBlockBaseLogic commandBlock)
{
    this.mc.displayGuiScreen(new GuiEditCommandBlockMinecart(commandBlock));
}
项目:Backmemed    文件:EntityMinecartCommandBlock.java   
public CommandBlockBaseLogic getCommandBlockLogic()
{
    return this.commandBlockLogic;
}
项目:Backmemed    文件:EntityPlayer.java   
public void displayGuiEditCommandCart(CommandBlockBaseLogic commandBlock)
{
}
项目:Backmemed    文件:BlockCommandBlock.java   
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    if (!worldIn.isRemote)
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof TileEntityCommandBlock)
        {
            TileEntityCommandBlock tileentitycommandblock = (TileEntityCommandBlock)tileentity;
            CommandBlockBaseLogic commandblockbaselogic = tileentitycommandblock.getCommandBlockLogic();
            boolean flag = !StringUtils.isNullOrEmpty(commandblockbaselogic.getCommand());
            TileEntityCommandBlock.Mode tileentitycommandblock$mode = tileentitycommandblock.getMode();
            boolean flag1 = !tileentitycommandblock.isConditional() || this.isNextToSuccessfulCommandBlock(worldIn, pos, state);
            boolean flag2 = tileentitycommandblock.isConditionMet();
            boolean flag3 = false;

            if (tileentitycommandblock$mode != TileEntityCommandBlock.Mode.SEQUENCE && flag2 && flag)
            {
                commandblockbaselogic.trigger(worldIn);
                flag3 = true;
            }

            if (tileentitycommandblock.isPowered() || tileentitycommandblock.isAuto())
            {
                if (tileentitycommandblock$mode == TileEntityCommandBlock.Mode.SEQUENCE && flag1 && flag)
                {
                    commandblockbaselogic.trigger(worldIn);
                    flag3 = true;
                }

                if (tileentitycommandblock$mode == TileEntityCommandBlock.Mode.AUTO)
                {
                    worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn));

                    if (flag1)
                    {
                        this.propagateUpdate(worldIn, pos);
                    }
                }
            }

            if (!flag3)
            {
                commandblockbaselogic.setSuccessCount(0);
            }

            tileentitycommandblock.setConditionMet(flag1);
            worldIn.updateComparatorOutputLevel(pos, this);
        }
    }
}
项目:Backmemed    文件:EntityPlayerSP.java   
public void displayGuiEditCommandCart(CommandBlockBaseLogic commandBlock)
{
    this.mc.displayGuiScreen(new GuiEditCommandBlockMinecart(commandBlock));
}
项目:Backmemed    文件:GuiEditCommandBlockMinecart.java   
public GuiEditCommandBlockMinecart(CommandBlockBaseLogic p_i46595_1_)
{
    this.commandBlockLogic = p_i46595_1_;
}
项目:Backmemed    文件:GuiCommandBlock.java   
/**
 * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
 */
protected void actionPerformed(GuiButton button) throws IOException
{
    if (button.enabled)
    {
        CommandBlockBaseLogic commandblockbaselogic = this.commandBlock.getCommandBlockLogic();

        if (button.id == 1)
        {
            commandblockbaselogic.setTrackOutput(this.trackOutput);
            this.mc.displayGuiScreen((GuiScreen)null);
        }
        else if (button.id == 0)
        {
            PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
            commandblockbaselogic.fillInInfo(packetbuffer);
            packetbuffer.writeString(this.commandTextField.getText());
            packetbuffer.writeBoolean(commandblockbaselogic.shouldTrackOutput());
            packetbuffer.writeString(this.commandBlockMode.name());
            packetbuffer.writeBoolean(this.conditional);
            packetbuffer.writeBoolean(this.automatic);
            this.mc.getConnection().sendPacket(new CPacketCustomPayload("MC|AutoCmd", packetbuffer));

            if (!commandblockbaselogic.shouldTrackOutput())
            {
                commandblockbaselogic.setLastOutput((ITextComponent)null);
            }

            this.mc.displayGuiScreen((GuiScreen)null);
        }
        else if (button.id == 4)
        {
            commandblockbaselogic.setTrackOutput(!commandblockbaselogic.shouldTrackOutput());
            this.updateCmdOutput();
        }
        else if (button.id == 5)
        {
            this.nextMode();
            this.updateMode();
        }
        else if (button.id == 6)
        {
            this.conditional = !this.conditional;
            this.updateConditional();
        }
        else if (button.id == 7)
        {
            this.automatic = !this.automatic;
            this.updateAutoExec();
        }
    }
}
项目:Backmemed    文件:ServerCommandManager.java   
/**
 * Send an informative message to the server operators
 */
public void notifyListener(ICommandSender sender, ICommand command, int flags, String translationKey, Object... translationArgs)
{
    boolean flag = true;
    MinecraftServer minecraftserver = this.server;

    if (!sender.sendCommandFeedback())
    {
        flag = false;
    }

    ITextComponent itextcomponent = new TextComponentTranslation("chat.type.admin", new Object[] {sender.getName(), new TextComponentTranslation(translationKey, translationArgs)});
    itextcomponent.getStyle().setColor(TextFormatting.GRAY);
    itextcomponent.getStyle().setItalic(Boolean.valueOf(true));

    if (flag)
    {
        for (EntityPlayer entityplayer : minecraftserver.getPlayerList().getPlayerList())
        {
            if (entityplayer != sender && minecraftserver.getPlayerList().canSendCommands(entityplayer.getGameProfile()) && command.checkPermission(this.server, sender))
            {
                boolean flag1 = sender instanceof MinecraftServer && this.server.shouldBroadcastConsoleToOps();
                boolean flag2 = sender instanceof RConConsoleSource && this.server.shouldBroadcastRconToOps();

                if (flag1 || flag2 || !(sender instanceof RConConsoleSource) && !(sender instanceof MinecraftServer))
                {
                    entityplayer.addChatMessage(itextcomponent);
                }
            }
        }
    }

    if (sender != minecraftserver && minecraftserver.worldServers[0].getGameRules().getBoolean("logAdminCommands"))
    {
        minecraftserver.addChatMessage(itextcomponent);
    }

    boolean flag3 = minecraftserver.worldServers[0].getGameRules().getBoolean("sendCommandFeedback");

    if (sender instanceof CommandBlockBaseLogic)
    {
        flag3 = ((CommandBlockBaseLogic)sender).shouldTrackOutput();
    }

    if ((flags & 1) != 1 && flag3 || sender instanceof MinecraftServer)
    {
        sender.addChatMessage(new TextComponentTranslation(translationKey, translationArgs));
    }
}
项目:Backmemed    文件:CommandHelp.java   
/**
 * Callback for when the command is executed
 */
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    if (sender instanceof CommandBlockBaseLogic)
    {
        sender.addChatMessage((new TextComponentString("Searge says: ")).appendText(seargeSays[this.rand.nextInt(seargeSays.length) % seargeSays.length]));
    }
    else
    {
        List<ICommand> list = this.getSortedPossibleCommands(sender, server);
        int i = 7;
        int j = (list.size() - 1) / 7;
        int k = 0;

        try
        {
            k = args.length == 0 ? 0 : parseInt(args[0], 1, j + 1) - 1;
        }
        catch (NumberInvalidException numberinvalidexception)
        {
            Map<String, ICommand> map = this.getCommandMap(server);
            ICommand icommand = (ICommand)map.get(args[0]);

            if (icommand != null)
            {
                throw new WrongUsageException(icommand.getCommandUsage(sender), new Object[0]);
            }

            if (MathHelper.getInt(args[0], -1) == -1 && MathHelper.getInt(args[0], -2) == -2)
            {
                throw new CommandNotFoundException();
            }

            throw numberinvalidexception;
        }

        int l = Math.min((k + 1) * 7, list.size());
        TextComponentTranslation textcomponenttranslation1 = new TextComponentTranslation("commands.help.header", new Object[] {Integer.valueOf(k + 1), Integer.valueOf(j + 1)});
        textcomponenttranslation1.getStyle().setColor(TextFormatting.DARK_GREEN);
        sender.addChatMessage(textcomponenttranslation1);

        for (int i1 = k * 7; i1 < l; ++i1)
        {
            ICommand icommand1 = (ICommand)list.get(i1);
            TextComponentTranslation textcomponenttranslation = new TextComponentTranslation(icommand1.getCommandUsage(sender), new Object[0]);
            textcomponenttranslation.getStyle().setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/" + icommand1.getCommandName() + " "));
            sender.addChatMessage(textcomponenttranslation);
        }

        if (k == 0)
        {
            TextComponentTranslation textcomponenttranslation2 = new TextComponentTranslation("commands.help.footer", new Object[0]);
            textcomponenttranslation2.getStyle().setColor(TextFormatting.GREEN);
            sender.addChatMessage(textcomponenttranslation2);
        }
    }
}
项目:CustomWorldGen    文件:EntityMinecartCommandBlock.java   
public CommandBlockBaseLogic getCommandBlockLogic()
{
    return this.commandBlockLogic;
}
项目:CustomWorldGen    文件:EntityPlayer.java   
public void displayGuiEditCommandCart(CommandBlockBaseLogic commandBlock)
{
}
项目:CustomWorldGen    文件:BlockCommandBlock.java   
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    if (!worldIn.isRemote)
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof TileEntityCommandBlock)
        {
            TileEntityCommandBlock tileentitycommandblock = (TileEntityCommandBlock)tileentity;
            CommandBlockBaseLogic commandblockbaselogic = tileentitycommandblock.getCommandBlockLogic();
            boolean flag = !StringUtils.isNullOrEmpty(commandblockbaselogic.getCommand());
            TileEntityCommandBlock.Mode tileentitycommandblock$mode = tileentitycommandblock.getMode();
            boolean flag1 = !tileentitycommandblock.isConditional() || this.isNextToSuccessfulCommandBlock(worldIn, pos, state);
            boolean flag2 = tileentitycommandblock.isConditionMet();
            boolean flag3 = false;

            if (tileentitycommandblock$mode != TileEntityCommandBlock.Mode.SEQUENCE && flag2 && flag)
            {
                commandblockbaselogic.trigger(worldIn);
                flag3 = true;
            }

            if (tileentitycommandblock.isPowered() || tileentitycommandblock.isAuto())
            {
                if (tileentitycommandblock$mode == TileEntityCommandBlock.Mode.SEQUENCE && flag1 && flag)
                {
                    commandblockbaselogic.trigger(worldIn);
                    flag3 = true;
                }

                if (tileentitycommandblock$mode == TileEntityCommandBlock.Mode.AUTO)
                {
                    worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn));

                    if (flag1)
                    {
                        this.propagateUpdate(worldIn, pos);
                    }
                }
            }

            if (!flag3)
            {
                commandblockbaselogic.setSuccessCount(0);
            }

            tileentitycommandblock.setConditionMet(flag1);
            worldIn.updateComparatorOutputLevel(pos, this);
        }
    }
}
项目:CustomWorldGen    文件:EntityPlayerSP.java   
public void displayGuiEditCommandCart(CommandBlockBaseLogic commandBlock)
{
    this.mc.displayGuiScreen(new GuiEditCommandBlockMinecart(commandBlock));
}
项目:CustomWorldGen    文件:GuiEditCommandBlockMinecart.java   
public GuiEditCommandBlockMinecart(CommandBlockBaseLogic p_i46595_1_)
{
    this.commandBlockLogic = p_i46595_1_;
}
项目:CustomWorldGen    文件:GuiCommandBlock.java   
/**
 * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
 */
protected void actionPerformed(GuiButton button) throws IOException
{
    if (button.enabled)
    {
        CommandBlockBaseLogic commandblockbaselogic = this.commandBlock.getCommandBlockLogic();

        if (button.id == 1)
        {
            commandblockbaselogic.setTrackOutput(this.trackOutput);
            this.mc.displayGuiScreen((GuiScreen)null);
        }
        else if (button.id == 0)
        {
            PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
            commandblockbaselogic.fillInInfo(packetbuffer);
            packetbuffer.writeString(this.commandTextField.getText());
            packetbuffer.writeBoolean(commandblockbaselogic.shouldTrackOutput());
            packetbuffer.writeString(this.commandBlockMode.name());
            packetbuffer.writeBoolean(this.conditional);
            packetbuffer.writeBoolean(this.automatic);
            this.mc.getConnection().sendPacket(new CPacketCustomPayload("MC|AutoCmd", packetbuffer));

            if (!commandblockbaselogic.shouldTrackOutput())
            {
                commandblockbaselogic.setLastOutput((ITextComponent)null);
            }

            this.mc.displayGuiScreen((GuiScreen)null);
        }
        else if (button.id == 4)
        {
            commandblockbaselogic.setTrackOutput(!commandblockbaselogic.shouldTrackOutput());
            this.updateCmdOutput();
        }
        else if (button.id == 5)
        {
            this.nextMode();
            this.updateMode();
        }
        else if (button.id == 6)
        {
            this.conditional = !this.conditional;
            this.updateConditional();
        }
        else if (button.id == 7)
        {
            this.automatic = !this.automatic;
            this.updateAutoExec();
        }
    }
}
项目:CustomWorldGen    文件:ServerCommandManager.java   
/**
 * Send an informative message to the server operators
 */
public void notifyListener(ICommandSender sender, ICommand command, int flags, String translationKey, Object... translationArgs)
{
    boolean flag = true;
    MinecraftServer minecraftserver = this.server;

    if (!sender.sendCommandFeedback())
    {
        flag = false;
    }

    ITextComponent itextcomponent = new TextComponentTranslation("chat.type.admin", new Object[] {sender.getName(), new TextComponentTranslation(translationKey, translationArgs)});
    itextcomponent.getStyle().setColor(TextFormatting.GRAY);
    itextcomponent.getStyle().setItalic(Boolean.valueOf(true));

    if (flag)
    {
        for (EntityPlayer entityplayer : minecraftserver.getPlayerList().getPlayerList())
        {
            if (entityplayer != sender && minecraftserver.getPlayerList().canSendCommands(entityplayer.getGameProfile()) && command.checkPermission(this.server, sender))
            {
                boolean flag1 = sender instanceof MinecraftServer && this.server.shouldBroadcastConsoleToOps();
                boolean flag2 = sender instanceof RConConsoleSource && this.server.shouldBroadcastRconToOps();

                if (flag1 || flag2 || !(sender instanceof RConConsoleSource) && !(sender instanceof MinecraftServer))
                {
                    entityplayer.addChatMessage(itextcomponent);
                }
            }
        }
    }

    if (sender != minecraftserver && minecraftserver.worldServers[0].getGameRules().getBoolean("logAdminCommands"))
    {
        minecraftserver.addChatMessage(itextcomponent);
    }

    boolean flag3 = minecraftserver.worldServers[0].getGameRules().getBoolean("sendCommandFeedback");

    if (sender instanceof CommandBlockBaseLogic)
    {
        flag3 = ((CommandBlockBaseLogic)sender).shouldTrackOutput();
    }

    if ((flags & 1) != 1 && flag3 || sender instanceof MinecraftServer)
    {
        sender.addChatMessage(new TextComponentTranslation(translationKey, translationArgs));
    }
}
项目:CustomWorldGen    文件:CommandHelp.java   
/**
 * Callback for when the command is executed
 */
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    if (sender instanceof CommandBlockBaseLogic)
    {
        sender.addChatMessage((new TextComponentString("Searge says: ")).appendText(seargeSays[this.rand.nextInt(seargeSays.length) % seargeSays.length]));
    }
    else
    {
        List<ICommand> list = this.getSortedPossibleCommands(sender, server);
        int i = 7;
        int j = (list.size() - 1) / 7;
        int k = 0;

        try
        {
            k = args.length == 0 ? 0 : parseInt(args[0], 1, j + 1) - 1;
        }
        catch (NumberInvalidException numberinvalidexception)
        {
            Map<String, ICommand> map = this.getCommandMap(server);
            ICommand icommand = (ICommand)map.get(args[0]);

            if (icommand != null)
            {
                throw new WrongUsageException(icommand.getCommandUsage(sender), new Object[0]);
            }

            if (MathHelper.parseIntWithDefault(args[0], -1) != -1)
            {
                throw numberinvalidexception;
            }

            throw new CommandNotFoundException();
        }

        int l = Math.min((k + 1) * 7, list.size());
        TextComponentTranslation textcomponenttranslation1 = new TextComponentTranslation("commands.help.header", new Object[] {Integer.valueOf(k + 1), Integer.valueOf(j + 1)});
        textcomponenttranslation1.getStyle().setColor(TextFormatting.DARK_GREEN);
        sender.addChatMessage(textcomponenttranslation1);

        for (int i1 = k * 7; i1 < l; ++i1)
        {
            ICommand icommand1 = (ICommand)list.get(i1);
            TextComponentTranslation textcomponenttranslation = new TextComponentTranslation(icommand1.getCommandUsage(sender), new Object[0]);
            textcomponenttranslation.getStyle().setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/" + icommand1.getCommandName() + " "));
            sender.addChatMessage(textcomponenttranslation);
        }

        if (k == 0 && sender instanceof EntityPlayer)
        {
            TextComponentTranslation textcomponenttranslation2 = new TextComponentTranslation("commands.help.footer", new Object[0]);
            textcomponenttranslation2.getStyle().setColor(TextFormatting.GREEN);
            sender.addChatMessage(textcomponenttranslation2);
        }
    }
}
项目:metamorph    文件:CommandMorph.java   
@Override
public boolean checkPermission(MinecraftServer server, ICommandSender sender)
{
    return sender instanceof CommandBlockBaseLogic || super.checkPermission(server, sender);
}
项目:metamorph    文件:CommandAcquireMorph.java   
@Override
public boolean checkPermission(MinecraftServer server, ICommandSender sender)
{
    return sender instanceof CommandBlockBaseLogic || super.checkPermission(server, sender);
}
项目:SettlerCraft    文件:EntityPlayerWrappedSettler.java   
@Override
public void displayGuiEditCommandCart(CommandBlockBaseLogic logic) {
    //not relevant
}
项目:ExpandedRailsMod    文件:EntityMinecartCommandBlock.java   
public CommandBlockBaseLogic getCommandBlockLogic()
{
    return this.commandBlockLogic;
}
项目:ExpandedRailsMod    文件:EntityPlayer.java   
public void displayGuiEditCommandCart(CommandBlockBaseLogic p_184809_1_)
{
}
项目:ExpandedRailsMod    文件:BlockCommandBlock.java   
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    if (!worldIn.isRemote)
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof TileEntityCommandBlock)
        {
            TileEntityCommandBlock tileentitycommandblock = (TileEntityCommandBlock)tileentity;
            CommandBlockBaseLogic commandblockbaselogic = tileentitycommandblock.getCommandBlockLogic();
            boolean flag = !StringUtils.isNullOrEmpty(commandblockbaselogic.getCommand());
            TileEntityCommandBlock.Mode tileentitycommandblock$mode = tileentitycommandblock.getMode();
            boolean flag1 = !tileentitycommandblock.isConditional() || this.isNextToSuccessfulCommandBlock(worldIn, pos, state);
            boolean flag2 = tileentitycommandblock.isConditionMet();
            boolean flag3 = false;

            if (tileentitycommandblock$mode != TileEntityCommandBlock.Mode.SEQUENCE && flag2 && flag)
            {
                commandblockbaselogic.trigger(worldIn);
                flag3 = true;
            }

            if (tileentitycommandblock.isPowered() || tileentitycommandblock.isAuto())
            {
                if (tileentitycommandblock$mode == TileEntityCommandBlock.Mode.SEQUENCE && flag1 && flag)
                {
                    commandblockbaselogic.trigger(worldIn);
                    flag3 = true;
                }

                if (tileentitycommandblock$mode == TileEntityCommandBlock.Mode.AUTO)
                {
                    worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn));

                    if (flag1)
                    {
                        this.propagateUpdate(worldIn, pos);
                    }
                }
            }

            if (!flag3)
            {
                commandblockbaselogic.setSuccessCount(0);
            }

            tileentitycommandblock.setConditionMet(flag1);
            worldIn.updateComparatorOutputLevel(pos, this);
        }
    }
}
项目:ExpandedRailsMod    文件:EntityPlayerSP.java   
public void displayGuiEditCommandCart(CommandBlockBaseLogic p_184809_1_)
{
    this.mc.displayGuiScreen(new GuiEditCommandBlockMinecart(p_184809_1_));
}