All pastes #242669 Raw Edit

Someone

public text v1 · immutable
·published 2006-11-07 15:38 UTC
rendered paste body
    	public void SpawnItem(int id)
    	{
    	    StaticPacketBuilder item = new StaticPacketBuilder();
    	    item.setID(109);
    	    item.addShort(id);
    	    item.addByte((byte)0);
    	    item.addByte((byte)0);
    	    
    	    player.getSession().write(item.toPacket());
    	}
    	protected byte[] getPositionOffsets(Point p) {
		    byte[] rv = new byte[2];
		    rv[0] = getCoordOffset(player.getX(), p.getX());
		    rv[1] = getCoordOffset(player.getY(), p.getY());
		    return rv;
	    }

	protected byte getCoordOffset(int coord1, int coord2) {
		byte offset;
		offset = (byte) (coord2 - coord1);
		if (offset < 0) {
			offset += 32;
		}
		return offset;
	}