当前位置: 首页>>代码示例>>Java>>正文


Java Packet24MobSpawn.getMetadata方法代码示例

本文整理汇总了Java中net.minecraft.network.packet.Packet24MobSpawn.getMetadata方法的典型用法代码示例。如果您正苦于以下问题:Java Packet24MobSpawn.getMetadata方法的具体用法?Java Packet24MobSpawn.getMetadata怎么用?Java Packet24MobSpawn.getMetadata使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.network.packet.Packet24MobSpawn的用法示例。


在下文中一共展示了Packet24MobSpawn.getMetadata方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleMobSpawn

import net.minecraft.network.packet.Packet24MobSpawn; //导入方法依赖的package包/类
public void handleMobSpawn(Packet24MobSpawn par1Packet24MobSpawn)
{
    double d0 = (double)par1Packet24MobSpawn.xPosition / 32.0D;
    double d1 = (double)par1Packet24MobSpawn.yPosition / 32.0D;
    double d2 = (double)par1Packet24MobSpawn.zPosition / 32.0D;
    float f = (float)(par1Packet24MobSpawn.yaw * 360) / 256.0F;
    float f1 = (float)(par1Packet24MobSpawn.pitch * 360) / 256.0F;
    EntityLivingBase entitylivingbase = (EntityLivingBase)EntityList.createEntityByID(par1Packet24MobSpawn.type, this.mc.theWorld);
    entitylivingbase.serverPosX = par1Packet24MobSpawn.xPosition;
    entitylivingbase.serverPosY = par1Packet24MobSpawn.yPosition;
    entitylivingbase.serverPosZ = par1Packet24MobSpawn.zPosition;
    entitylivingbase.rotationYawHead = (float)(par1Packet24MobSpawn.headYaw * 360) / 256.0F;
    Entity[] aentity = entitylivingbase.getParts();

    if (aentity != null)
    {
        int i = par1Packet24MobSpawn.entityId - entitylivingbase.entityId;

        for (int j = 0; j < aentity.length; ++j)
        {
            aentity[j].entityId += i;
        }
    }

    entitylivingbase.entityId = par1Packet24MobSpawn.entityId;
    entitylivingbase.setPositionAndRotation(d0, d1, d2, f, f1);
    entitylivingbase.motionX = (double)((float)par1Packet24MobSpawn.velocityX / 8000.0F);
    entitylivingbase.motionY = (double)((float)par1Packet24MobSpawn.velocityY / 8000.0F);
    entitylivingbase.motionZ = (double)((float)par1Packet24MobSpawn.velocityZ / 8000.0F);
    this.worldClient.addEntityToWorld(par1Packet24MobSpawn.entityId, entitylivingbase);
    List list = par1Packet24MobSpawn.getMetadata();

    if (list != null)
    {
        entitylivingbase.getDataWatcher().updateWatchedObjectsFromList(list);
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:38,代码来源:NetClientHandler.java


注:本文中的net.minecraft.network.packet.Packet24MobSpawn.getMetadata方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。