Java Code Examples for cpw.mods.fml.common.network.ByteBufUtils#readItemStack()

The following examples show how to use cpw.mods.fml.common.network.ByteBufUtils#readItemStack() . 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: PacketUpdateGui.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
public static Object readField(ByteBuf buf, int type){
    switch(type){
        case 0:
            return buf.readInt();
        case 1:
            return buf.readFloat();
        case 2:
            return buf.readDouble();
        case 3:
            return buf.readBoolean();
        case 4:
            return ByteBufUtils.readUTF8String(buf);
        case 5:
            return buf.readByte();
        case 6:
            return ByteBufUtils.readItemStack(buf);
        case 7:
            if(!buf.readBoolean()) return null;
            return new FluidStack(FluidRegistry.getFluid(ByteBufUtils.readUTF8String(buf)), buf.readInt(), ByteBufUtils.readTag(buf));
    }
    throw new IllegalArgumentException("Invalid sync type! " + type);
}
 
Example 2
Source File: MessageAutoChisel.java    From Chisel-2 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void fromBytes(ByteBuf buf) {
	super.fromBytes(buf);
	this.playSound = buf.readBoolean();
	this.breakChisel = buf.readBoolean();
	this.chiseled = buf.readInt();
	this.base = ByteBufUtils.readItemStack(buf);
}
 
Example 3
Source File: PacketSyncAmadronOffers.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
public static Object getFluidOrItemStack(ByteBuf buf){
    if(buf.readByte() == 0) {
        return ByteBufUtils.readItemStack(buf);
    } else {
        return new FluidStack(FluidRegistry.getFluid(ByteBufUtils.readUTF8String(buf)), buf.readInt(), ByteBufUtils.readTag(buf));
    }
}
 
Example 4
Source File: EntityLingeringEffect.java    From Et-Futurum with The Unlicense 4 votes vote down vote up
@Override
public void readSpawnData(ByteBuf buffer) {
	stack = ByteBufUtils.readItemStack(buffer);
}
 
Example 5
Source File: EntityLingeringPotion.java    From Et-Futurum with The Unlicense 4 votes vote down vote up
@Override
public void readSpawnData(ByteBuf buffer) {
	stack = ByteBufUtils.readItemStack(buffer);
}
 
Example 6
Source File: TileEntityCamoMine.java    From AdvancedMod with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void readFromPacket(ByteBuf buf){
    for(int i = 0; i < camoStacks.length; i++)
        camoStacks[i] = ByteBufUtils.readItemStack(buf);
    worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, yCoord, zCoord);
}
 
Example 7
Source File: MessageSlotUpdate.java    From Chisel-2 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void fromBytes(ByteBuf buf) {
	super.fromBytes(buf);
	this.slot = buf.readInt();
	this.stack = ByteBufUtils.readItemStack(buf);
}
 
Example 8
Source File: PacketSetLogisticsFilterStack.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void fromBytes(ByteBuf buf){
    super.fromBytes(buf);
    settingStack = ByteBufUtils.readItemStack(buf);
    settingIndex = buf.readInt();
}
 
Example 9
Source File: PacketUseItem.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void fromBytes(ByteBuf buffer){
    ItemStack stack = ByteBufUtils.readItemStack(buffer);
    item = stack.getItem();
    amount = stack.stackSize;
}
 
Example 10
Source File: PacketCommandGetGlobalVariableOutput.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void fromBytes(ByteBuf buf){
    varName = ByteBufUtils.readUTF8String(buf);
    pos = new ChunkPosition(buf.readInt(), buf.readInt(), buf.readInt());
    stack = ByteBufUtils.readItemStack(buf);
}