Java Code Examples for net.minecraft.util.PacketByteBuf#readInt()

The following examples show how to use net.minecraft.util.PacketByteBuf#readInt() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FMLPlayMessages.java    From patchwork-api with GNU Lesser General Public License v2.1 6 votes vote down vote up
private SpawnEntity(PacketByteBuf buf) {
	this.entity = null;

	this.typeId = buf.readVarInt();
	this.entityId = buf.readInt();
	this.uuid = buf.readUuid();
	this.posX = buf.readDouble();
	this.posY = buf.readDouble();
	this.posZ = buf.readDouble();
	this.pitch = buf.readByte();
	this.yaw = buf.readByte();
	this.headYaw = buf.readByte();
	this.velX = buf.readShort();
	this.velY = buf.readShort();
	this.velZ = buf.readShort();

	this.buf = buf;
}
 
Example 2
Source File: FluidRecipeSerializer.java    From the-hallow with MIT License 5 votes vote down vote up
@Override
public FluidRecipe read(Identifier id, PacketByteBuf buf) {
	int size = buf.readInt();

	ArrayList<Ingredient> ingredients = new ArrayList<>();
	for(int i = 0; i < size; i++) {
		ingredients.add(Ingredient.fromPacket(buf));
	}

	return new FluidRecipe(ingredients, buf.readItemStack(), id, type, this);
}
 
Example 3
Source File: AddonS2CPacket.java    From Sandbox with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void read(PacketByteBuf var1) {
    count = var1.readInt();
    prefix = var1.readString(Short.MAX_VALUE);
    if (count > 0) {
        addons = new ArrayList<>();
    } else {
        addons = Collections.emptyList();
    }
    for (int i = 0; i < count; i++) {
        String suffix = var1.readString(Short.MAX_VALUE);
        String hash = var1.readString(Short.MAX_VALUE);
        addons.add(new Pair<>(suffix, hash));
    }
}
 
Example 4
Source File: VelocityUtil.java    From Sandbox with GNU Lesser General Public License v3.0 5 votes vote down vote up
private static void readProperties(final PacketByteBuf buf, final GameProfile profile) {
    if (buf.readableBytes() < 4)
        return;
    final int properties = buf.readInt();
    for (int i1 = 0; i1 < properties; i1++) {
        final String name = buf.readString(32767);
        final String value = buf.readString(32767);
        final String signature = buf.readBoolean() ? buf.readString(32767) : null;
        profile.getProperties().put(name, new Property(name, value, signature));
    }
}
 
Example 5
Source File: ContainerOpenPacket.java    From Sandbox with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void read(PacketByteBuf buf) {
    id = (Identity) buf.readIdentifier();
    syncId = buf.readInt();
    data = (CompoundTag) buf.readCompoundTag();
}