use of net.minecraft.network.PacketByteBuf in project Biome-Makeover by Lemonszz.
the class NetworkUtil method doLightningSplash.
public static void doLightningSplash(World world, boolean doBottle, BlockPos pos) {
if (world.isClient)
return;
PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer());
buf.writeBoolean(doBottle);
buf.writeBlockPos(pos);
serverSendTracking(world, pos, BMNetwork.SPAWN_LIGHTNING_BOTTLE_PARTICLES, buf);
}
use of net.minecraft.network.PacketByteBuf in project LevelZ by Globox1997.
the class PlayerStatsClientPacket method writeC2SIncreaseLevelPacket.
public static void writeC2SIncreaseLevelPacket(PlayerStatsManager playerStatsManager, String string) {
playerStatsManager.setLevel(string, playerStatsManager.getLevel(string) + 1);
playerStatsManager.setLevel("points", playerStatsManager.getLevel("points") - 1);
PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer());
buf.writeString(string);
buf.writeInt(playerStatsManager.getLevel(string));
CustomPayloadC2SPacket packet = new CustomPayloadC2SPacket(PlayerStatsServerPacket.STATS_INCREASE_PACKET, buf);
MinecraftClient.getInstance().getNetworkHandler().sendPacket(packet);
}
use of net.minecraft.network.PacketByteBuf in project LevelZ by Globox1997.
the class PlayerStatsServerPacket method writeS2CXPPacket.
public static void writeS2CXPPacket(PlayerStatsManager playerStatsManager, ServerPlayerEntity serverPlayerEntity) {
PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer());
buf.writeFloat(playerStatsManager.levelProgress);
buf.writeInt(playerStatsManager.totalLevelExperience);
buf.writeInt(playerStatsManager.getLevel("level"));
CustomPayloadS2CPacket packet = new CustomPayloadS2CPacket(XP_PACKET, buf);
serverPlayerEntity.networkHandler.sendPacket(packet);
}
use of net.minecraft.network.PacketByteBuf in project LevelZ by Globox1997.
the class PlayerStatsServerPacket method writeS2CListPacket.
public static void writeS2CListPacket(ServerPlayerEntity serverPlayerEntity) {
PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer());
for (int i = 0; i < LevelLists.getListNames().size(); i++) {
String listName = LevelLists.getListNames().get(i);
ArrayList<Object> list = LevelLists.getList(listName);
for (int u = 0; u < list.size(); u++) {
buf.writeString(list.get(u).toString());
}
}
for (int k = 0; k < LevelLists.miningLevelList.size(); k++) {
buf.writeString("mining:level");
buf.writeString(LevelLists.miningLevelList.get(k).toString());
for (int u = 0; u < LevelLists.miningBlockList.get(k).size(); u++) {
buf.writeString(LevelLists.miningBlockList.get(k).get(u).toString());
}
}
for (int k = 0; k < LevelLists.brewingLevelList.size(); k++) {
buf.writeString("brewing:level");
buf.writeString(LevelLists.brewingLevelList.get(k).toString());
for (int u = 0; u < LevelLists.brewingItemList.get(k).size(); u++) {
buf.writeString(LevelLists.brewingItemList.get(k).get(u).toString());
}
}
CustomPayloadS2CPacket packet = new CustomPayloadS2CPacket(LIST_PACKET, buf);
serverPlayerEntity.networkHandler.sendPacket(packet);
}
use of net.minecraft.network.PacketByteBuf in project LevelZ by Globox1997.
the class PlayerStatsServerPacket method writeS2CStrengthPacket.
public static void writeS2CStrengthPacket(ServerPlayerEntity serverPlayerEntity) {
PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer());
buf.writeDouble(serverPlayerEntity.getAttributeInstance(EntityAttributes.GENERIC_ATTACK_DAMAGE).getBaseValue());
CustomPayloadS2CPacket packet = new CustomPayloadS2CPacket(STRENGTH_PACKET, buf);
serverPlayerEntity.networkHandler.sendPacket(packet);
}
Aggregations