Jump to content

[1.9.4] not registring event after building


SHsuperCM

Recommended Posts

im using a chat event to render some information on screen

for some reason in my IDE(intelj idea) it works perfectly but after i

build for some reason when i put it on my minecraft it doesnt work

 

[move]CODE FOR MAIN CLASS[/move]

package com.SHsuperCM.ElytraMCMod;

import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.Mod.Instance;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

@Mod(modid = Reference.MOD_ID, name = Reference.NAME, version = Reference.VERSION, acceptedMinecraftVersions = Reference.ACCEPTED_MC_VERS)
public class ElytraMCMod {


@Instance
public static ElytraMCMod instance;


com.SHsuperCM.ElytraMCMod.Rings.RingsChatEventHandler ringsChatHandler = new com.SHsuperCM.ElytraMCMod.Rings.RingsChatEventHandler();
com.SHsuperCM.ElytraMCMod.Rings.RingsUIEventHandler ringsUIHandler = new com.SHsuperCM.ElytraMCMod.Rings.RingsUIEventHandler();


@EventHandler
public void preInit(FMLPreInitializationEvent event){
	///-Rings-///
	MinecraftForge.EVENT_BUS.register(ringsChatHandler);
	MinecraftForge.EVENT_BUS.register(ringsUIHandler);


}
@EventHandler
public void init(FMLInitializationEvent event){

}
@EventHandler
public void postInit(FMLPostInitializationEvent event){

}
}

 

[move]CODE FOR CHAT CLASS(ringsChatHandler.class)[/move]

package com.SHsuperCM.ElytraMCMod.Rings;

import com.SHsuperCM.ElytraMCMod.Common.Delay;
import com.SHsuperCM.ElytraMCMod.Reference;

import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraftforge.client.event.ClientChatReceivedEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

import java.util.ArrayList;
import java.util.List;

public class RingsChatEventHandler {

    public static Delay RaceRingTimeout = new Delay(200);
    public static Delay UnknownTimeout = new Delay(20);
@SubscribeEvent
public void getChatEvent(ClientChatReceivedEvent event){
	String originalMessage = event.getMessage().getFormattedText();
	EntityPlayer player = Minecraft.getMinecraft().thePlayer;
	if(originalMessage.contains("§9Elytra Racing §r§8|§r§e §r§eObjective: §r§aGet to the end of the course before everyone else!")){ //race starting
		Reference.ActualCheckPointString = "§l§6Getting race info!";
		Reference.RaceStarted = true;
            RaceRingTimeout.Reset();
            return;
	}
        if(originalMessage.contains("§9Elytra Racing §r§8|§r§e §r§cFailed to reach next ring!")){ // failed
            RaceRingTimeout.Reset();
            Reference.ActualCheckPointString = "§4§lFailed";
            UnknownTimeout.Reset();
            return;
        }
        if(originalMessage.contains("§r§9Elytra Racing §r§8|§r§e §r§eYou have passed ring ")){ //ring passed
            RaceRingTimeout.Reset();
            //Reference.ActualCheckPointString = "§6§lCheckpoint reached!";

            ///-Get Ring Cur/Max   ///-- i know i did it horrible but it works..
            List<Character> chars = new ArrayList<Character>();
            for(int i=1; i<originalMessage.length(); i++){
                if(originalMessage.charAt(i) == '('){  // (
                    chars.add(originalMessage.charAt(i+1));  /// ( i
                    if(Character.isDigit(originalMessage.charAt(i+2))){ //  ( i d
                        chars.add(originalMessage.charAt(i+2));  /// ( i i
                        if(originalMessage.charAt(i+3) == '/'){  //  ( i i /
                            chars.add(originalMessage.charAt(i+3));  ///  ( i i /
                            chars.add(originalMessage.charAt(i+4));  ///  ( i i / i
                            if(Character.isDigit(originalMessage.charAt(i+5))){  // ( i i / i i
                                chars.add(originalMessage.charAt(i+5));  /// ( i i / i i
                            }
                        }
                    }else {   //  i /
                        chars.add(originalMessage.charAt(i+2));  /// ( i /
                        chars.add(originalMessage.charAt(i+3));  /// ( i / i
                        if(Character.isDigit(originalMessage.charAt(i+4))) {  // ( i / i ?
                            chars.add(originalMessage.charAt(i + 4));  /// ( i / i i
                        }
                    }
                    String out = "";
                    for (int k = 0; k < chars.size(); k++) {
                        out = out + chars.get(k);
                    }
                    Reference.ActualCheckPointString = "§6§l" + out;
                    return;
                }
            }

        }
        if(originalMessage.contains("§9Elytra Racing §r§8|§r§e §r§aYou have completed the map")){ /// finished the map
            Reference.ActualCheckPointString = "§a§lFinished!";
            UnknownTimeout.Reset();
        }
}
}

 

from there i have the gui handler and everything which in the ide works but again after build not.....

i also tested to output stuff to console and to chat but it seems that the chat event is not working at all after build....

 

any help is much appriciated

Doing stuff n' things

Link to comment
Share on other sites

OMG  there is a server that is spigot not owned by me and its sending a message to the client a message whenever it passes a checkpoint! im rendering the checkpoint on screen! and it does not communicate with me in any way other than chat!

no packets! no forge on the server! only a simple client mod that i get angry for no reason!

Doing stuff n' things

Link to comment
Share on other sites

width=499 height=403http://new4.fjcdn.com/pictures/Calm+your+tits_428fdc_4406892.jpg[/img]

 

I have no clue what is wrong but:

 

1. Mark your mod client only (Look insice @Mod annotation).

2. "Doesn't work" - you mean event is not called or it doesn't pass some if statement? Please place print inside event, export it and look into MC logs.

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

instead of doing it via chat messages...

 

I think it's some kind of "game" that could be built out of even just command blocks.  All this fellow is trying to do is render the chat-context information as a HUD element rather than as chat messages.

 

That is: the game can be played without the mod he's writing and the "Checkpoint Reached!" is just a chat message sent by whatever operates the game to the player so that player has some sort of feedback. He's just trying to fancy it up some.

 

Admittedly I would still rebuild the system from the bottom up and use packets, but whatever.

 

Also, Ernio, that is a fantastic image.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

1. Mark your mod client only (Look insice @Mod annotation).

id look more into the mod annotation now.. i think it may actually be the thing that messes it..

 

The issue is most likely that your encoding is messed up. Use UTF-8 everywhere.

Also, this is a horrible way to do it. The server plugin should communicate with your mod directly, instead of doing it via chat messages...

again i dont own the server and i have no clue why i need to mess with just saying UTF-8

 

I think it's some kind of "game" that could be built out of even just command blocks.  All this fellow is trying to do is render the chat-context information as a HUD element rather than as chat messages.

 

That is: the game can be played without the mod he's writing and the "Checkpoint Reached!" is just a chat message sent by whatever operates the game to the player so that player has some sort of feedback. He's just trying to fancy it up some.

Thank you so much! finnally someone who gets what im doing

Doing stuff n' things

Link to comment
Share on other sites

Because if you are not using a unicode encoding like UTF-8 everywhere characters like "§" will not survive properly.

I am still saying this is a horrible way to do it. If you want to do it the proper way would be to ask the server owner to expose an API.

i still dont understand this, do you say the .contains are not passing because im using the § signs?

also all im getting is a chat message and all i want is to display its data.. i dont want anything to do with the server's code... its an early stages server not made by me..

Doing stuff n' things

Link to comment
Share on other sites

You are using § in your IDE, yes. At some point during the compilation there is an encoding being used that cannot represent §, so it gets lost. That's why you need to use UTF-8 (or another unicode encoding, but UTF-8 is the most popular).

well what if i dont at all use color checks?

what if before ill just do:

for(int j=1; j<originalMessage.length(); j++){
            if(originalMessage.charAt(j) != '§'){
                chars1.add(originalMessage.charAt(j));
            }else{
                j++;
            }
        }
        String message = "";
        for (int z = 0; z < chars1.size(); z++) {
            message = message + chars1.get(z);
        }

and use the messages without the § sign?

then when i check, ill check for "clean chat"?

if(message.contains("Elytra Racing | Objective: Get to the end of the course before everyone else!")){ //race starting

i think this actually might work... im testing it now.. thanks for the information about the builder not understanding §

Doing stuff n' things

Link to comment
Share on other sites

That is a horrible way to fix it.

The way to fix it, is to set your encoding properly. Not do this horrible horrible workaround.

i do not know even how to start using UTF-8 i never used it.... do i just need to add some \ with some code? i do not know.. please tellme how do i use it to do § signs

Doing stuff n' things

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • LOGIN DAN DAFTAR DISINI CEPAT!! AYUTOGEL adalah situs judi online yang memudahkan para pemainnya, dengan menggunakan deposit pulsa terbilang cukup memudahkan para pemainnya dikarenakan setiap orang pasti bisa mengisi pulsa di mana pun dengan agen agen pulsa, dengan mudah di dapat kan dimana mana jika para pemain tidak memiliki e-money atau m-banking anda tidak perlu khawatir lagi di karenakan AYUTOGEL adalah situs slot deposit pulsa. Slot Deposit pulsa adalah sebuah situs judi slot online yang melayani deposit menggunakan transfer pulsa atau menggunakan pulsa ponsel yang tersedia.
    • DAFTAR DAN LOGIN DISINI   Hantogel atau handogel adalah bentuk pengumpulan duka uang yang populer di dunia judi online, khususnya dalam permainan slot gacor. Banyak situs judi online yang menawarkan handogel slot gacor, dan sebagai pemain, penting untuk mengetahui cara memilih dan mengakses situs tersebut dengan aman dan amanah. Dalam artikel ini, kami akan membahas cara memilih situs slot gacor online yang berkualitas dan tahu cara mengakses handogelnya.
    • DAFTAR & LOGIN SIRITOGEL Siritogel adalah kumpulan kata yang mungkin baru saja dikenal oleh masyarakat, namun dengan perkembangan teknologi dan banyaknya informasi yang tersedia di internet, kalau kita siritogel (mencari informasi dengan cara yang cermat dan rinci) tentang situs slot gacor online, maka kita akan menemukan banyak hal yang menarik dan membahayakan sama sekali. Dalam artikel ini, kita akan mencoba menjelaskan apa itu situs slot gacor online dan bagaimana cara mengatasi dampaknya yang negatif.
    • This honestly might just work for you @SubscribeEvent public static void onScreenRender(ScreenEvent.Render.Post event) { final var player = Minecraft.getInstance().player; final var options = Minecraft.getInstance().options; if(!hasMyEffect(player)) return; // TODO: You provide hasMyEffect float f = Mth.lerp(event.getPartialTick(), player.oSpinningEffectIntensity, player.spinningEffectIntensity); float f1 = ((Double)options.screenEffectScale().get()).floatValue(); if(f <= 0F || f1 >= 1F) return; float p_282656_ = f * (1.0F - f1); final var p_282460_ = event.getGuiGraphics(); int i = p_282460_.guiWidth(); int j = p_282460_.guiHeight(); p_282460_.pose().pushPose(); float f5 = Mth.lerp(p_282656_, 2.0F, 1.0F); p_282460_.pose().translate((float)i / 2.0F, (float)j / 2.0F, 0.0F); p_282460_.pose().scale(f5, f5, f5); p_282460_.pose().translate((float)(-i) / 2.0F, (float)(-j) / 2.0F, 0.0F); float f4 = 0.2F * p_282656_; float f2 = 0.4F * p_282656_; float f3 = 0.2F * p_282656_; RenderSystem.disableDepthTest(); RenderSystem.depthMask(false); RenderSystem.enableBlend(); RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE); p_282460_.setColor(f4, f2, f3, 1.0F); p_282460_.blit(new ResourceLocation("textures/misc/nausea.png"), 0, 0, -90, 0.0F, 0.0F, i, j, i, j); p_282460_.setColor(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.defaultBlendFunc(); RenderSystem.disableBlend(); RenderSystem.depthMask(true); RenderSystem.enableDepthTest(); p_282460_.pose().popPose(); }   Note: Most of this is directly copied from GameRenderer as you pointed out you found. The only thing you'll have to likely do is update the `oSpinningEffectIntensity` + `spinningEffectIntensity` variables on the player when your effect is applied. Which values should be there? Not 100% sure, might be a game of guess and check, but `handleNetherPortalClient` in LocalPlayer has some hard coded you might be able to start with.
    • Dalam dunia perjudian online yang berkembang pesat, mencari platform yang dapat memberikan kemenangan maksimal dan hasil terbaik adalah impian setiap penjudi. OLXTOTO, dengan bangga, mempersembahkan dirinya sebagai jawaban atas pencarian itu. Sebagai platform terbesar untuk kemenangan maksimal dan hasil optimal, OLXTOTO telah menciptakan gelombang besar di komunitas perjudian online. Satu dari banyak keunggulan yang dimiliki OLXTOTO adalah koleksi permainan yang luas dan beragam. Dari togel hingga slot online, dari live casino hingga permainan kartu klasik, OLXTOTO memiliki sesuatu untuk setiap pemain. Dibangun dengan teknologi terkini dan dikembangkan oleh para ahli industri, setiap permainan di platform ini dirancang untuk memberikan pengalaman yang tak tertandingi bagi para penjudi. Namun, keunggulan OLXTOTO tidak hanya terletak pada variasi permainan yang mereka tawarkan. Mereka juga menonjol karena komitmen mereka terhadap keamanan dan keadilan. Dengan sistem keamanan tingkat tinggi dan proses audit yang ketat, OLXTOTO memastikan bahwa setiap putaran permainan berjalan dengan adil dan transparan. Para pemain dapat merasa aman dan yakin bahwa pengalaman berjudi mereka di OLXTOTO tidak akan terganggu oleh masalah keamanan atau keadilan. Tak hanya itu, OLXTOTO juga terkenal karena layanan pelanggan yang luar biasa. Tim dukungan mereka selalu siap sedia untuk membantu para pemain dengan segala pertanyaan atau masalah yang mereka hadapi. Dengan respon cepat dan solusi yang efisien, OLXTOTO memastikan bahwa pengalaman berjudi para pemain tetap mulus dan menyenangkan. Dengan semua fitur dan keunggulan yang ditawarkannya, tidak mengherankan bahwa OLXTOTO telah menjadi pilihan utama bagi jutaan penjudi online di seluruh dunia. Jika Anda mencari platform yang dapat memberikan kemenangan maksimal dan hasil optimal, tidak perlu mencari lebih jauh dari OLXTOTO. Bergabunglah dengan OLXTOTO hari ini dan mulailah petualangan Anda menuju kemenangan besar dan hasil terbaik!
  • Topics

×
×
  • Create New...

Important Information

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