Jump to content
Search In
  • More options...
Find results that contain...
Find results in...


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by cookiedragon234

  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. Yes actually we have, that must be why! How did you fix that?
  15. Scroll up. Also I don’t understand why me literally offering helpful advice to other people coming across this is met with “that’s a shit method” and “don’t mess with it at all”. Like geez, if you know a better way then feel free to contribute, but simply getting complaining isn’t contributing anything.
  16. I’d welcome any examples of a better way to do this?
  17. I'm wondering if there is anyway to trigger an action when the client kills another player? The LivingDeathEvent seems to be only server side. Is there an equivalent client side event which is triggered on a player death and allows me to check whether the damage source is from the client? Or is there maybe a packet that is sent upon a players death? Thanks.
  18. For anyone else looking for this in the future, create mixins for net.minecraft.network.NetworkManager like so: @Inject(method = "sendPacket(Lnet/minecraft/network/Packet;)V", at = @At("HEAD"), cancellable = true) private void onSendPacket(Packet<?> packet, CallbackInfo callbackInfo) { //System.out.println("Packet Sent: " + packet.toString()); PacketSent event = new PacketSent(packet); MinecraftForge.EVENT_BUS.post(event); if (event.isCanceled() && callbackInfo.isCancellable()) { callbackInfo.cancel(); } packet = event.packet; } @Inject(method = "channelRead0", at = @At("HEAD"), cancellable = true) private void onChannelRead(ChannelHandlerContext context, Packet<?> packet, CallbackInfo callbackInfo) { //System.out.println("Packet Recieved: " + packet.toString()); PacketRecieved event = new PacketRecieved(packet); MinecraftForge.EVENT_BUS.post(event); if (event.isCanceled() && callbackInfo.isCancellable()) { callbackInfo.cancel(); } packet = event.packet; } PacketSent and PacketRecieved are custom events that you can make yourself by making a class that extends Event.
  19. Found a fix for anyone else with this issue. In build.gradle change: dependencies { compile("org.spongepowered:mixin:0.7.4-SNAPSHOT") } to dependencies { compile("org.spongepowered:mixin:0.7.4-SNAPSHOT") { exclude module: 'launchwrapper' exclude module: 'guava' exclude module: 'gson' exclude module: 'commons-io' } }
  20. Yep, I tried setting up a mods.toml and that didn't make any difference because I think thats for 1.14. I don't understand what you mean by how did I setup my workspace. I imported build.gradle in IntelliJ IDEA, and ran the commands that the documentation provided to set it up. This is my build.gradle: buildscript { repositories { jcenter() maven { url = "http://files.minecraftforge.net/maven" } maven { name = 'SpongePowered' url = 'http://repo.spongepowered.org/maven' } } dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT' classpath 'org.spongepowered:mixingradle:0.4-SNAPSHOT' } } apply plugin: 'net.minecraftforge.gradle.forge' apply plugin: 'org.spongepowered.mixin' sourceSets { main { ext.refMap = "mixins.mod.refmap.json" } } jar { manifest.attributes( 'TweakClass': 'org.spongepowered.asm.launch.MixinTweaker', 'MixinConfigs': 'mixins.mod.json', 'FMLCorePluginContainsFMLMod': 'true', 'tweakClass': 'org.spongepowered.asm.launch.MixinTweaker', 'TweakOrder': 0, 'FMLCorePlugin': 'com.mod.mixin.LoadingPlugin', 'ForceLoadAsMod': 'true' ) } //Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. version = "0.1" group = "com.mod.mod" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "mod" sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly. compileJava { sourceCompatibility = targetCompatibility = '1.8' } mixin { add sourceSets.main, "mixins.mod.refmap.json" } minecraft { version = "1.12.2-" runDir = "run" // the mappings can be changed at any time, and must be in the following format. // snapshot_YYYYMMDD snapshot are built nightly. // stable_# stables are built at the discretion of the MCP team. // Use non-default mappings at your own risk. they may not always work. // simply re-run your setup task after changing the mappings to update your workspace. mappings = 'snapshot_20180106' makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. def args = ["-Dfml.coreMods.load=com.mod.mixin.LoadingPlugin"] clientJvmArgs.addAll(args) serverJvmArgs.addAll(args) } repositories { maven { name = 'spongepowered-repo' url = 'http://repo.spongepowered.org/maven/' } mavenCentral() flatDir { dirs 'libs' } } dependencies { // you may put jars on which you depend on in ./libs // or you may define them like so.. //compile "some.group:artifact:version:classifier" //compile "some.group:artifact:version" // real examples //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env //compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env // the 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime. //provided 'com.mod-buildcraft:buildcraft:6.0.8:dev' // the deobf configurations: 'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided, // except that these dependencies get remapped to your current MCP mappings //deobfCompile 'com.mod-buildcraft:buildcraft:6.0.8:dev' //deobfProvided 'com.mod-buildcraft:buildcraft:6.0.8:dev' // for more info... // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html // http://www.gradle.org/docs/current/userguide/dependency_management.html compile("org.spongepowered:mixin:0.7.4-SNAPSHOT") { exclude module: 'launchwrapper' exclude module: 'guava' exclude module: 'gson' exclude module: 'commons-io' } implementation files('libs/java-discord-rpc-2.0.1-all.jar') } processResources { // this will ensure that this task is redone when the versions change. inputs.property "version", project.version inputs.property "mcversion", project.minecraft.version // replace stuff in mcmod.info, nothing else from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' // replace version and mcversion expand 'version': project.version, 'mcversion': project.minecraft.version } // copy everything else except the mcmod.info from(sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' } } Its very confusing as it seemed to be running from the client fine last week.
  21. When running the task runClient the actual mod is not loaded even though Minecraft starts up without any errors. I believe that these lines from the log could be part of it: [12:32:17] [main/INFO] [FML]: -- System Details -- Details: Minecraft Version: 1.12.2 Operating System: Windows 10 (amd64) version 10.0 Java Version: 1.8.0_211, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 409724112 bytes (390 MB) / 739770368 bytes (705 MB) up to 3808428032 bytes (3632 MB) JVM Flags: 0 total; IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: Loaded coremods (and transformers): LoadingPlugin (mod-0.1.jar) GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.6.0 NVIDIA 419.17' Renderer: 'GeForce GTX 1080/PCIe/SSE2' [12:32:17] [main/INFO] [FML]: MinecraftForge v14.23.1.2584 Initialized [12:32:17] [main/INFO] [FML]: Starts to replace vanilla recipe ingredients with ore ingredients. [12:32:18] [main/INFO] [FML]: Replaced 1036 ore ingredients [12:32:18] [main/INFO] [FML]: Found 0 mods from the command line. Injecting into mod discoverer [12:32:18] [main/INFO] [FML]: Searching D:\[path to project]\run\mods for mods [12:32:19] [main/INFO] [FML]: Forge Mod Loader has identified 4 mods to load [12:32:19] [main/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge] at CLIENT [12:32:19] [main/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge] at SERVER It seems to detect the mixins but not the actual mod itself. Would really appreciate any help! I can build the client just fine, it's just some issue with my gradle configuration Im guessing.
  22. It's not just packet events. And this topic wasn't really asking for advice on whether to use mixins. Me and my team already have a design that relies on mixins. Id really appreciate it if you could give me any advice on why it doesnt seem to be able to find the guava library? Is there a way I can download it manually perhaps?
  23. Mess is an interesting choice of word, I would say to allow the user to modify/monitor certain packets, for example adding a server tickrate counter to the HUD based on the frequency of server update packets received, or prevent the server from sending rotation packets in order to prevent the annoying rotation rubberbanding that can sometimes happen during lag.
  • Create New...

Important Information

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