Java Code Examples for io.netty.buffer.ByteBuf.readInt()

The following are Jave code examples for showing how to use readInt() of the io.netty.buffer.ByteBuf class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: jeesupport   File: CommandService.java   Source Code and License Vote up 6 votes
@Override
public void request( ChannelHandlerContext _ctx , ByteBuf _request ) {
	final int		UserLogin = 1;
	final int		UserRegist = 2;
	int cmd = _request.readInt();
	logger.info( "CommandService do command: CMD=[" + cmd + "]" );
	ByteBuf response = _ctx.alloc().buffer();
	
	//根据cmd来识别使用哪个模块来处理,
	switch( cmd ){
		case UserLogin:
			demoModel.requestLogin( _request, response );
			break;
		case UserRegist:
			demoModel.requestRegist( _request, response );
			break;
	}
	
	response( _ctx, response );
}
 
Example 2
Project: ObsidianSuite   File: MessageAnimationStart.java   Source Code and License Vote up 5 votes
@Override
public void fromBytes(ByteBuf buf) {
	entityID = buf.readInt();
	animationName = ByteBufUtils.readUTF8String(buf);
	loopAnim = buf.readBoolean();
	transitionTime = buf.readFloat();
}
 
Example 3
Project: Proyecto-DASI   File: ObservationFromServer.java   Source Code and License Vote up 5 votes
@Override
public final void fromBytes(ByteBuf buf)
{

	this.id = buf.readInt();
	restoreState(buf);
}
 
Example 4
Project: uniquecrops   File: PacketUCEffect.java   Source Code and License Vote up 5 votes
@Override
public void fromBytes(ByteBuf buf) {

	type = EnumParticleTypes.values()[buf.readShort()];
	x = buf.readDouble();
	y = buf.readDouble();
	z = buf.readDouble();
	loopSize = buf.readInt();
}
 
Example 5
Project: MineCamera   File: MessageFailLoadImage.java   Source Code and License Vote up 5 votes
@Override
public void fromBytes(ByteBuf buf) {
	type=EnumFailLoadImage.values()[buf.readInt()];
	int imagenamelength = buf.readInt();
	byte imagenamebyte[] = new byte[imagenamelength];
	buf.readBytes(imagenamebyte);
	imagename = new String(imagenamebyte);
}
 
Example 6
Project: interactionwheel   File: PackedInventoriesToClient.java   Source Code and License Vote up 5 votes
@Override
public void fromBytes(ByteBuf buf) {
    int size = buf.readInt();
    positions = new HashSet<>(size);
    for (int i = 0 ; i < size ; i++) {
        positions.add(NetworkTools.readPos(buf));
    }
}
 
Example 7
Project: SimpleTubes   File: PacketItemSync.java   Source Code and License Vote up 5 votes
@Override
public void fromBytes(ByteBuf buf) {
	int dim = buf.readInt();
	BlockPos pos = BlockPos.fromLong(buf.readLong());

	World world = SimpleTubes.proxy.getWorld(dim);
	if(world != null)
	this.tile = world.getTileEntity(pos);

	this.id = buf.readInt();
	this.progress = buf.readFloat();
	this.direction = buf.readByte();
	this.color = buf.readInt();
}
 
Example 8
Project: Proyecto-DASI   File: ObservationFromServer.java   Source Code and License Vote up 5 votes
@Override
public final void fromBytes(ByteBuf buf)
{

	this.id = buf.readInt();
	restoreState(buf);
}
 
Example 9
Project: ToolBelt   File: BeltContentsChange.java   Source Code and License Vote up 5 votes
@Override
public void fromBytes(ByteBuf buf)
{
    player = buf.readInt();
    where = ContainingInventory.VALUES[buf.readByte()];
    slot = buf.readByte();
    stack = ByteBufUtils.readItemStack(buf);
}
 
Example 10
Project: MeeCreeps   File: PacketSetDestination.java   Source Code and License Vote up 5 votes
@Override
public void fromBytes(ByteBuf buf) {
    destination = new TeleportDestination(NetworkTools.readStringUTF8(buf), buf.readInt(),
            BlockPos.fromLong(buf.readLong()),
            EnumFacing.VALUES[buf.readByte()]);
    destinationIndex = buf.readInt();
}
 
Example 11
Project: pnc-repressurized   File: PacketGuiButton.java   Source Code and License Vote up 4 votes
@Override
public void fromBytes(ByteBuf buffer) {
    buttonID = buffer.readInt();
}
 
Example 12
Project: interactionwheel   File: NetworkTools.java   Source Code and License Vote up 4 votes
public static <T extends Enum> T readEnum(ByteBuf buf, T[] values) {
    return values[buf.readInt()];
}
 
Example 13
Project: mc-XPBox   File: MessageOp.java   Source Code and License Vote up 4 votes
@Override
public void fromBytes(ByteBuf buf) {
   op = buf.readInt();
   xp = buf.readInt();
}
 
Example 14
Project: HazardsLib   File: MsgSyncRadiation.java   Source Code and License Vote up 4 votes
@Override
public void fromBytes(ByteBuf buffer) {
	radiation = buffer.readInt();
}
 
Example 15
Project: harshencastle   File: MessagePacketUpdateComplexEntity.java   Source Code and License Vote up 4 votes
@Override
public void fromBytes(ByteBuf buf)
{
	this.compound = ByteBufUtils.readTag(buf);
	this.entityId = buf.readInt();
}
 
Example 16
Project: pnc-repressurized   File: PacketSetMobTarget.java   Source Code and License Vote up 4 votes
@Override
public void fromBytes(ByteBuf buffer) {
    mobId = buffer.readInt();
    targetId = buffer.readInt();
}
 
Example 17
Project: HardcoreRevival   File: MessageRevivalProgress.java   Source Code and License Vote up 4 votes
@Override
public void fromBytes(ByteBuf buf) {
	entityId = buf.readInt();
	progress = buf.readFloat();
}
 
Example 18
Project: CreeperHostGui   File: PacketHandler.java   Source Code and License Vote up 4 votes
@Override
public void fromBytes(ByteBuf buf)
{
    serverID = buf.readInt();
}
 
Example 19
Project: CentauriCloud   File: PacketRequestConsole.java   Source Code and License Vote up 4 votes
@Override
public void decode(ByteBuf buf) {
	from = buf.readInt();
	to = buf.readInt();
}
 
Example 20
Project: MineDonate   File: ShopInfo.java   Source Code and License Vote up 3 votes
@Override
public void read ( ByteBuf buf ) {
	
    try {
    	
    	merch_id = buf . readInt ( ) ;
        shopId = buf . readInt ( ) ;
        
        owner = Utils . netReadString ( buf ) ;      
        ownerName = Utils . netReadString ( buf ) ;   
        name = Utils . netReadString ( buf ) ;

        isFreezed = buf.readBoolean();
        canVisibleFreezedText = buf . readBoolean ( ) ;

        if ( isFreezed && canVisibleFreezedText ) {
            
        	freezer = Utils . netReadString ( buf ) ;          
        	freezReason = Utils . netReadString ( buf ) ;
            
        }
                    
        moneyType = Utils . netReadString ( buf ) ;
        
    } catch ( Exception ex ) {
    	
    	ex . printStackTrace ( ) ; 
    	
    }
    
    if ( isFreezed ) {
    	
    	rating = -1 ;
    	
    }
    
}