Jump to content

-TheLittleGuy

Members
  • Posts

    26
  • Joined

  • Last visited

Everything posted by -TheLittleGuy

  1. hmm the code i used in my old mod came from the source code of a different mod, but im not sure if it can be adapted to 1.15, i believe it involved vector math aswell might have to give it a go Thank you for the pointers though! Edit: Found some code from another mod that I believe I can adapt to my specific use case
  2. Since 1.15 introduced a lot of significant changes as opposed to 1.12, I cannot figure out how to RayTrace an entity from a range further than what pointedEntity allows (~4 blocks) I am able to raytrace blocks from an increased range using BlockRayTraceResult, but I am unsure how to apply this to entities. I want to be able to target an entity from a range of about 50 blocks. Please let me know where to start. Thank You.
  3. Hello! I am curious on how I would go about creating a "second camera" for use with perspectives. In the past I have heard methods of creating a client side entity and then using setRenderViewEntity() to switch perspectives. However, I want to take this a bit further and Create a second popup window (that can be dragged onto a secondary display) giving me two perspectives independent from each other. The concept would work similar to splitscreen or even those popular free cam mods. My basic thought process for this is as follows: Create client side "camera" entity, would act as if I were running the game with another account (in regards to a camera view) create a second game window with the secondary view - when window is in focus you would be able to move camera around, but cannot interact with GUI's etc. So how would I go about doing this? Would I need to create a frame buffer/render to texture and do some of that weird openGL related stuff?
  4. thank you everything works perfectly now!
  5. So I came up with this code but I am unsure how to "tie" it to the tooltips. No crashes occur but it does not work List<ITextComponent> tooltip = event.getToolTip(); ArrayList<String> list = new ArrayList<>(); String regex = TextFormatting.YELLOW + "(Efficiency \\d+|Fortune \\d+|Unbreaking \\d+).*"; //add all lines of the tooltip for(int i = 0; i < tooltip.size(); i++) { String line = tooltip.get(i).getFormattedText(); list.add(line); } Iterator itr = list.iterator(); while (itr.hasNext()) { String next = (String) itr.next(); if(regex.equals(next)) { tooltip.remove(next); //unsure if this is correct test = true; //test boolean } }
  6. You have a basic example? Haven't worked with iterators much.
  7. A server I play on has this annoying "feature" where it changes how enchants are displayed on an item to look like the following: However I don't want that so i used some code to "reveal" the vanilla enchants (which are hidden with HideFlags nbt tag) and then removing the yellow text Problem is, not all of the yellow lines are getting removed - Ideally there should be no yellow lines on the item. Here is the following code that results in the image above: @SubscribeEvent public void onToolTip(final ItemTooltipEvent event) { List<ITextComponent> tooltip = event.getToolTip(); ArrayList<String> list = new ArrayList<>(); for(int i = 0; i < tooltip.size(); i++) { String line = tooltip.get(i).getFormattedText(); if (line.matches(TextFormatting.YELLOW + "(Efficiency \\d+|Fortune \\d+|Unbreaking \\d+).*")) { //other enchants will be added here //if(line.startsWith(TextFormatting.YELLOW + )) { list.add(line); tooltip.remove(i); } index = tooltip.size(); //used for testing s = list.toString(); //used for testing } CompoundNBT nbt = event.getItemStack().getOrCreateTag(); nbt.remove("HideFlags"); } So what exactly is failing? Any help would be appreciated!
  8. I switched over to IntelliJ and everything worked fine, must have had a bad eclipse installation or something
  9. I basically did what the README.txt said to do. Extract files to folder > Run gradlew genEclipseRuns (this is where the error occurs) > After importing the project into eclipse the mentioned dependency is missing.
  10. I am trying to create a new modding workspace for 1.15.2 however I keep running into this error when trying to setup the project: Could not resolve: net.minecraftforge:forge:1.15.2-31.1.37_mapped_snapshot_20200225-1.15.1 Did I forget to install something? I am unsure whats causing this.
  11. I actually do have a question: I changed the gradient to start from the left instead of the top however, the current method applies the gradient effect to the individual character. What would have to be changed in order to have the gradient be applied to the entire string? Where would the GL Functions go in that case? Where they are currently or would it have to go after the chars are "assembled" into the string? Ex: i have the string "Test String" the start color is Green and the end color is Red, the first letter will start green and will fade to red by the time it gets to the last letter.
  12. Thank you very much for putting the time into this!
  13. It seems a bit different in 1.12.2. There doesnt seem to be a TexturedGlyph class. After the renderStringAtPos method the method renderChar is called which then either calls renderDefaultChar or renderUnicodeChar which is where the location of the actual glyphs are "cut out" from the font texture (default.png). The coloring of the text doesnt get set until the renderString method (§ codes excluded those seem to get set inside renderStringAtPos)
  14. Is there a way to give text a gradient effect? Similar to the game's drawGradientRect() Method Would I have to use openGL methods to achieve this and if so which ones? Edit: Kinda related but is there a way to set the opacity of multiple objects being drawn on the screen? Example, I have 4 strings of text and I want to set all of their opacity to 50%
  15. Alright, its fixed. I simply had to get the actual tab overlay instance, thank you for all your help!
  16. the method ObfuscationReflectionHelper#findField wasnt present so i used ReflectionHelper#findField - maybe im using a different forge version? Anyways i tried the following code static final Field head; static { head = ReflectionHelper.findField(GuiPlayerTabOverlay.class, "header" , "field_175256_i"); } public void getHeader() throws IllegalArgumentException, IllegalAccessException { tabOverlay = new GuiPlayerTabOverlay(mc, guiIngame); this.setHeader((ITextComponent) head.get(tabOverlay)); } then i called the getHeader method in the render method. No crashes, but the header still doesnt get rendered when its supposed to. Surely im missing something or calling the method in the wrong place perhaps?
  17. Hey so after a few days of thinking, I am having trouble getting the value of the reflected fields. When trying to render the tab, the game crashes and causes an IllegalArgumentException. This is the method i used to get the value (same applies to footer) - the method is then called in renderTabOverlay in my new class public void getHeader() { Field field; try { field = GuiPlayerTabOverlay.class.getDeclaredField("header"); field.setAccessible(true); this.header = (ITextComponent) field.get(this); //This is likely the problem field.setAccessible(false); } catch (NoSuchFieldException | IllegalAccessException | SecurityException e) { e.printStackTrace(); } } Any assistance on what to fix would be appreciated - I haven't used reflection much so bear with me. EDIT: I did some looking into how the header/footer text is set, which is set via packets, and the packet that handles this is called SPacketPlayerListHeaderFooter - which has getters for both of the values i need. Would it be possible to grab this packet data and use it?
  18. Alright sounds good, thank you for your help. (sorry about my weird sentences, im pretty bad at explaining things)
  19. do i extend Gui then? thats what i orginally had it set to but i was just experimenting. So in my new overlay i would access the header/footer data there correct?
  20. so to clarify, i would have to manually set the header/footer data inside my new tab gui and use reflection to get the data from the default ones since there are only setters for the header/footer fields
  21. The text above and below the player list that servers utilize for advertising purposes or stats http://prntscr.com/mpk7n0 (Note: it works here because this was a different version of my mod that didnt use forge)
×
×
  • Create New...

Important Information

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