Jump to content

Recommended Posts

Posted (edited)

Hi everyone, im new to the modding community.
So, I have a little problem here. The text that i've entered can show up with a bind.
But the reach function doesn't work, and I don't know why.. Here's the code.

 

Spoiler

package ca.forge.api;

import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.InputEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import net.minecraft.client.Minecraft;
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.C17PacketCustomPayload;
import net.minecraftforge.common.MinecraftForge;

import java.awt.Color;
import java.nio.ByteBuffer;

import org.lwjgl.input.Keyboard;

@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION)

public class ForgeAPI
{
    
    private static final Minecraft mc = Minecraft.getMinecraft();
    private boolean textGui;
    private final int textGuiKey = 22;   
    private boolean forgeStart;
    private final int forgeinit = 19;
    
    @EventHandler
    public void Init(FMLInitializationEvent event)
    {
        FMLCommonHandler.instance().bus().register(this);
        MinecraftForge.EVENT_BUS.register(this);
        System.out.println("Initialized ForgeAPI");
    }
    
    @SubscribeEvent
    public void onRender(TickEvent.RenderTickEvent e) {
        if(textGui)
            mc.fontRenderer.drawStringWithShadow("OpehClient", 2, 2, Color.CYAN.hashCode());
    }
    
    @SubscribeEvent
    public void onKeyInput(InputEvent.KeyInputEvent e) 
    {
        if(Keyboard.isKeyDown(22)) {
            this.textGui = (!this.textGui);
            return; 
        }
        else if(Keyboard.isKeyDown(19)) {
            this.forgeStart = (!this.forgeStart);
        }
        Packet spoofedForgePacket = manipulateForgePacket(spoofForgeValue(3.6D));
        mc.thePlayer.sendQueue.addToSendQueue(spoofedForgePacket);
    }
    
    private Packet manipulateForgePacket(byte[] spoofedForgeValue) {
        return new C17PacketCustomPayload("reach", spoofedForgeValue);
    }
    
    private byte[] spoofForgeValue(double ForgeValue) {
        byte[] buffer = new byte[8];
        ByteBuffer.wrap(buffer).putDouble(ForgeValue);
        return buffer;
    }
    
}

I tried to make the mod look less suspicious by changing codes.
Thanks for helping in advance!
Regards, Opeh.

(PS: Sorry for my bad english)
(If you want to help me via Skype or something, reply your skype name)

Edited by Opeh
forgot the title.
  • Guest locked this topic
Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.