Jump to content

cookiedragon234

Members
  • Posts

    38
  • Joined

  • Last visited

  • Days Won

    2

cookiedragon234 last won the day on August 19 2022

cookiedragon234 had the most liked content!

Recent Profile Visitors

16308 profile views

cookiedragon234's Achievements

Tree Puncher

Tree Puncher (2/8)

10

Reputation

  1. Im not sure whether that would produce s spectrum allowing a significant amount of colour choices. Also in order to save the users chosen colour, I need to take the colour where they click. With a buffered image I can just do getRgb at the position they clicked, but with your method Im not sure how I would do that.
  2. Hi I am trying to create a colour picker gui element, which displays the HSV colour space, with the x and y axis representing Saturation and Value, and a separate slider for hue and alpha. Something like this is the goal: This is my code so far: final Minecraft mc = Minecraft.getMinecraft(); final BufferedImage bufferedImage = new BufferedImage(100,100, TYPE_INT_ARGB); final DynamicTexture dynamicTexture = new DynamicTexture(bufferedImage); ResourceLocation dynamicResource; private int hue = 1; private float alpha = 1; @Override public void render(Vec2f mousePos) { for (int x = 0; x < bufferedImage.getWidth(); x++) { for (int y = 0; y < bufferedImage.getHeight(); y++) { float xPercent = x / 100; float yPercent = y / 100; Color c = ColourUtils.hsvToRgb(hue, xPercent, yPercent, alpha); bufferedImage.setRGB(x, y, c.getRGB()); } } GlStateManager.color(1,1,1,1); GlStateManager.enableTexture2D(); bufferedImage.getRGB(0, 0, bufferedImage.getWidth(), bufferedImage.getHeight(), dynamicTexture.getTextureData(), 0, bufferedImage.getWidth()); dynamicTexture.updateDynamicTexture(); //mc.getTextureManager().loadTexture(dynamicResource, dynamicTexture); dynamicResource = mc.getTextureManager().getDynamicTextureLocation("background", this.dynamicTexture); RenderUtils.drawTextureAt((int) position.x, (int) position.y, 100, 100, dynamicResource); mc.getTextureManager().deleteTexture(dynamicResource); } Which does not work, it simply displays a white square. Does anyone know how to render a dynamic texture or a buffered image to the screen?
  3. @ATomo9_CY yes, it will override the user's input. Im not 100% sure about mouse input, but you can use stuff like mc.player.swingArm() for that
  4. @ricepuffz its an external dependency which you need to add. See https://github.com/SpongePowered/MixinGradle . Also as @DavidM said, coremodding is not recommended and since you don't know what it is, it's probably best you dont try to do it.
  5. Uh I dont completely get what that code is doing, but it didn't work anyway. I am experimenting with achieving this using GlScaled but running into some small problems. If anyone else has managed to do this with glscaled I would appreciate an example. I will post my code if I finish it and get it working.
  6. @DavidM the width of a string will change based on its height, they are proportional
  7. That is the correct way to do it This is my code @Mixin(value = AbstractClientPlayer.class) public abstract class MixinAbstractClientPlayer extends MixinEntityPlayer { @Shadow @Nullable protected abstract NetworkPlayerInfo getPlayerInfo(); @Inject(method = "hasSkin", at = @At("RETURN"), cancellable = true) public void hasSkin(CallbackInfoReturnable<Boolean> cir) { PlayerSkin.HasSkin event = new PlayerSkin.HasSkin(getPlayerInfo(), cir.getReturnValue()); MinecraftForge.EVENT_BUS.post(event); cir.setReturnValue(event.result); } @Inject(method = "getLocationSkin()Lnet/minecraft/util/ResourceLocation;", at = @At("RETURN"), cancellable = true) public void getSkin(CallbackInfoReturnable<ResourceLocation> cir) { PlayerSkin.GetSkin event = new PlayerSkin.GetSkin(getPlayerInfo(), cir.getReturnValue()); MinecraftForge.EVENT_BUS.post(event); cir.setReturnValue(event.skinLocation); } }
  8. KeyBinding.setKeyBindState(mc.gameSettings.keyBind[whatever].getKeyCode(), true);
  9. I wrote the following code to resize a string until it fits within the specified width: public int drawStringClamped(String text, float x, float y, float width, int color) { int original = fontRenderer.FONT_HEIGHT; while (getStringWidth(text) > width && fontRenderer.FONT_HEIGHT > 0) { fontRenderer.FONT_HEIGHT--; } int out = drawString(text, x, y, color); fontRenderer.FONT_HEIGHT = original; return out; } This however does not work as the `getStringWidth` function does not take into account the string height! Is there an alternative way to do this? Or potentially to get the string width while taking into account its height. Thanks.
  10. Does anyone know of a function to convert coordinates in 3d space into 2d space? An example usage for this would be drawing text on the users screen over a 3d position, obviously the location of the text logically is in 3d space, however for it to be rendered it must be rendered in 2d. An example of this already happening in the vanilla game is name tags, however I tried to use the EntityRenderer.drawNameplate function and this did nothing, the text simply did not show up. I tried running the function on world render as well as on ui render. If anyone knows of a function that can allow me to draw items on the screen in 2d over a 3d target, I would really appreciate it. Thanks.
  11. It seems to fire for mobs but not players after more testing. I managed to solve this by using the AttackEntityEvent along with some other hacky mechanics.
  12. Could you provide some examples? I'm simply using mixins because I know it works and I've seen many examples of people using them to successfully create packet events: https://github.com/Hexeption/Nitro-Client/blob/master/src/main/java/uk/co/hexeption/client/mixin/mixins/MixinNetworkManager.java, https://github.com/cabaletta/baritone/blob/master/src/launch/java/baritone/launch/mixins/MixinNetworkManager.java, https://git.liquidbounce.net/CCBlueX/LiquidBase/blob/4b53d25e2893dbc5521d9a831a652b792f7803ea/src/main/java/net/ccbluex/liquidbase/injection/mixins/MixinNetworkManager.java, https://www.programcreek.com/java-api-examples/?code=ImpactDevelopment/ClientAPI/ClientAPI-master/src/main/java/clientapi/load/mixin/MixinNetworkManager.java, http://codingdict.com/sources/java/net.minecraft.network/53728.html
  13. Yes, and the mixin I just described is mixing into the netty networkmanager. I know its netty because when printing from the network manager it tells me that it is in the "netty" thread. I did dig into the code, and I found the class from which packets are sent and recieved, so I made a mixin to intercept the function calls.
  14. The mod is designed to be client side only
×
×
  • Create New...

Important Information

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