y: the y coordinate of the top left corner of the slot's square on the gui.x: the x coordinate of the top left corner of the slot's square on the gui.used when Container#getItem, Container#setItem, and Container#removeItem are called by the Menu this is the index in that list that the slot represents. index: the container has a list of itemstacks.Container/Inventory: the container of items the slot should mondify.The depreciated warning istelling you that if you ever need to call that method, you should call it from the blockstate/itemstack instead but if you're making your own block/item you do have to override it on the block/item singleton class itself what are the parameters of the Slot constructor (for inventory menus)? and how does the slot know how big to be in the gui? Is it a problem to override depreciated methods on Block/Item? can do (poseStack, Component.literal("words"), x, y, 0xFFFFFF) Īnd wrap that up into a method that lets you render whatever text at whatever position at whatever scale the Screen class has a this.font variable you can use (it gets it from Minecraft.getInstance().font).render text centered on 0,0 (you'll probably need to check the width and height of the component since i'm guessing you pass in the top left coordinate when you render it).tho calling the translate/scale methods will move everything, not just the text you're trying to work with. so really what you want is to draw the text centred at (0,0), then scale it, then translate it to where you actually want it. The thing that makes it weird is that when you scale the matrix it scales any translations you've done as well, including the position you told the text to be at. It works but I’m thinking there must be a better way to translate the positions when doing non standard scales like 0.8** QUESTION: I’m using posestack.scale for the scale and just manually tweaking some math for the x and y to get it to look okay. I might add an index and split it into seperate pages to help the SEO at some point if i feel inspired how scale and translate text on a gui? It will only be helpful if you're already comfortable with Java! These answers are for a mix of versions so you will have to do some translating but they should point you in the right direction. This page is a collection of information I've given people on that server so you can search it more easily. If there's something you want to learn how to do that i dont have a tutorial for and you can't figure out from vanilla's code, feel free to join my discord server to ask me.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |