本文整理汇总了Java中net.minecraft.world.WorldServer.isBlockLoaded方法的典型用法代码示例。如果您正苦于以下问题:Java WorldServer.isBlockLoaded方法的具体用法?Java WorldServer.isBlockLoaded怎么用?Java WorldServer.isBlockLoaded使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.world.WorldServer
的用法示例。
在下文中一共展示了WorldServer.isBlockLoaded方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processUpdateSign
import net.minecraft.world.WorldServer; //导入方法依赖的package包/类
public void processUpdateSign(C12PacketUpdateSign packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer());
this.playerEntity.markPlayerActive();
WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension);
BlockPos blockpos = packetIn.getPosition();
if (worldserver.isBlockLoaded(blockpos))
{
TileEntity tileentity = worldserver.getTileEntity(blockpos);
if (!(tileentity instanceof TileEntitySign))
{
return;
}
TileEntitySign tileentitysign = (TileEntitySign)tileentity;
if (!tileentitysign.getIsEditable() || tileentitysign.getPlayer() != this.playerEntity)
{
this.serverController.logWarning("Player " + this.playerEntity.getName() + " just tried to change non-editable sign");
return;
}
IChatComponent[] aichatcomponent = packetIn.getLines();
for (int i = 0; i < aichatcomponent.length; ++i)
{
tileentitysign.signText[i] = new ChatComponentText(EnumChatFormatting.getTextWithoutFormattingCodes(aichatcomponent[i].getUnformattedText()));
}
tileentitysign.markDirty();
worldserver.markBlockForUpdate(blockpos);
}
}
示例2: processUpdateSign
import net.minecraft.world.WorldServer; //导入方法依赖的package包/类
public void processUpdateSign(CPacketUpdateSign packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerWorld());
this.playerEntity.markPlayerActive();
WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension);
BlockPos blockpos = packetIn.getPosition();
if (worldserver.isBlockLoaded(blockpos))
{
IBlockState iblockstate = worldserver.getBlockState(blockpos);
TileEntity tileentity = worldserver.getTileEntity(blockpos);
if (!(tileentity instanceof TileEntitySign))
{
return;
}
TileEntitySign tileentitysign = (TileEntitySign)tileentity;
if (!tileentitysign.getIsEditable() || tileentitysign.getPlayer() != this.playerEntity)
{
this.serverController.logWarning("Player " + this.playerEntity.getName() + " just tried to change non-editable sign");
return;
}
String[] astring = packetIn.getLines();
for (int i = 0; i < astring.length; ++i)
{
tileentitysign.signText[i] = new TextComponentString(TextFormatting.getTextWithoutFormattingCodes(astring[i]));
}
tileentitysign.markDirty();
worldserver.notifyBlockUpdate(blockpos, iblockstate, iblockstate, 3);
}
}