This repository has been archived by the owner on May 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
❤️ BedNuker, NoItemRelease, NoRotate, etc.
- Loading branch information
Showing
7 changed files
with
137 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/main/java/dev/stormy/client/module/modules/player/NoRotate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package dev.stormy.client.module.modules.player; | ||
|
||
import dev.stormy.client.module.Module; | ||
import net.minecraft.network.Packet; | ||
import net.minecraft.network.play.server.S08PacketPlayerPosLook; | ||
import net.weavemc.loader.api.event.PacketEvent; | ||
import net.weavemc.loader.api.event.SubscribeEvent; | ||
|
||
public class NoRotate extends Module { | ||
public NoRotate() { | ||
super("NoRotate", ModuleCategory.Player, 0); | ||
} | ||
@SubscribeEvent | ||
public void onPacket(PacketEvent.Receive event) { | ||
final Packet<?> packet = event.getPacket(); | ||
if (packet instanceof S08PacketPlayerPosLook s08) { | ||
s08.yaw = mc.thePlayer.rotationYaw; | ||
s08.pitch = mc.thePlayer.rotationPitch; | ||
} | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
src/main/java/dev/stormy/client/utils/world/WorldUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package dev.stormy.client.utils.world; | ||
|
||
import net.minecraft.block.Block; | ||
import net.minecraft.block.state.IBlockState; | ||
import net.minecraft.init.Blocks; | ||
import net.minecraft.util.BlockPos; | ||
import net.minecraft.world.World; | ||
|
||
public class WorldUtils { | ||
public static BlockPos findNearestBedPos(World world, BlockPos playerPos, int searchRadius) { | ||
BlockPos nearestBedPos = null; | ||
double nearestDistanceSq = Double.MAX_VALUE; | ||
|
||
int minX = playerPos.getX() - searchRadius; | ||
int minY = Math.max(0, playerPos.getY() - searchRadius); | ||
int minZ = playerPos.getZ() - searchRadius; | ||
int maxX = playerPos.getX() + searchRadius; | ||
int maxY = Math.min(world.getHeight(), playerPos.getY() + searchRadius); | ||
int maxZ = playerPos.getZ() + searchRadius; | ||
|
||
for (int x = minX; x <= maxX; x++) { | ||
for (int y = minY; y <= maxY; y++) { | ||
for (int z = minZ; z <= maxZ; z++) { | ||
BlockPos currentPos = new BlockPos(x, y, z); | ||
IBlockState blockState = world.getBlockState(currentPos); | ||
Block block = blockState.getBlock(); | ||
if (block == Blocks.bed) { | ||
double distanceSq = playerPos.distanceSq(currentPos); | ||
if (distanceSq < nearestDistanceSq) { | ||
nearestBedPos = currentPos; | ||
nearestDistanceSq = distanceSq; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
return nearestBedPos; | ||
} | ||
} |