Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (โ‹ฎ) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Kemuri Senpai

Members
  • Joined

  • Last visited

Everything posted by Kemuri Senpai

  1. Damn, thank you! I was so focused on the code from github, assuming that he is doing it correctly... How can I upvote you?
  2. Ow, I see, so the second "0" i use, is only a placeholder? I could also use any other slot I want?... So I even could swap two slots without the three commands? Just with one: clickWindow( inventoryID, 36, 1, click, player )? I expect this to swap two first slots in hotbar.. Is it how it works?
  3. However, I still have a question ๐Ÿ˜… pc.windowClick(0, 37, 0, click, player); pc.windowClick(0, 38, 0, click, player); pc.windowClick(0, 37, 0, click, player); works as I wanted. It swaps the second and the third item in my hotbar. But pc.windowClick(0, 36, 0, click, player); pc.windowClick(0, 37, 0, click, player); pc.windowClick(0, 36, 0, click, player); does not swap the first and the second... It actually does nothing
  4. Okay, currently no acces to my computer, I will check it Thank you, so far
  5. I still do not understand, as in https://stackoverflow.com/questions/60443432/using-minecrafts-playercontroller-windowclick it says, slot 0 is the crafting table Output, so how could the "parameter" be a slot ID? Cause then, the github example would be wrong
  6. Hmm... But the Method takes this arguments in my opinion: 1) Inventory ID, in code above it's 0 2) Slot ID to interact with 3) whether a right-click 4) Type of interaction 5) The player What do you mean by "taking in two slot IDs"?
  7. Did this windowClick method change since 1.12? I am actually using the same principe as in https://github.com/kulttuuri/quick-hotbar-mod/blob/1.12/src/main/java/com/kulttuuri/quickhotbar/QuickHotbarEventHandler.java#L472
  8. I am using PlayerController.windowClick to organize my Inventory. For testing purpose I have made a loop, that should swap the 9 slots of hotbar with 9 horizontal slots from inventory: Minecraft mc = Minecraft.getInstance(); if ( mc.player == null ) return; PlayerEntity player = mc.player; PlayerController pc = mc.playerController; ClickType click = ClickType.SWAP; for ( int i = 1; i < 4; i ++ ) { for ( int j = 0; j < 9; j ++ ) { int k = j + i * 9; pc.windowClick(0, k, 0, click, player); pc.windowClick(0, k + 9, 0, click, player); pc.windowClick(0, k, 0, click, player); } } It swaps the hotbar slots from 1 to 8 perfectly, but the hotbar slot 0 ( or in inventory it is 36 ) just does not react to windowClick with clickType.SWAP... I tested with clickType.THROW and it dropped the item successfully... What is going on?
  9. Ow... RotateTowards... I tried it out right now, and it looks smooth Now need to figure out, which arguments to pass
  10. Hmm, well, then ๐Ÿคทโ€โ™‚๏ธ I don't want to argue a lot, because, you're right.. Could you still please help me to find this out?
  11. I know the very basics.. I guess it is still not enough.. But I am here to get help I am sorry, but it won't help me, if you tell me, how bad I am
  12. Thank you for your advice, but after going through it, did not have any idea, how to use it ( as mentioned earlier, I was never programming before and was always using MCreator ) private void cursorPosCallback(long handle, double xpos, double ypos) { if (handle == Minecraft.getInstance().getMainWindow().getHandle()) { if (this.ignoreFirstMove) { this.mouseX = xpos; this.mouseY = ypos; this.ignoreFirstMove = false; } IGuiEventListener iguieventlistener = this.minecraft.currentScreen; if (iguieventlistener != null && this.minecraft.loadingGui == null) { double d0 = xpos * (double)this.minecraft.getMainWindow().getScaledWidth() / (double)this.minecraft.getMainWindow().getWidth(); double d1 = ypos * (double)this.minecraft.getMainWindow().getScaledHeight() / (double)this.minecraft.getMainWindow().getHeight(); Screen.wrapScreenError(() -> { iguieventlistener.mouseMoved(d0, d1); }, "mouseMoved event handler", iguieventlistener.getClass().getCanonicalName()); if (this.activeButton != -1 && this.eventTime > 0.0D) { double d2 = (xpos - this.mouseX) * (double)this.minecraft.getMainWindow().getScaledWidth() / (double)this.minecraft.getMainWindow().getWidth(); double d3 = (ypos - this.mouseY) * (double)this.minecraft.getMainWindow().getScaledHeight() / (double)this.minecraft.getMainWindow().getHeight(); Screen.wrapScreenError(() -> { if (net.minecraftforge.client.ForgeHooksClient.onGuiMouseDragPre(this.minecraft.currentScreen, d0, d1, this.activeButton, d2, d3)) return; if (iguieventlistener.mouseDragged(d0, d1, this.activeButton, d2, d3)) return; net.minecraftforge.client.ForgeHooksClient.onGuiMouseDragPost(this.minecraft.currentScreen, d0, d1, this.activeButton, d2, d3); }, "mouseDragged event handler", iguieventlistener.getClass().getCanonicalName()); } } this.minecraft.getProfiler().startSection("mouse"); if (this.isMouseGrabbed() && this.minecraft.isGameFocused()) { this.xVelocity += xpos - this.mouseX; this.yVelocity += ypos - this.mouseY; } this.updatePlayerLook(); this.mouseX = xpos; this.mouseY = ypos; this.minecraft.getProfiler().endSection(); } } public void updatePlayerLook() { double d0 = NativeUtil.getTime(); double d1 = d0 - this.lastLookTime; this.lastLookTime = d0; if (this.isMouseGrabbed() && this.minecraft.isGameFocused()) { double d4 = this.minecraft.gameSettings.mouseSensitivity * (double)0.6F + (double)0.2F; double d5 = d4 * d4 * d4 * 8.0D; double d2; double d3; if (this.minecraft.gameSettings.smoothCamera) { double d6 = this.xSmoother.smooth(this.xVelocity * d5, d1 * d5); double d7 = this.ySmoother.smooth(this.yVelocity * d5, d1 * d5); d2 = d6; d3 = d7; } else { this.xSmoother.reset(); this.ySmoother.reset(); d2 = this.xVelocity * d5; d3 = this.yVelocity * d5; } this.xVelocity = 0.0D; this.yVelocity = 0.0D; int i = 1; if (this.minecraft.gameSettings.invertMouse) { i = -1; } this.minecraft.getTutorial().onMouseMove(d2, d3); if (this.minecraft.player != null) { this.minecraft.player.rotateTowards(d2, d3 * (double)i); } } else { this.xVelocity = 0.0D; this.yVelocity = 0.0D; } } Only things to use in my opinion are "this.minecraft.getProfiler().startSection("mouse");" and "IGuiEventListener iguieventlistener = this.minecraft.currentScreen;", but I have no idea, how to use them as trigger for my function... ๐Ÿ˜ต
  13. @SubscribeEvent public void aim (TickEvent.RenderTickEvent event) { if (event.phase == TickEvent.Phase.START) { if ( Minecraft.getInstance().player == null ) return; PlayerEntity entity = (PlayerEntity) Minecraft.getInstance().player; IWorld world = (IWorld) entity.world; boolean aiming = PlaceModVariables.WorldVariables.get(world).aiming; if ( aiming ) { double d = PlaceModVariables.WorldVariables.get(world).aim_distance; { List<Entity> _entfound = world .getEntitiesWithinAABB(Entity.class, new AxisAlignedBB((entity.getPosX()) - (d / 2d), (entity.getPosY()) - (d / 2d), (entity.getPosZ()) - (d / 2d), (entity.getPosX()) + (d / 2d), (entity.getPosY()) + (d / 2d), (entity.getPosZ()) + (d / 2d)), null) .stream().sorted(new Object() { Comparator<Entity> compareDistOf(double _x, double _y, double _z) { return Comparator.comparing((Function<Entity, Double>) (_entcnd -> _entcnd.getDistanceSq(_x, _y, _z))); } }.compareDistOf((entity.getPosX()), (entity.getPosY()), (entity.getPosZ()))).collect(Collectors.toList()); for (Entity entityiterator : _entfound) { if ((entityiterator != entity) && (entityiterator.getDisplayName().getString().equals( PlaceModVariables.WorldVariables.get(world).aim ) ) ) { double dX = (double) ((entity.getPosX()) - (entityiterator.getPosX())); double dY = (double) ((entity.getPosY() + entity.getHeight()) - (entityiterator.getPosY() + ((entityiterator.getHeight()) / 2 ))); double dZ = (double) ((entity.getPosZ()) - (entityiterator.getPosZ())); float yaw = (float) (Math.toDegrees((Math.atan2(dZ, dX))) + 90); float pitch = (float) ( 263 - (Math.toDegrees((Math.atan2(Math.sqrt(dZ * dZ + dX * dX), dY) + Math.PI )))); entity.rotationYaw = yaw; entity.rotationPitch = pitch; break; } } } } } } This code was partially generated by MCreator ( it's a Scratch-like programm to make mods for minecraft )
  14. public void onPlayerTick(TickEvent.RenderTickEvent event) { if (event.phase == TickEvent.Phase.START) { if (Minecraft.getInstance().player == null) return; PlayerEntity player = Minecraft.getInstance().player; execute ( player ); } } public void execute() { //set rotation of player } Can't post more because I'm on phone right now.
  15. in the method I am testing if player is available and then I call another procedure "aim", and in that I am setting the pitch and rotation
  16. Okaay, it looks better, but still not smooth enough, looks like it's around 25 updates per second, though my FPS-Meter shows I have 60/70 FPS I used public void onPlayerTick(TickEvent.RenderTickEvent event) { if (event.phase == TickEvent.Phase.START) { //... I guess, either "onPlayerTick" is wrong... ๐Ÿ˜•
  17. Oh, thank you!!! I already have tried renderTickEvent, but forgot to set Phase to start ;_; Will test it in some minutes
  18. I am calculating the angle ( trigonometrically ) using coordinates of an entity. By the way, is it possible to do something like "palyer.lookAtEntity(entity)"? That would be faster and less performance-heavy than using square root as I do
  19. I am making a client-side mod, that can rotate users head ( principe like aimbot, but I am creating a map ). I use onPlayerTick to set rotation and pitch, but it's looks awfull, because it "has only 20 fps" What's a faster way to make something? (Minecraft 1.15.2)
  20. oh, I am dumb, just found it in the Minecraft class code ๐Ÿคฆโ€โ™‚๏ธ this.displayGuiScreen(new ChatScreen("/")); ( when command button pressed )
  21. I would like to press some key ( for example "+" ), then it would open the Chatline with already typed text ( for example "/me" ) I am using Minecraft Version 1.15.2 What function do I need to open chat gui and insert some text?
  22. Yes, thank you all, it worked perfectly; in addition, short question: while REACH_DISTANCE is for blocks, how do I change it for entities? Like in the Reach Hack
  23. Nope ๐Ÿ˜… I am now not able to test it, so it was a question

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions โ†’ Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.