本文整理汇总了Java中net.minecraft.tileentity.TileEntityCommandBlock类的典型用法代码示例。如果您正苦于以下问题:Java TileEntityCommandBlock类的具体用法?Java TileEntityCommandBlock怎么用?Java TileEntityCommandBlock使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TileEntityCommandBlock类属于net.minecraft.tileentity包,在下文中一共展示了TileEntityCommandBlock类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onBlockPlacedBy
import net.minecraft.tileentity.TileEntityCommandBlock; //导入依赖的package包/类
/**
* 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)
{
CommandBlockLogic commandblocklogic = ((TileEntityCommandBlock)tileentity).getCommandBlockLogic();
if (stack.hasDisplayName())
{
commandblocklogic.setName(stack.getDisplayName());
}
if (!worldIn.isRemote)
{
commandblocklogic.setTrackOutput(worldIn.getGameRules().getBoolean("sendCommandFeedback"));
}
}
}
示例2: handleUpdateTileEntity
import net.minecraft.tileentity.TileEntityCommandBlock; //导入依赖的package包/类
/**
* Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks,
* beacons, skulls, flowerpot
*/
public void handleUpdateTileEntity(S35PacketUpdateTileEntity packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
if (this.gameController.theWorld.isBlockLoaded(packetIn.getPos()))
{
TileEntity tileentity = this.gameController.theWorld.getTileEntity(packetIn.getPos());
int i = packetIn.getTileEntityType();
if (i == 1 && tileentity instanceof TileEntityMobSpawner || i == 2 && tileentity instanceof TileEntityCommandBlock || i == 3 && tileentity instanceof TileEntityBeacon || i == 4 && tileentity instanceof TileEntitySkull || i == 5 && tileentity instanceof TileEntityFlowerPot || i == 6 && tileentity instanceof TileEntityBanner)
{
tileentity.readFromNBT(packetIn.getNbtCompound());
}
}
}
示例3: handleUpdateTileEntity
import net.minecraft.tileentity.TileEntityCommandBlock; //导入依赖的package包/类
/**
* Updates the NBTTagCompound metadata of instances of the following
* entitytypes: Mob spawners, command blocks, beacons, skulls, flowerpot
*/
public void handleUpdateTileEntity(S35PacketUpdateTileEntity packetIn) {
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
if (this.gameController.theWorld.isBlockLoaded(packetIn.getPos())) {
TileEntity tileentity = this.gameController.theWorld.getTileEntity(packetIn.getPos());
int i = packetIn.getTileEntityType();
if (i == 1 && tileentity instanceof TileEntityMobSpawner
|| i == 2 && tileentity instanceof TileEntityCommandBlock
|| i == 3 && tileentity instanceof TileEntityBeacon
|| i == 4 && tileentity instanceof TileEntitySkull
|| i == 5 && tileentity instanceof TileEntityFlowerPot
|| i == 6 && tileentity instanceof TileEntityBanner) {
tileentity.readFromNBT(packetIn.getNbtCompound());
}
}
}
示例4: handleUpdateTileEntity
import net.minecraft.tileentity.TileEntityCommandBlock; //导入依赖的package包/类
/**
* Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks,
* beacons, skulls, flowerpot
*/
public void handleUpdateTileEntity(SPacketUpdateTileEntity packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
if (this.gameController.world.isBlockLoaded(packetIn.getPos()))
{
TileEntity tileentity = this.gameController.world.getTileEntity(packetIn.getPos());
int i = packetIn.getTileEntityType();
boolean flag = i == 2 && tileentity instanceof TileEntityCommandBlock;
if (i == 1 && tileentity instanceof TileEntityMobSpawner || flag || i == 3 && tileentity instanceof TileEntityBeacon || i == 4 && tileentity instanceof TileEntitySkull || i == 5 && tileentity instanceof TileEntityFlowerPot || i == 6 && tileentity instanceof TileEntityBanner || i == 7 && tileentity instanceof TileEntityStructure || i == 8 && tileentity instanceof TileEntityEndGateway || i == 9 && tileentity instanceof TileEntitySign || i == 10 && tileentity instanceof TileEntityShulkerBox)
{
tileentity.readFromNBT(packetIn.getNbtCompound());
}
if (flag && this.gameController.currentScreen instanceof GuiCommandBlock)
{
((GuiCommandBlock)this.gameController.currentScreen).updateGui();
}
}
}
示例5: nextMode
import net.minecraft.tileentity.TileEntityCommandBlock; //导入依赖的package包/类
private void nextMode()
{
switch (this.commandBlockMode)
{
case SEQUENCE:
this.commandBlockMode = TileEntityCommandBlock.Mode.AUTO;
break;
case AUTO:
this.commandBlockMode = TileEntityCommandBlock.Mode.REDSTONE;
break;
case REDSTONE:
this.commandBlockMode = TileEntityCommandBlock.Mode.SEQUENCE;
}
}
示例6: onReceiveClient
import net.minecraft.tileentity.TileEntityCommandBlock; //导入依赖的package包/类
@Override
public void onReceiveClient(Minecraft client, WorldClient world, EntityPlayerSP player, MessageContext context) {
BlockSystem blockSystem = BlockSystems.PROXY.getBlockSystemHandler(world).getBlockSystem(this.blockSystem);
if (blockSystem != null) {
if (blockSystem.isBlockLoaded(this.pos)) {
TileEntity blockEntity = blockSystem.getTileEntity(this.pos);
boolean commandBlock = this.type == 2 && blockEntity instanceof TileEntityCommandBlock;
if (this.type == 1 && blockEntity instanceof TileEntityMobSpawner || commandBlock || this.type == 3 && blockEntity instanceof TileEntityBeacon || this.type == 4 && blockEntity instanceof TileEntitySkull || this.type == 5 && blockEntity instanceof TileEntityFlowerPot || this.type == 6 && blockEntity instanceof TileEntityBanner || this.type == 7 && blockEntity instanceof TileEntityStructure || this.type == 8 && blockEntity instanceof TileEntityEndGateway || this.type == 9 && blockEntity instanceof TileEntitySign) {
blockEntity.readFromNBT(this.data);
} else {
blockEntity.onDataPacket(client.getConnection().getNetworkManager(), new SPacketUpdateTileEntity(this.pos, this.type, this.data));
}
if (commandBlock && client.currentScreen instanceof GuiCommandBlock) {
((GuiCommandBlock) client.currentScreen).updateGui();
}
}
}
}
示例7: setup
import net.minecraft.tileentity.TileEntityCommandBlock; //导入依赖的package包/类
private void setup(ICommandSender sender) {
this.sender = sender;
if (sender instanceof EntityPlayerMP) {
player = (EntityPlayerMP) sender;
}
if (sender instanceof TileEntity) {
user = new Coord((TileEntity) sender);
}
selected = currentSelection.get();
if (sender.canCommandSenderUseCommand(4, "stop")) {
op = true;
}
if (sender instanceof TileEntityCommandBlock) {
op = true;
}
if (op) {
creative = true;
}
}
示例8: doGen
import net.minecraft.tileentity.TileEntityCommandBlock; //导入依赖的package包/类
ColossalBuilder doGen(Coord at, int randSeed) {
Coord signAt = at.copy();
ColossalBuilder builder = new ColossalBuilder(randSeed, at);
builder.construct();
if (signAt.getTE(TileEntityCommandBlock.class) != null) {
signAt.set(BlockStandingSign.ROTATION, 12, true);
TileEntitySign sign = signAt.getTE(TileEntitySign.class);
if (sign != null) {
sign.signText[0] = new ChatComponentText("Colossus Seed");
sign.signText[1] = new ChatComponentText("" + randSeed);
signAt.markBlockForUpdate();
}
}
return builder;
}
示例9: handleUpdateTileEntity
import net.minecraft.tileentity.TileEntityCommandBlock; //导入依赖的package包/类
/**
* Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks,
* beacons, skulls, flowerpot
*/
public void handleUpdateTileEntity(SPacketUpdateTileEntity packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
if (this.gameController.theWorld.isBlockLoaded(packetIn.getPos()))
{
TileEntity tileentity = this.gameController.theWorld.getTileEntity(packetIn.getPos());
int i = packetIn.getTileEntityType();
boolean flag = i == 2 && tileentity instanceof TileEntityCommandBlock;
if (i == 1 && tileentity instanceof TileEntityMobSpawner || flag || i == 3 && tileentity instanceof TileEntityBeacon || i == 4 && tileentity instanceof TileEntitySkull || i == 5 && tileentity instanceof TileEntityFlowerPot || i == 6 && tileentity instanceof TileEntityBanner || i == 7 && tileentity instanceof TileEntityStructure || i == 8 && tileentity instanceof TileEntityEndGateway || i == 9 && tileentity instanceof TileEntitySign)
{
tileentity.readFromNBT(packetIn.getNbtCompound());
}
else
{
tileentity.onDataPacket(netManager, packetIn);
}
if (flag && this.gameController.currentScreen instanceof GuiCommandBlock)
{
((GuiCommandBlock)this.gameController.currentScreen).updateGui();
}
}
}
示例10: func_72468_a
import net.minecraft.tileentity.TileEntityCommandBlock; //导入依赖的package包/类
public void func_72468_a(Packet132TileEntityData p_72468_1_) {
if(this.field_72563_h.field_71441_e.func_72899_e(p_72468_1_.field_73334_a, p_72468_1_.field_73332_b, p_72468_1_.field_73333_c)) {
TileEntity var2 = this.field_72563_h.field_71441_e.func_72796_p(p_72468_1_.field_73334_a, p_72468_1_.field_73332_b, p_72468_1_.field_73333_c);
if(var2 != null) {
if(p_72468_1_.field_73330_d == 1 && var2 instanceof TileEntityMobSpawner) {
var2.func_70307_a(p_72468_1_.field_73331_e);
} else if(p_72468_1_.field_73330_d == 2 && var2 instanceof TileEntityCommandBlock) {
var2.func_70307_a(p_72468_1_.field_73331_e);
} else if(p_72468_1_.field_73330_d == 3 && var2 instanceof TileEntityBeacon) {
var2.func_70307_a(p_72468_1_.field_73331_e);
} else if(p_72468_1_.field_73330_d == 4 && var2 instanceof TileEntitySkull) {
var2.func_70307_a(p_72468_1_.field_73331_e);
}
}
}
}
示例11: processCommand
import net.minecraft.tileentity.TileEntityCommandBlock; //导入依赖的package包/类
@Override
public void processCommand(ICommandSender icommandsender, String[] astring)
{
if(icommandsender instanceof EntityPlayer) // If the sender is a player
{
ProcessPlayer((EntityPlayer) icommandsender, astring);
// Cast the sender into an EntityPlayer then call the ProcessPlayer method
}
else if(icommandsender instanceof TileEntityCommandBlock) // If the sender is a commandblock
{
ProcessCommandBlock((TileEntityCommandBlock) icommandsender, astring);
}
else // If it's the Server console
{
ProcessServerConsole(icommandsender, astring);
}
}
示例12: CraftCommandBlock
import net.minecraft.tileentity.TileEntityCommandBlock; //导入依赖的package包/类
public CraftCommandBlock(Block block) {
super(block);
CraftWorld world = (CraftWorld) block.getWorld();
commandBlock = (TileEntityCommandBlock) world.getTileEntityAt(getX(), getY(), getZ());
command = commandBlock.func_145993_a().field_145763_e;
name = commandBlock.func_145993_a().getCommandSenderName();
}
示例13: updateTick
import net.minecraft.tileentity.TileEntityCommandBlock; //导入依赖的package包/类
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
TileEntity tileentity = worldIn.getTileEntity(pos);
if (tileentity instanceof TileEntityCommandBlock)
{
((TileEntityCommandBlock)tileentity).getCommandBlockLogic().trigger(worldIn);
worldIn.updateComparatorOutputLevel(pos, this);
}
}
示例14: displayGuiCommandBlock
import net.minecraft.tileentity.TileEntityCommandBlock; //导入依赖的package包/类
@Override
public void displayGuiCommandBlock(TileEntityCommandBlock commandBlock) {
if (m_realPlayer == null) {
super.displayGuiCommandBlock(commandBlock);
} else {
syncToRealPlayer();
m_realPlayer.displayGuiCommandBlock(commandBlock);
syncPublicFieldsFromReal();
}
}
示例15: displayGuiCommandBlock
import net.minecraft.tileentity.TileEntityCommandBlock; //导入依赖的package包/类
@Override
public void displayGuiCommandBlock(TileEntityCommandBlock commandBlock) {
if (m_realPlayer == null) {
super.displayGuiCommandBlock(commandBlock);
} else {
m_realPlayer.displayGuiCommandBlock(commandBlock);
}
}