Jump to content

Recommended Posts

Posted

I am a moderator on a server, and when 100+ people are on it gets a bit hard to keep up on chat.  So, what I thought was I could make a Mod that will display messages on the top left of the screen that possibly breaks chat rules, ex. profanity, to where I can just press a button and it will say something in chat or press another button and it will be dismissed. I'm somewhat decent at writing Bukkit plugins, so Forge can't be that different? I was clearly wrong.

 

So to restate what I want to do, if someone in the server chat says something, I want a notification on the top right of the screen, similar to how achievements are shown. This will have 2 buttons to either accept the warning for them and say something in chat or to entirely dismiss the notification.  I know how to do all of the filters and everything, so all I really need to know is:

 

-How to get the chat events from the server (and getting the message from it)

-How to display a notification on the side

-How to send a message to the server

 

This mod will not be installed server-side.

Posted

For 1 and 2: Learn Forge events. @SubscribeEvent.

 

1. Since "This mod will not be installed server-side.", you probably want o catch client-received chat msgs:

* Use ClientChatReceivedEvent

 

2.

* Use RenderGameOverlayEvent.

Notes:

- Pick Pre or Post. (rather post)

- Use event.type (choose one of phases, otherwise you will render many times).

- event also ships scale param (which apparently not many know, so just saying).

 

3. Since mod is not on server, I assume you are asking about chat messages:

Lookup GuiScreen#sendChatMessage(String).

Or more directly: Minecraft#thePlayer#sendChatMessage(String).

 

Additional notes: Since mod will be client-only, you can use: @Mod(clientSideOnly = true).

 

Oh and this is 1.8+ ONLY (some of this doesn't exist earlier).

  Quote

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

Posted

If the mod is not installed server side, then I'm pretty sure you cannot get chat messages other than the ones you yourself send or receive.

 

Also, I'm not sure if all chat messages are guaranteed to be routed through the server, either, for example any sent by mods directly on a client's machine, but I don't think you'd be interested in those anyway, right?

Posted
  On 3/26/2016 at 4:05 PM, Ernio said:

For 1 and 2: Learn Forge events. @SubscribeEvent.

 

1. Since "This mod will not be installed server-side.", you probably want o catch client-received chat msgs:

* Use ClientChatReceivedEvent

 

2.

* Use RenderGameOverlayEvent.

Notes:

- Pick Pre or Post. (rather post)

- Use event.type (choose one of phases, otherwise you will render many times).

- event also ships scale param (which apparently not many know, so just saying).

 

3. Since mod is not on server, I assume you are asking about chat messages:

Lookup GuiScreen#sendChatMessage(String).

Or more directly: Minecraft#thePlayer#sendChatMessage(String).

 

Additional notes: Since mod will be client-only, you can use: @Mod(clientSideOnly = true).

 

Oh and this is 1.8+ ONLY (some of this doesn't exist earlier).

 

I've found everything, except I can't figure out how to do the RenderGameOverlay thing.  Do you have any code showing it being used, or something?

Posted

1. Register event class.

2.

@SubscribeEvent
public void onRenderOvelay(RenderGameOverlayEvent.Post event)
{
	if (event.type == ElementType.EXPERIENCE || event.type == ElementType.FOOD)
	{
		event.setCanceled(true); // You can use event like this to cancel rendering of food and exp
	}

	if (event.type == ElementType.HEALTH)
	{
		int w = event.resolution.getScaledWidth(); // the resolution I mentioned
		int h = event.resolution.getScaledHeight();

		// You can draw whatever you want here.

		// big note regarding this part: If you ever change bound texture during rendering event you need to set it back to icons, otherwise you will mess up rest of UI. Similar rules apply to GL states (e.g alpha, colorization), etc.
		this.mc.getTextureManager().bindTexture(Gui.icons); // not needed, example per comment above.
	}
}

  Quote

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

Posted

Okay, so I got that, however, I'm still somewhat confused on what I put to make a new GUI, and where I actually put the GUI textures I want to use.

Posted

Check out literally any part of vanilla gui code.

 

Rendering (GL): You can use GL directly or utilize Tesselator+WorldRenderer with nice vertex formats.

 

Rendering (textures): First you bind texture using Minecraft#getTextureManager().bindTexture(ResourceLocation).

Then you can draw it using Gui#drawTexturedModalRect(x, y, u, v, width, height).

Do note that this method expects a .png ResourceLocation with size of multiple of 256.

It will draw that .png on x/y coords (from top left) from u/v of .png file (from top/left) with width and height.

 

Rendering Items/Blocks/Entities - for entities there is utility (lookup player inventory gui), for items and blocks you need to go into ItemRenderer, I don't remember right now.

 

Point of interest: Useful methods re placed in Gui which you can extend and use. I personally rewritten them to be static and to accept RGBA and doubles.

  Quote

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

Posted
  On 3/26/2016 at 8:20 PM, Ernio said:

Check out literally any part of vanilla gui code.

 

Rendering (GL): You can use GL directly or utilize Tesselator+WorldRenderer with nice vertex formats.

 

Rendering (textures): First you bind texture using Minecraft#getTextureManager().bindTexture(ResourceLocation).

Then you can draw it using Gui#drawTexturedModalRect(x, y, u, v, width, height).

Do note that this method expects a .png ResourceLocation with size of multiple of 256.

It will draw that .png on x/y coords (from top left) from u/v of .png file (from top/left) with width and height.

 

Rendering Items/Blocks/Entities - for entities there is utility (lookup player inventory gui), for items and blocks you need to go into ItemRenderer, I don't remember right now.

 

Point of interest: Useful methods re placed in Gui which you can extend and use. I personally rewritten them to be static and to accept RGBA and doubles.

 

Ok, but where do you actually put the textures in the files to where it can reach it? It keeps saying file not found.

Posted

With questions like that you should seriously consider using google.

 

Every direct and somewhat common question (in this case - resource - which are used by every mod ever) is almost always answered somewhere on google.

 

Anyway - each mod has Domain (modid) which directs to: resources folder.

Basically you make this somewhere:

public static final ResourceLocation	txt = new ResourceLocation(ModID + ":" + "textures/gui/something.png");

This will point to:

<src/main/resources>/assets/[modid]/textures/gui/something.png // Where <...> is part of workspace, I wrote it for (in)convenience.

And you can sue "txt" as texture in #bindTexture().

  Quote

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

Posted
  On 3/28/2016 at 5:57 PM, Ernio said:

"It doesn't work" says nothing. Always post full code on given case.

 

Nevermind, I got it.  It was just me being stupid and not realizing that the tutorials I was looking at was extending "Gui"...

 

The thing that I'm stuck on now is being able to get a message that the player (From typing it in) sends to the server, and cancelling it if it has some character in front of it. Basically, I want to make commands like they do in hack mods (for example .help). Except it of course won't be used to hack and stuff. :P

Posted
  On 3/31/2016 at 11:54 PM, Twijn said:

The thing that I'm stuck on now is being able to get a message that the player (From typing it in) sends to the server, and cancelling it if it has some character in front of it. Basically, I want to make commands like they do in hack mods (for example .help). Except it of course won't be used to hack and stuff. :P

 

There's no way to intercept chat messages on the client before they're sent to the server without some ASM or possibly messing around with Netty to intercept the packet.

 

Why not just create an

ICommand

and register it with

ClientCommandHandler

.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted
  On 4/1/2016 at 5:48 AM, Choonster said:

  Quote

The thing that I'm stuck on now is being able to get a message that the player (From typing it in) sends to the server, and cancelling it if it has some character in front of it. Basically, I want to make commands like they do in hack mods (for example .help). Except it of course won't be used to hack and stuff. :P

 

There's no way to intercept chat messages on the client before they're sent to the server without some ASM or possibly messing around with Netty to intercept the packet.

 

Why not just create an

ICommand

and register it with

ClientCommandHandler

.

 

Okay, I'll try that.

Posted
  On 4/1/2016 at 5:48 AM, Choonster said:

  Quote

The thing that I'm stuck on now is being able to get a message that the player (From typing it in) sends to the server, and cancelling it if it has some character in front of it. Basically, I want to make commands like they do in hack mods (for example .help). Except it of course won't be used to hack and stuff. :P

 

There's no way to intercept chat messages on the client before they're sent to the server without some ASM or possibly messing around with Netty to intercept the packet.

 

Why not just create an

ICommand

and register it with

ClientCommandHandler

.

 

Okay, I've done all of that and it seems to work just fine! The one thing I want to know now is how to get a list of all of the players then allow it to autofill to those players on the command

Posted

Since this is client side mod - the world on your client (Minecraft#theWorld) is only part of world you see.

 

It will only ever "contain" entities (including players) that you actually see (in view range). This list is available in World#getLoadedEntityList().

Only those entity instances exist on clients.

 

For players there is exception - you don't have their instances, but you hold their profiles. We are talking about "tab" player list.

Lookup GuiPlayerTabOverlay.

  Quote

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

Posted
  On 4/3/2016 at 12:53 AM, Twijn said:

I've googled GuiPlayerTabOverlay and nothing useful is found? Do you possibly have a link?

 

Also, will having "custom" tab menus affect it? (For example, things like this: http://prntscr.com/anfbta )

 

It's a class. Look at it in your IDE.

 

Custom menus won't affect it, the raw data will always be made available by Minecraft.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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

    • Short Term Loans Online: A Reliable Source of Fast Cash   If you are experiencing financial difficulties, you don't have to worry about this challenge. This is the quickest and best method for handling financial catastrophes. You can pick short term loans online without reluctance, and you can apply for the payday loan you want online and have it the same day without any issues. With two to four weeks to repay the loan, you may often borrow between $100 and $1000 without having to offer any collateral.   As implied by the title, those with bad credit histories—defaults, arrears, foreclosure, late or missed payments, judgments against you, insolvency or IVA, etc.—are welcome to apply for online short term loans without having to go through any challenging procedures. Interest rates are a bit high in comparison to other loans. A thorough internet search can be used to determine the greatest rate for a financed loan.   You don't have to waste your precious time searching the internet for short term funding payday loans. In just a few minutes, you can apply for the finance you desire by completing a brief online application. The lender will approve the loan once he has verified that you have provided accurate information on this brief form. This loan is carefully deposited into your bank account in the least amount of time. You can utilize the money in a number of ways without running into any problems. Usually, the money can be used to settle debts like credit card balances, overdue bank overdrafts, tuition or school fees for children, energy bills, housing costs, and more.   Loans Lucre makes it simple to apply for short term loans online, so there's no need to drive across town. Additionally, you won't have to wait weeks for a response from us. Additionally, having bad credit shouldn't be a deal-breaker. We evaluate your entire financial history rather than just your FICO score. We approve many debtors who had been rejected by banks.   Once you are approved, Loans Lucre puts your online installment loans directly into your bank account, giving you instant access to your funds. The repayment plan is broken down into simple, reasonably priced monthly installments. Loans Lucre also rejects rollovers. Instead, we help borrowers get back on track when they encounter difficulties with the repayment process. Borrowers who regularly make their payments on time are eligible for lower annual percentage rates (APRs) on their subsequent these loans. That is truly win-win!   You will be communicating with the lender whether you apply for online personal loans through a cash advance broker or directly from the lender. The cost and duration of the transaction will be increased by any third parties you deal with through the direct lender. This will lead to a faulty perception of the "instant approval" of your payday loan, in addition to raising the cost of your transaction. When asking for a payday loan, it is therefore essential that you work with a trustworthy direct lender; a lender with a solid online reputation and satisfied clients is a wise choice.   You can apply for a short term loans online through internet platforms in addition to conventional lenders. A quicker and more convenient application process is frequently provided by these platforms. In the end, it is feasible to get a $500 loan with low credit or no credit at all, but it will need effort and careful evaluation of your financial possibilities. The lender's requirements will always determine approval, so be careful to give accurate information and look into several lenders to determine which one best suit your needs. https://loanslucre.com/  
    • Apply For Fast Cash Loans Online Today To Get Money Right Away   Do you have to deal with your money issues right away? You don't need to go anywhere because you can get fast cash loans online with just a computer and an internet connection. This suggests that you don't need to waste any time applying for these loans. All you have to do is fill out the form accurately and submit it to the lender online. They will check it and determine whether to approve the loan within the specified time frame. The money is moved to your bank account shortly after approval.   The same-day financing loan facility offers the most beneficial cash assistance in quantities ranging from $100 to $1000, with a flexible payback period of 2-4 weeks from the date of acceptance. You can use the borrowed funds to cover your child's tuition or school fees, small vacation expenses, past credit card payments, laundry costs, minor house repairs, your mother's checkups, and other emergencies.   To be qualified for same day funding loans, you must meet specific conditions regardless of your credit score—fair or low. A valid proof of domicile and proof of residence for the last 12 months, a current bank account with an SSN, being employed permanently with a monthly wage of at least $1000, and being at least eighteen years of age are prerequisites. If you satisfy the qualifications, you can apply for same-day payday loans directly without undergoing a credit check if you have bankruptcy, CCJs, IVAs, foreclosure, arrears, or defaults. As a result, getting a loan is fairly easy in the current credit market.   You must complete an application with information about your bank account and job in order to apply for a fast cash loan online from a physical payday lender. You also need to provide the lender with postdated checks that will be deposited on the scheduled repayment date. In return, you get paid right away.   Applicants can apply for same day payday loans at any time, from the comfort of their homes, eliminating the need to travel across town to a payday loan outlet. However, online payday lenders do not frequently provide same-day loans. Instead, payouts are made straight into borrowers' bank accounts via the Automated Clearing House (ACH) system; processing for this method takes at least one business day.   You must think about if you can pay back the loan in full within the allotted time because same day payday loans may have payback periods as little as one week or ten days. If you are unable to pay the full amount due, the lender might accept a token payment from you. The remaining sum will be restructured as a rollover, which is a new loan with fresh interest and administrative costs and the same short payback period. After a few rollovers, a significant number of little payday loans accumulate to the point that debtors still owe more than they originally borrowed, even after making consistent payments for months or years.   You should be ready to submit the required paperwork and supporting proof when applying for a payday loans online same day with bad credit. Usually, lenders will evaluate your present financial state, work status, and loan-repayment capacity. Many lenders specialize in bad credit loans and are willing to take on the risk of lending to those with poor credit, despite the difficulties presented by a low credit score. This implies that you are not automatically denied a loan because of poor credit or no credit at all. https://nuevacash.com/
    • I have removed stevekunglib and it is still crashing again https://pastebin.com/9vE8pji0
    • It looks like an issue with stevekunglib or a mod requiring it
  • Topics

×
×
  • Create New...

Important Information

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