本文整理汇总了Java中net.minecraft.tileentity.TileEntity.getUpdatePacket方法的典型用法代码示例。如果您正苦于以下问题:Java TileEntity.getUpdatePacket方法的具体用法?Java TileEntity.getUpdatePacket怎么用?Java TileEntity.getUpdatePacket使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.tileentity.TileEntity
的用法示例。
在下文中一共展示了TileEntity.getUpdatePacket方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendTileEntityUpdate
import net.minecraft.tileentity.TileEntity; //导入方法依赖的package包/类
private void sendTileEntityUpdate(TileEntity p_147097_1_)
{
if (p_147097_1_ != null)
{
SPacketUpdateTileEntity spacketupdatetileentity = p_147097_1_.getUpdatePacket();
if (spacketupdatetileentity != null)
{
this.connection.sendPacket(spacketupdatetileentity);
}
}
}
示例2: sendBlockEntity
import net.minecraft.tileentity.TileEntity; //导入方法依赖的package包/类
private void sendBlockEntity(@Nullable TileEntity be)
{
if (be != null)
{
SPacketUpdateTileEntity spacketupdatetileentity = be.getUpdatePacket();
if (spacketupdatetileentity != null)
{
this.sendPacket(spacketupdatetileentity);
}
}
}
示例3: onBlockBreakEvent
import net.minecraft.tileentity.TileEntity; //导入方法依赖的package包/类
public static int onBlockBreakEvent(World world, GameType gameType, EntityPlayerMP entityPlayer, BlockPos pos)
{
// Logic from tryHarvestBlock for pre-canceling the event
boolean preCancelEvent = false;
if (gameType.isCreative() && entityPlayer.getHeldItemMainhand() != null && entityPlayer.getHeldItemMainhand().getItem() instanceof ItemSword)
preCancelEvent = true;
if (gameType.isAdventure())
{
if (gameType == GameType.SPECTATOR)
preCancelEvent = true;
if (!entityPlayer.isAllowEdit())
{
ItemStack itemstack = entityPlayer.getHeldItemMainhand();
if (itemstack == null || !itemstack.canDestroy(world.getBlockState(pos).getBlock()))
preCancelEvent = true;
}
}
// Tell client the block is gone immediately then process events
if (world.getTileEntity(pos) == null)
{
SPacketBlockChange packet = new SPacketBlockChange(world, pos);
packet.blockState = Blocks.AIR.getDefaultState();
entityPlayer.connection.sendPacket(packet);
}
// Post the block break event
IBlockState state = world.getBlockState(pos);
BlockEvent.BreakEvent event = new BlockEvent.BreakEvent(world, pos, state, entityPlayer);
event.setCanceled(preCancelEvent);
MinecraftForge.EVENT_BUS.post(event);
// Handle if the event is canceled
if (event.isCanceled())
{
// Let the client know the block still exists
entityPlayer.connection.sendPacket(new SPacketBlockChange(world, pos));
// Update any tile entity data for this block
TileEntity tileentity = world.getTileEntity(pos);
if (tileentity != null)
{
Packet<?> pkt = tileentity.getUpdatePacket();
if (pkt != null)
{
entityPlayer.connection.sendPacket(pkt);
}
}
}
return event.isCanceled() ? -1 : event.getExpToDrop();
}