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


Java PacketBuffer.readString方法代码示例

本文整理汇总了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);
}
 
开发者ID:ScriptyMod,项目名称:Scripty,代码行数:18,代码来源:ScriptyPacketContent.java

示例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 = "";
	}
}
 
开发者ID:raphydaphy,项目名称:ArcaneMagic,代码行数:17,代码来源:PacketNotebookChanged.java

示例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();
}
 
开发者ID:raphydaphy,项目名称:ArcaneMagic,代码行数:16,代码来源:PacketNotebookToastExpanded.java

示例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();
	}
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:82,代码来源:EntityStatue.java


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