本文整理汇总了Java中net.minecraft.network.PacketBuffer.readUniqueId方法的典型用法代码示例。如果您正苦于以下问题:Java PacketBuffer.readUniqueId方法的具体用法?Java PacketBuffer.readUniqueId怎么用?Java PacketBuffer.readUniqueId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.network.PacketBuffer
的用法示例。
在下文中一共展示了PacketBuffer.readUniqueId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readSpawnData
import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
@Override
public void readSpawnData(ByteBuf additionalData) {
if(additionalData.readableBytes() == 0)
return;
try {
PacketBuffer buff = new PacketBuffer(additionalData);
if(buff.readBoolean()) {
profile = new GameProfile(buff.readUniqueId(), buff.readString(16));
int l = buff.readVarInt();
int i1 = 0;
for (; i1 < l; ++i1)
{
String s = buff.readString(32767);
String s1 = buff.readString(32767);
if (buff.readBoolean())
{
profile.getProperties().put(s, new Property(s, s1, buff.readString(32767)));
}
else
{
profile.getProperties().put(s, new Property(s, s1));
}
}
final NetworkPlayerInfo info = new NetworkPlayerInfo(profile);
this.entity = new EntityOtherPlayerMP(world, profile) {
@Nullable
protected NetworkPlayerInfo getPlayerInfo()
{
return info;
}
};
this.entity.readFromNBT(buff.readCompoundTag());
/*TF2EventsCommon.THREAD_POOL.submit(()->{
if (profile.getId() != null)
cap.skinType = DefaultPlayerSkin.getSkinType(profile.getId());
Minecraft.getMinecraft().getSkinManager().loadProfileTextures(profile,
new SkinManager.SkinAvailableCallback() {
@Override
public void skinAvailable(Type typeIn, ResourceLocation location,
MinecraftProfileTexture profileTexture) {
if (typeIn == Type.SKIN) {
if (typeIn == Type.SKIN)
cap.skinDisguise = location;
cap.skinType = profileTexture.getMetadata("model");
if (cap.skinType == null)
cap.skinType = "default";
}
}
}, false);
});*/
}
else
this.entity = (EntityLivingBase) EntityList.createEntityFromNBT(buff.readCompoundTag(), this.world);
if(this.entity == null) {
this.setDead();
return;
}
this.entity.deathTime = 0;
this.entity.hurtTime = 0;
this.entity.limbSwingAmount = 0.5f;
this.entity.ticksExisted = 15;
this.entity.limbSwing += this.rand.nextFloat()*10;
this.setSize(this.entity.width, this.entity.height);
this.entity.setPosition(this.posX, this.posY, this.posZ);
//this.prevRotationYaw = this.entity.prevRotationYaw;
//this.rotationYaw = this.entity.rotationYaw;
this.entity.rotationYawHead = this.rotationYaw;
this.entity.renderYawOffset = this.rotationYaw;
this.entity.prevRenderYawOffset = this.rotationYaw;
if (buff.readBoolean()) {
WeaponsCapability.get(this.entity).state = 1;
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}