Codota Logo
PacketWrapper.<init>
Code IndexAdd Codota to your IDE (free)

How to use
us.myles.ViaVersion.api.PacketWrapper
constructor

Best Java code snippets using us.myles.ViaVersion.api.PacketWrapper.<init> (Showing top 20 results out of 315)

  • Common ways to obtain PacketWrapper
private void myMethod () {
PacketWrapper p =
  • Codota IconViaVersion.api.data.UserConnection userConnection;new PacketWrapper(int1, null, userConnection)
  • Smart code suggestions by Codota
}
origin: MylesIsCool/ViaVersion

/**
 * Create a new packet for the target of this packet.
 *
 * @param packetID The ID of the new packet
 * @return The newly created packet wrapper
 */
public PacketWrapper create(int packetID) {
  return new PacketWrapper(packetID, null, user());
}
origin: Gerrygames/ViaRewind

  @Override
  public void despawn() {
    PacketWrapper despawn = new PacketWrapper(0x13, null, user);
    despawn.write(Type.VAR_INT_ARRAY, new Integer[] {entityId});

    PacketUtil.sendPacket(despawn, Protocol1_8TO1_9.class, true, true);
  }
}
origin: Gerrygames/ViaRewind

  @Override
  public void despawn() {
    PacketWrapper despawn = new PacketWrapper(0x13, null, user);
    despawn.write(Type.VAR_INT_ARRAY, new Integer[] {entityId});

    PacketUtil.sendPacket(despawn, Protocol1_8TO1_9.class, true, true);
  }
}
origin: Gerrygames/ViaRewind

private void despawnWither() {
  PacketWrapper packetWrapper = new PacketWrapper(0x13, null, this.connection);
  packetWrapper.write(Type.VAR_INT_ARRAY, new Integer[] {entityId});
  PacketUtil.sendPacket(packetWrapper, Protocol1_8TO1_9.class, true, true);
}
origin: Gerrygames/ViaRewind

public String removeTeamForScore(String score) {
  ScoreTeam scoreTeam = scoreTeams.remove(score);
  if (scoreTeam==null) return score;
  scoreTeamNames.remove(scoreTeam.name);
  PacketWrapper teamPacket = new PacketWrapper(0x3E, null, getUser());
  teamPacket.write(Type.STRING, scoreTeam.name);
  teamPacket.write(Type.BYTE, (byte) 1);
  PacketUtil.sendPacket(teamPacket, Protocol1_7_6_10TO1_8.class, true, true);
  return scoreTeam.name;
}
origin: Gerrygames/ViaRewind

private void updateMetadata() {
  PacketWrapper packetWrapper = new PacketWrapper(0x1C, null, this.connection);
  packetWrapper.write(Type.VAR_INT, entityId);
  List<Metadata> metadata = new ArrayList<>();
  metadata.add(new Metadata(2, MetaType1_8.String, title));
  metadata.add(new Metadata(6, MetaType1_8.Float, health * 300f));
  packetWrapper.write(Types1_8.METADATA_LIST, metadata);
  PacketUtil.sendPacket(packetWrapper, Protocol1_8TO1_9.class, true, true);
}
origin: MylesIsCool/ViaVersion

private void sendBlockChange(UserConnection user, Position position, int blockId) throws Exception {
  PacketWrapper wrapper = new PacketWrapper(0x0B, null, user);
  wrapper.write(Type.POSITION, position);
  wrapper.write(Type.VAR_INT, blockId);
  wrapper.send(Protocol1_13To1_12_2.class, true, true);
}
origin: Gerrygames/ViaRewind

private void hideTitle() {
  PacketWrapper hide = new PacketWrapper(0x45, null, getUser());
  hide.write(Type.VAR_INT, 3);
  PacketUtil.sendPacket(hide, Protocol1_8TO1_9.class);
}
origin: Gerrygames/ViaRewind

  public void despawn() {
    if (entityIds==null) return;
    PacketWrapper despawn = new PacketWrapper(0x13, null, user);
    despawn.write(Type.BYTE, (byte)entityIds.length);
    for (int id : entityIds) {
      despawn.write(Type.INT, id);
    }
    entityIds = null;
    PacketUtil.sendPacket(despawn, Protocol1_7_6_10TO1_8.class, true, true);
  }
}
origin: MylesIsCool/ViaVersion

public void setSecondHand(int entityID, Item item) {
  PacketWrapper wrapper = new PacketWrapper(0x3C, null, getUser());
  wrapper.write(Type.VAR_INT, entityID);
  wrapper.write(Type.VAR_INT, 1); // slot
  wrapper.write(Type.ITEM, item);
  try {
    wrapper.send(Protocol1_9TO1_8.class);
  } catch (Exception e) {
    e.printStackTrace();
  }
}
origin: MylesIsCool/ViaVersion

  private static void updateBlockEntity(Position pos, short id, CompoundTag tag, UserConnection connection) throws Exception {
    PacketWrapper wrapper = new PacketWrapper(0x09, null, connection);
    wrapper.write(Type.POSITION, pos);
    wrapper.write(Type.UNSIGNED_BYTE, id);
    wrapper.write(Type.NBT, tag);
    wrapper.send(Protocol1_9_1_2TO1_9_3_4.class, false);
  }
}
origin: Gerrygames/ViaRewind

  @Override
  public void despawn() {
    PacketWrapper despawn = new PacketWrapper(0x13, null, user);
    despawn.write(Type.BYTE, (byte) 1);
    despawn.write(new CustomIntType(1), new Integer[] {entityId});

    PacketUtil.sendPacket(despawn, Protocol1_7_6_10TO1_8.class, true, true);
  }
}
origin: Gerrygames/ViaRewind

private void sendActionBar(String bar) {
  PacketWrapper actionBarPacket = new PacketWrapper(0x02, null, getUser());
  actionBarPacket.write(Type.STRING, bar);
  actionBarPacket.write(Type.BYTE, (byte) 2);
  PacketUtil.sendPacket(actionBarPacket, Protocol1_8TO1_9.class);
}
origin: Gerrygames/ViaRewind

  @Override
  public void despawn() {
    PacketWrapper despawn = new PacketWrapper(0x13, null, user);
    despawn.write(Type.BYTE, (byte) 1);
    despawn.write(new CustomIntType(1), new Integer[] {entityId});

    PacketUtil.sendPacket(despawn, Protocol1_7_6_10TO1_8.class, true, true);
  }
}
origin: Gerrygames/ViaRewind

private void hideBossBar() {
  if (bossUUID==null) return;
  PacketWrapper wrapper = new PacketWrapper(0x0C, null, getUser());
  wrapper.write(Type.UUID, bossUUID);
  wrapper.write(Type.VAR_INT, 1);
  PacketUtil.sendPacket(wrapper, Protocol1_8TO1_9.class, false, true);
  bossUUID = null;
}
origin: Matsv/ViaBackwards

public void update() {
  PacketWrapper wrapper = new PacketWrapper(0x0F, null, getUser());
  wrapper.write(Type.STRING, Protocol1_9TO1_8.fixJson(generateString()));
  wrapper.write(Type.BYTE, (byte) 2);
  try {
    wrapper.send(Protocol1_12To1_11_1.class);
  } catch (Exception e) {
    ViaBackwards.getPlatform().getLogger().severe("Failed to send the shoulder indication");
    e.printStackTrace();
  }
}
origin: Gerrygames/ViaRewind

public void updateMetadata() {
  PacketWrapper metadataPacket = new PacketWrapper(0x1C, null, user);
  metadataPacket.write(Type.INT, entityId);
  List<Metadata> metadataList = new ArrayList<>();
  for (Metadata metadata : datawatcher) {
    if (metadata.getId()==16 || metadata.getId()==17) continue;
    metadataList.add(new Metadata(metadata.getId(), metadata.getMetaType(), metadata.getValue()));
  }
  MetadataRewriter.transform(Entity1_10Types.EntityType.SQUID, metadataList);
  metadataPacket.write(Types1_7_6_10.METADATA_LIST, metadataList);
  PacketUtil.sendPacket(metadataPacket, Protocol1_7_6_10TO1_8.class);
}
origin: MylesIsCool/ViaVersion

public void sendPermission(UserConnection user) throws Exception {
  if (!isEnabled())
    return;
  PacketWrapper wrapper = new PacketWrapper(0x1B, null, user); // Entity status
  wrapper.write(Type.INT, user.get(EntityTracker.class).getProvidedEntityId()); // Entity ID
  wrapper.write(Type.BYTE, (byte) 26); // Hardcoded op permission level
  wrapper.send(Protocol1_9TO1_8.class);
  user.get(CommandBlockStorage.class).setPermissions(true);
}
origin: Gerrygames/ViaRewind

public void updateLocation() {
  PacketWrapper teleport = new PacketWrapper(0x18, null, user);
  teleport.write(Type.VAR_INT, entityId);
  teleport.write(Type.INT, (int) (locX * 32.0));
  teleport.write(Type.INT, (int) (locY * 32.0));
  teleport.write(Type.INT, (int) (locZ * 32.0));
  teleport.write(Type.BYTE, (byte) 0);
  teleport.write(Type.BYTE, (byte) 0);
  teleport.write(Type.BOOLEAN, true);
  PacketUtil.sendPacket(teleport, Protocol1_8TO1_9.class, true, true);
}
origin: Gerrygames/ViaRewind

private void updateLocation() {
  PacketWrapper packetWrapper = new PacketWrapper(0x18, null, this.connection);
  packetWrapper.write(Type.VAR_INT, entityId);
  packetWrapper.write(Type.INT, (int) (locX * 32d));
  packetWrapper.write(Type.INT, (int) (locY * 32d));
  packetWrapper.write(Type.INT, (int) (locZ * 32d));
  packetWrapper.write(Type.BYTE, (byte)0);
  packetWrapper.write(Type.BYTE, (byte)0);
  packetWrapper.write(Type.BOOLEAN, false);
  PacketUtil.sendPacket(packetWrapper, Protocol1_8TO1_9.class, true, true);
}
us.myles.ViaVersion.apiPacketWrapper<init>

Popular methods of PacketWrapper

    Popular in Java

    • Updating database using SQL prepared statement
    • setRequestProperty (URLConnection)
    • runOnUiThread (Activity)
    • onRequestPermissionsResult (Fragment)
    • EOFException (java.io)
      Thrown when a program encounters the end of a file or stream during an input operation.
    • Proxy (java.net)
      This class represents proxy server settings. A created instance of Proxy stores a type and an addres
    • SocketException (java.net)
      This SocketException may be thrown during socket creation or setting options, and is the superclass
    • SocketTimeoutException (java.net)
      This exception is thrown when a timeout expired on a socket read or accept operation.
    • URLEncoder (java.net)
      This class is used to encode a string using the format required by application/x-www-form-urlencoded
    • UUID (java.util)
      UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
    Codota Logo
    • Products

      Search for Java codeSearch for JavaScript codeEnterprise
    • IDE Plugins

      IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
    • Company

      About UsContact UsCareers
    • Resources

      FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
    Get Codota for your IDE now