本文整理汇总了Java中net.minecraft.network.PacketBuffer.readString方法的典型用法代码示例。如果您正苦于以下问题:Java PacketBuffer.readString方法的具体用法?Java PacketBuffer.readString怎么用?Java PacketBuffer.readString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.network.PacketBuffer
的用法示例。
在下文中一共展示了PacketBuffer.readString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fromBytes
import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
@Override
public void fromBytes(ByteBuf buf) {
PacketBuffer buffer = new PacketBuffer(buf);
int x = buffer.readVarInt();
int y = buffer.readVarInt();
int z = buffer.readVarInt();
BlockPos pos = new BlockPos(x, y, z);
int contentLength = buffer.readVarInt();
String content = buffer.readString(contentLength);
int languageId = buffer.readByte();
boolean parsing = buffer.readBoolean();
ScriptLanguage language = ScriptLanguage.values()[languageId];
setContent(content);
setLanguage(language);
setPos(pos);
setParsing(parsing);
}
示例2: fromBytes
import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
@Override
public void fromBytes(ByteBuf buf)
{
PacketBuffer pbuf = new PacketBuffer(buf);
category = pbuf.readInt();
page = pbuf.readInt();
indexPage = pbuf.readInt();
usedNotebook = pbuf.readBoolean();
if (pbuf.readBoolean())
{
searchKey = pbuf.readString(1024);
} else
{
searchKey = "";
}
}
示例3: fromBytes
import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
@Override
public void fromBytes(ByteBuf buf)
{
PacketBuffer pbuf = new PacketBuffer(buf);
int id = buf.readInt();
if (id != -1)
{
cat = ArcaneMagicAPI.getNotebookCategories().get(id);
} else
{
cat = null;
}
additionalTag = pbuf.readString(1000);
showIfFail = buf.readBoolean();
}
示例4: 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();
}
}