net.minecraft.network.play.client.C17PacketCustomPayload Java Examples

The following examples show how to use net.minecraft.network.play.client.C17PacketCustomPayload. 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: MixinNetHandlerPlayClient.java    From LiquidBounce with GNU General Public License v3.0 6 votes vote down vote up
@Inject(method = "handleJoinGame", at = @At("HEAD"), cancellable = true)
private void handleJoinGameWithAntiForge(S01PacketJoinGame packetIn, final CallbackInfo callbackInfo) {
    if(!AntiForge.enabled || !AntiForge.blockFML || Minecraft.getMinecraft().isIntegratedServerRunning())
        return;

    PacketThreadUtil.checkThreadAndEnqueue(packetIn, (NetHandlerPlayClient) (Object) this, gameController);
    this.gameController.playerController = new PlayerControllerMP(gameController, (NetHandlerPlayClient) (Object) this);
    this.clientWorldController = new WorldClient((NetHandlerPlayClient) (Object) this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), packetIn.getDimension(), packetIn.getDifficulty(), this.gameController.mcProfiler);
    this.gameController.gameSettings.difficulty = packetIn.getDifficulty();
    this.gameController.loadWorld(this.clientWorldController);
    this.gameController.thePlayer.dimension = packetIn.getDimension();
    this.gameController.displayGuiScreen(new GuiDownloadTerrain((NetHandlerPlayClient) (Object) this));
    this.gameController.thePlayer.setEntityId(packetIn.getEntityId());
    this.currentServerMaxPlayers = packetIn.getMaxPlayers();
    this.gameController.thePlayer.setReducedDebug(packetIn.isReducedDebugInfo());
    this.gameController.playerController.setGameType(packetIn.getGameType());
    this.gameController.gameSettings.sendSettingsToServer();
    this.netManager.sendPacket(new C17PacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(ClientBrandRetriever.getClientModName())));
    callbackInfo.cancel();
}
 
Example #2
Source File: CarpenterOpener.java    From ehacks-pro with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onMouse(MouseEvent event) {
    try {
        MovingObjectPosition position = Wrapper.INSTANCE.mc().objectMouseOver;
        if (position.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && Mouse.isButtonDown(1)) {
            if (event.isCancelable()) {
                event.setCanceled(true);
            }
            ByteBuf buf = Unpooled.buffer(0);
            buf.writeInt(0);
            buf.writeInt(position.blockX);
            buf.writeInt(position.blockY);
            buf.writeInt(position.blockZ);
            buf.writeInt(position.sideHit);
            C17PacketCustomPayload packet = new C17PacketCustomPayload("CarpentersBlocks", buf);
            Wrapper.INSTANCE.player().sendQueue.addToSendQueue(packet);
        }
    } catch (Exception e) {

    }
}
 
Example #3
Source File: PipeGive.java    From ehacks-pro with GNU General Public License v3.0 6 votes vote down vote up
public void setSlot(int x, int y, int z) throws Exception {
    ByteBuf buf = Unpooled.buffer(0);
    buf.writeShort(0);
    buf.writeInt(x);
    buf.writeShort(y);
    buf.writeInt(z);
    Class.forName("buildcraft.core.Box").getMethod("writeData", ByteBuf.class).invoke(Class.forName("buildcraft.core.Box").getConstructor().newInstance(), buf);
    buf.writeByte(2);
    try {
        Class.forName("buildcraft.core.lib.utils.NetworkUtils").getMethod("writeStack", ByteBuf.class, ItemStack.class).invoke(null, buf, Statics.STATIC_ITEMSTACK);
    } catch (Exception ex) {
        Class.forName("buildcraft.core.utils.Utils").getMethod("writeStack", ByteBuf.class, ItemStack.class).invoke(null, buf, Statics.STATIC_ITEMSTACK);
    }
    C17PacketCustomPayload packet = new C17PacketCustomPayload("BC-CORE", buf);
    Wrapper.INSTANCE.player().sendQueue.addToSendQueue(packet);
}
 
Example #4
Source File: ExtendedDestroyer.java    From ehacks-pro with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onMouse(MouseEvent event) {
    try {
        MovingObjectPosition position = Wrapper.INSTANCE.mc().objectMouseOver;
        boolean nowState = Mouse.isButtonDown(0);
        if (position.sideHit != -1 && nowState && !prevState) {
            ByteBuf buf = Unpooled.buffer(0);
            buf.writeByte(14);
            buf.writeInt(position.blockX);
            buf.writeInt(position.blockY);
            buf.writeInt(position.blockZ);
            C17PacketCustomPayload packet = new C17PacketCustomPayload("cfm", buf);
            Wrapper.INSTANCE.player().sendQueue.addToSendQueue(packet);
        }
        prevState = nowState;
    } catch (Exception ignored) {

    }
}
 
Example #5
Source File: ItemCreator.java    From ehacks-pro with GNU General Public License v3.0 6 votes vote down vote up
public void giveItem(ItemStack stack) {
    ByteBuf buf = Unpooled.buffer(0);
    buf.writeByte(10);

    ItemStack mail = new ItemStack(Items.stick);
    NBTTagList tagList = new NBTTagList();

    for (int i = 0; i < 6; i++) {
        NBTTagCompound item = new NBTTagCompound();
        item.setByte("Slot", (byte) i);
        stack.writeToNBT(item);
        tagList.appendTag(item);
    }

    NBTTagCompound inv = new NBTTagCompound();
    inv.setTag("Items", tagList);
    inv.setString("UniqueID", UUID.randomUUID().toString());
    mail.stackTagCompound = new NBTTagCompound();
    mail.stackTagCompound.setTag("Package", inv);
    ByteBufUtils.writeItemStack(buf, mail);
    C17PacketCustomPayload packet = new C17PacketCustomPayload("cfm", buf);
    Wrapper.INSTANCE.player().sendQueue.addToSendQueue(packet);
}
 
Example #6
Source File: MagicGive.java    From ehacks-pro with GNU General Public License v3.0 6 votes vote down vote up
public void createSpell() {
    MovingObjectPosition mop = Wrapper.INSTANCE.mc().objectMouseOver;
    if (mop.sideHit == -1) {
        return;
    }
    ByteBuf buf = Unpooled.buffer(0);
    buf.writeByte(36);
    buf.writeInt(mop.blockX);
    buf.writeInt(mop.blockY);
    buf.writeInt(mop.blockZ);
    buf.writeByte(2);
    buf.writeInt(Wrapper.INSTANCE.player().getEntityId());
    C17PacketCustomPayload packet = new C17PacketCustomPayload("AM2DataTunnel", buf);
    Wrapper.INSTANCE.player().sendQueue.addToSendQueue(packet);
    InteropUtils.log("Gived", this);
}
 
Example #7
Source File: NanoNikProtector.java    From ehacks-pro with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean isPacketOk(Object packet, PacketHandler.Side side) {
    try {
        if (packet instanceof C17PacketCustomPayload && "nGuard".equals(((C17PacketCustomPayload) packet).func_149559_c()) && side == PacketHandler.Side.OUT) {
            ByteBuf buf = Unpooled.copiedBuffer(((C17PacketCustomPayload) packet).func_149558_e());
            DataInputStream is = new DataInputStream(new ByteBufInputStream(buf));
            String data = is.readUTF();
            String aim = data.split(";")[0];
            if (data.split(";")[1].equals("https://i.imgur.com/BqOhWwR.png")) {
                return true;
            }
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            DataOutputStream outputStream = new DataOutputStream(bos);
            outputStream.writeUTF(aim + ";https://i.imgur.com/BqOhWwR.png");
            Wrapper.INSTANCE.player().sendQueue.addToSendQueue(new C17PacketCustomPayload("nGuard", bos.toByteArray()));
            InteropUtils.log(String.format("You have been screened with aim: '%s'; Admins have been flek$$ed!", aim), "NanoNikGuard");
            return false;
        } else {
            return true;
        }
    } catch (Exception e) {
        return false;
    }
}
 
Example #8
Source File: NoLimitDamage.java    From ehacks-pro with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onMouse(MouseEvent event) {
    if (Wrapper.INSTANCE.mc().objectMouseOver.entityHit != null && event.button == 0 && !lastPressed) {
        int playerId = Wrapper.INSTANCE.player().getEntityId();
        int entityId = Wrapper.INSTANCE.mc().objectMouseOver.entityHit.getEntityId();
        int dimensionId = Wrapper.INSTANCE.player().dimension;
        ByteBuf buf = Unpooled.buffer(0);
        buf.writeByte(0);
        buf.writeInt(entityId);
        buf.writeInt(playerId);
        buf.writeInt(dimensionId);
        buf.writeFloat(Float.MAX_VALUE);
        buf.writeBoolean(false);
        C17PacketCustomPayload packet = new C17PacketCustomPayload("taintedmagic", buf);
        Wrapper.INSTANCE.player().sendQueue.addToSendQueue(packet);
        lastPressed = true;
    }
    if (lastPressed && event.button == 0 && !event.buttonstate) {
        lastPressed = false;
    }
}
 
Example #9
Source File: MixinNetHandlerPlayClient.java    From LiquidBounce with GNU General Public License v3.0 6 votes vote down vote up
@Inject(method = "handleJoinGame", at = @At("HEAD"), cancellable = true)
private void handleJoinGameWithAntiForge(S01PacketJoinGame packetIn, final CallbackInfo callbackInfo) {
    if(!AntiForge.enabled || !AntiForge.blockFML || Minecraft.getMinecraft().isIntegratedServerRunning())
        return;

    PacketThreadUtil.checkThreadAndEnqueue(packetIn, (NetHandlerPlayClient) (Object) this, gameController);
    this.gameController.playerController = new PlayerControllerMP(gameController, (NetHandlerPlayClient) (Object) this);
    this.clientWorldController = new WorldClient((NetHandlerPlayClient) (Object) this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), packetIn.getDimension(), packetIn.getDifficulty(), this.gameController.mcProfiler);
    this.gameController.gameSettings.difficulty = packetIn.getDifficulty();
    this.gameController.loadWorld(this.clientWorldController);
    this.gameController.thePlayer.dimension = packetIn.getDimension();
    this.gameController.displayGuiScreen(new GuiDownloadTerrain((NetHandlerPlayClient) (Object) this));
    this.gameController.thePlayer.setEntityId(packetIn.getEntityId());
    this.currentServerMaxPlayers = packetIn.getMaxPlayers();
    this.gameController.thePlayer.setReducedDebug(packetIn.isReducedDebugInfo());
    this.gameController.playerController.setGameType(packetIn.getGameType());
    this.gameController.gameSettings.sendSettingsToServer();
    this.netManager.sendPacket(new C17PacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(ClientBrandRetriever.getClientModName())));
    callbackInfo.cancel();
}
 
Example #10
Source File: AntiForge.java    From LiquidBounce with GNU General Public License v3.0 6 votes vote down vote up
@EventTarget
public void onPacket(PacketEvent event) {
    final Packet<?> packet = event.getPacket();

    if (enabled && !mc.isIntegratedServerRunning()) {
        try {
            if(blockProxyPacket && packet.getClass().getName().equals("net.minecraftforge.fml.common.network.internal.FMLProxyPacket"))
                event.cancelEvent();

            if(blockPayloadPackets && packet instanceof C17PacketCustomPayload) {
                final C17PacketCustomPayload customPayload = (C17PacketCustomPayload) packet;

                if(!customPayload.getChannelName().startsWith("MC|"))
                    event.cancelEvent();
                else if(customPayload.getChannelName().equalsIgnoreCase("MC|Brand"))
                    customPayload.data = (new PacketBuffer(Unpooled.buffer()).writeString("vanilla"));
            }
        }catch(final Exception e) {
            e.printStackTrace();
        }
    }
}
 
Example #11
Source File: LimitedAura.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
public void killEntity(int entityId) {
    int playerId = Wrapper.INSTANCE.player().getEntityId();
    int dimensionId = Wrapper.INSTANCE.player().dimension;
    ByteBuf buf = Unpooled.buffer(0);
    buf.writeByte(0);
    buf.writeInt(entityId);
    buf.writeInt(playerId);
    buf.writeInt(dimensionId);
    buf.writeFloat(Float.MAX_VALUE);
    buf.writeBoolean(false);
    C17PacketCustomPayload packet = new C17PacketCustomPayload("taintedmagic", buf);
    Wrapper.INSTANCE.player().sendQueue.addToSendQueue(packet);
}
 
Example #12
Source File: NoLimitAura.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
public void killEntity(int entityId) {
    int playerId = Wrapper.INSTANCE.player().getEntityId();
    int dimensionId = Wrapper.INSTANCE.player().dimension;
    ByteBuf buf = Unpooled.buffer(0);
    buf.writeByte(0);
    buf.writeInt(entityId);
    buf.writeInt(playerId);
    buf.writeInt(dimensionId);
    buf.writeFloat(Float.MAX_VALUE);
    buf.writeBoolean(false);
    C17PacketCustomPayload packet = new C17PacketCustomPayload("taintedmagic", buf);
    Wrapper.INSTANCE.player().sendQueue.addToSendQueue(packet);
}
 
Example #13
Source File: MagicGod.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
private void doGive(String a1, String a2) {
    ByteBuf buf = Unpooled.buffer(0);
    buf.writeByte(13);
    buf.writeInt(Wrapper.INSTANCE.player().dimension);
    buf.writeInt(Wrapper.INSTANCE.player().getEntityId());
    buf.writeInt(0);
    buf.writeInt(0);
    buf.writeInt(0);
    ByteBufUtils.writeUTF8String(buf, a1);
    ByteBufUtils.writeUTF8String(buf, a2);
    buf.writeBoolean(true);
    buf.writeBoolean(true);
    C17PacketCustomPayload packet = new C17PacketCustomPayload("thaumcraft", buf);
    Wrapper.INSTANCE.player().sendQueue.addToSendQueue(packet);
}
 
Example #14
Source File: ResearchGod.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
private void doResearch(String researchId) {
    ByteBuf buf = Unpooled.buffer(0);
    buf.writeByte(14);
    ByteBufUtils.writeUTF8String(buf, researchId);
    buf.writeInt(Wrapper.INSTANCE.player().dimension);
    ByteBufUtils.writeUTF8String(buf, Wrapper.INSTANCE.player().getCommandSenderName());
    buf.writeByte(0);
    C17PacketCustomPayload packet = new C17PacketCustomPayload("thaumcraft", buf);
    Wrapper.INSTANCE.player().sendQueue.addToSendQueue(packet);
}
 
Example #15
Source File: NoLimitSpin.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
public void spinEntity(int entityId) {
    ByteBuf buf = Unpooled.buffer(0);
    buf.writeByte(1);
    buf.writeInt(entityId);
    buf.writeFloat(R.nextFloat() * 180f - 90f);
    buf.writeFloat(R.nextFloat() * 360f);
    C17PacketCustomPayload packet = new C17PacketCustomPayload("GalacticraftCore", buf);
    Wrapper.INSTANCE.player().sendQueue.addToSendQueue(packet);
}
 
Example #16
Source File: TableTop.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
public void setSlot(int x, int y, int z) throws Exception {
    ByteBuf buf = Unpooled.buffer(0);
    ItemStack stack = Statics.STATIC_ITEMSTACK.copy();
    stack.setStackDisplayName("Mega Super Spell");
    ByteBufUtils.writeItemStack(buf, stack);
    buf.writeInt(x);
    buf.writeInt(y);
    buf.writeInt(z);
    buf.writeInt(1);
    C17PacketCustomPayload packet = new C17PacketCustomPayload("BiblioMCBEdit", buf);
    Wrapper.INSTANCE.player().sendQueue.addToSendQueue(packet);
}
 
Example #17
Source File: NoLimitPlayers.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
public void killEntity(int entityId) {
    int playerId = Wrapper.INSTANCE.player().getEntityId();
    int dimensionId = Wrapper.INSTANCE.player().dimension;
    ByteBuf buf = Unpooled.buffer(0);
    buf.writeByte(0);
    buf.writeInt(entityId);
    buf.writeInt(playerId);
    buf.writeInt(dimensionId);
    buf.writeFloat(Float.MAX_VALUE);
    buf.writeBoolean(false);
    C17PacketCustomPayload packet = new C17PacketCustomPayload("taintedmagic", buf);
    Wrapper.INSTANCE.player().sendQueue.addToSendQueue(packet);
}
 
Example #18
Source File: MegaExploit.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
public void setMagic(int x, int y, int z, ItemStack item) {
    ByteBuf buf = Unpooled.buffer(0);
    buf.writeByte(8);
    buf.writeInt(x);
    buf.writeInt(y);
    buf.writeInt(z);
    ByteBufUtils.writeItemStack(buf, item);
    C17PacketCustomPayload packet = new C17PacketCustomPayload("TConstruct", buf);
    Wrapper.INSTANCE.player().sendQueue.addToSendQueue(packet);
}
 
Example #19
Source File: CloudStorage.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onModuleEnabled() {
    try {
        Class.forName("tconstruct.util.network.AccessoryInventoryPacket");
        ByteBuf buf = Unpooled.buffer(0);
        buf.writeByte(1);
        buf.writeInt(102);
        C17PacketCustomPayload packet = new C17PacketCustomPayload("TConstruct", buf);
        Wrapper.INSTANCE.player().sendQueue.addToSendQueue(packet);
        InteropUtils.log("Opened", this);
        this.off();
    } catch (ClassNotFoundException ex) {
        this.off();
    }
}
 
Example #20
Source File: NoLimitRocket.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
public void sendRocket(int entityId) {
    int playerId = Wrapper.INSTANCE.player().getEntityId();
    ByteBuf buf = Unpooled.buffer(0);
    buf.writeByte(0);
    buf.writeInt(Wrapper.INSTANCE.player().dimension);
    buf.writeShort(11);
    buf.writeInt(playerId);
    buf.writeInt(entityId);
    C17PacketCustomPayload packet = new C17PacketCustomPayload("MFReloaded", buf);
    Wrapper.INSTANCE.player().sendQueue.addToSendQueue(packet);
}
 
Example #21
Source File: RocketChaos.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
public void sendRocket(int entityId) {
    int playerId = Wrapper.INSTANCE.player().getEntityId();
    ByteBuf buf = Unpooled.buffer(0);
    buf.writeByte(0);
    buf.writeInt(Wrapper.INSTANCE.player().dimension);
    buf.writeShort(11);
    buf.writeInt(playerId);
    buf.writeInt(entityId);
    C17PacketCustomPayload packet = new C17PacketCustomPayload("MFReloaded", buf);
    Wrapper.INSTANCE.player().sendQueue.addToSendQueue(packet);
}
 
Example #22
Source File: NoLimitClear.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
public void setSlot(int slotId, int x, int y, int z) {
    int playerId = Wrapper.INSTANCE.player().getEntityId();
    ByteBuf buf = Unpooled.buffer(0);
    buf.writeByte(0);
    buf.writeInt(Wrapper.INSTANCE.player().dimension);
    buf.writeShort(20);
    buf.writeInt(x);
    buf.writeInt(y);
    buf.writeInt(z);
    buf.writeInt(playerId);
    buf.writeInt(slotId);
    buf.writeByte(0);
    C17PacketCustomPayload packet = new C17PacketCustomPayload("MFReloaded", buf);
    Wrapper.INSTANCE.player().sendQueue.addToSendQueue(packet);
}
 
Example #23
Source File: ChestMagic.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
public void setSlot(int slotId, int x, int y, int z, int playerId) {
    ByteBuf buf = Unpooled.buffer(0);
    buf.writeByte(0);
    buf.writeInt(Wrapper.INSTANCE.player().dimension);
    buf.writeShort(20);
    buf.writeInt(x);
    buf.writeInt(y);
    buf.writeInt(z);
    buf.writeInt(playerId);
    buf.writeInt(slotId);
    buf.writeByte(0);
    C17PacketCustomPayload packet = new C17PacketCustomPayload("MFReloaded", buf);
    Wrapper.INSTANCE.player().sendQueue.addToSendQueue(packet);
}
 
Example #24
Source File: ContainerClear.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
public void setSlot(int slotId, int x, int y, int z) {
    int playerId = Wrapper.INSTANCE.player().getEntityId();
    ByteBuf buf = Unpooled.buffer(0);
    buf.writeByte(0);
    buf.writeInt(Wrapper.INSTANCE.player().dimension);
    buf.writeShort(20);
    buf.writeInt(x);
    buf.writeInt(y);
    buf.writeInt(z);
    buf.writeInt(playerId);
    buf.writeInt(slotId);
    buf.writeByte(0);
    C17PacketCustomPayload packet = new C17PacketCustomPayload("MFReloaded", buf);
    Wrapper.INSTANCE.player().sendQueue.addToSendQueue(packet);
}
 
Example #25
Source File: MetaHackSub.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onModuleEnabled() {
    try {
        Class.forName("com.riciJak.Ztones.network.ToggleMetaData").getConstructor(Boolean.TYPE);
        ByteBuf buf = Unpooled.buffer(0);
        buf.writeInt(0);
        buf.writeBoolean(false);
        C17PacketCustomPayload packet = new C17PacketCustomPayload("Ztones", buf);
        Wrapper.INSTANCE.player().sendQueue.addToSendQueue(packet);
        InteropUtils.log("Meta subtracted", this);
        this.off();
    } catch (Exception ex) {
        this.off();
    }
}
 
Example #26
Source File: MetaHackAdd.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onModuleEnabled() {
    try {
        Class.forName("com.riciJak.Ztones.network.ToggleMetaData").getConstructor(Boolean.TYPE);
        ByteBuf buf = Unpooled.buffer(0);
        buf.writeInt(0);
        buf.writeBoolean(true);
        C17PacketCustomPayload packet = new C17PacketCustomPayload("Ztones", buf);
        Wrapper.INSTANCE.player().sendQueue.addToSendQueue(packet);
        InteropUtils.log("Meta added", this);
        this.off();
    } catch (Exception ex) {
        this.off();
    }
}
 
Example #27
Source File: VerticalGui.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
public void openGui() {
    ByteBuf buf = Unpooled.buffer(0);
    buf.writeByte(9);
    buf.writeInt(Wrapper.INSTANCE.player().getEntityId());
    buf.writeInt(Wrapper.INSTANCE.player().dimension);
    C17PacketCustomPayload packet = new C17PacketCustomPayload("thaumichorizons", buf);
    Wrapper.INSTANCE.player().sendQueue.addToSendQueue(packet);
    InteropUtils.log("Opened", this);
}
 
Example #28
Source File: NowYouSeeMe.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
private void sendPacket() {
    ByteBuf buf = Unpooled.buffer(0);
    buf.writeByte(13);//Index of packet in packet handler
    buf.writeInt(Wrapper.INSTANCE.player().getEntityId());
    buf.writeInt(Wrapper.INSTANCE.player().dimension);
    C17PacketCustomPayload packet = new C17PacketCustomPayload("thaumichorizons", buf);
    Wrapper.INSTANCE.player().sendQueue.addToSendQueue(packet);
}
 
Example #29
Source File: MusicalCrash.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onMouse(MouseEvent event) {
    MovingObjectPosition mop = Wrapper.INSTANCE.mc().objectMouseOver;
    if (mop.sideHit == -1) {
        return;
    }
    boolean nowState = Mouse.isButtonDown(1);
    if (!prevState && nowState) {
        prevState = nowState;
        TileEntity entity = Wrapper.INSTANCE.world().getTileEntity(mop.blockX, mop.blockY, mop.blockZ);
        try {
            if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && entity != null && !Class.forName("eu.thesociety.DragonbornSR.DragonsRadioMod.Block.TileEntity.TileEntityRadio").isInstance(entity)) {
                ByteBuf buf = Unpooled.buffer(0);
                buf.writeByte(0);
                buf.writeInt(0);
                buf.writeDouble(mop.blockX);
                buf.writeDouble(mop.blockY);
                buf.writeDouble(mop.blockZ);
                buf.writeInt(Wrapper.INSTANCE.player().dimension);
                buf.writeInt(0);
                buf.writeBytes(new byte[0]);
                buf.writeBoolean(false);
                buf.writeFloat(0);
                buf.writeDouble(0);
                buf.writeDouble(0);
                buf.writeDouble(0);
                C17PacketCustomPayload packet = new C17PacketCustomPayload("DragonsRadioMod", buf);
                Wrapper.INSTANCE.player().sendQueue.addToSendQueue(packet);
                InteropUtils.log("Crash sent", this);
                if (event.isCancelable()) {
                    event.setCanceled(true);
                }
            }
        } catch (Exception ex) {
            InteropUtils.log("Error happened", this);
        }
    }
    prevState = nowState;
}
 
Example #30
Source File: HyperiumNetwork.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
@InvokeEvent
public void joinHypixel(ServerJoinEvent event) {
    Multithreading.runAsync(() -> {
        NetHandlerPlayClient netHandler = Minecraft.getMinecraft().getNetHandler();
        if (netHandler != null) {
            netHandler.addToSendQueue(
                new C17PacketCustomPayload("hyperium",
                    new PacketBuffer(Unpooled.buffer()).writeString(new JsonHolder()
                        .put("id", Metadata.getModid())
                        .put("optifine", HyperiumTweaker.INSTANCE.isUsingOptifine())
                        .put("version", Metadata.getVersion()).toString())));
        }
    });
}