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
cookiedragon234's Achievements
Tree Puncher (2/8)
10
Reputation
-
Render a dynamic texture to the screen
cookiedragon234 replied to cookiedragon234's topic in Modder Support
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. -
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?
-
[1.14.4]Simulate mouse and keyboard input
cookiedragon234 replied to ATomo9_CY's topic in Modder Support
@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 -
[1.12.2] Player replace ModelRenderer
cookiedragon234 replied to ricepuffz's topic in Modder Support
@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. -
Resize string to specific width
cookiedragon234 replied to cookiedragon234's topic in Modder Support
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. -
Resize string to specific width
cookiedragon234 replied to cookiedragon234's topic in Modder Support
@DavidM the width of a string will change based on its height, they are proportional -
[1.12.2] Player replace ModelRenderer
cookiedragon234 replied to ricepuffz's topic in Modder Support
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); } } -
[1.14.4]Simulate mouse and keyboard input
cookiedragon234 replied to ATomo9_CY's topic in Modder Support
KeyBinding.setKeyBindState(mc.gameSettings.keyBind[whatever].getKeyCode(), true); -
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.
-
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.
-
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.
-
bump
-
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
-
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.
-
The mod is designed to be client side only