Skip to content

Commit

Permalink
Merge pull request #1 from crazymoose7/1.21.3-port
Browse files Browse the repository at this point in the history
Small rendering fixes (hopefully)
  • Loading branch information
Xtendera authored Jan 14, 2025
2 parents 63ddbef + 2dea577 commit 8c7c94e
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 82 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.8-SNAPSHOT'
id 'fabric-loom' version '1.9-SNAPSHOT'
}

sourceCompatibility = targetCompatibility = JavaVersion.VERSION_21
Expand Down Expand Up @@ -39,7 +39,7 @@ dependencies {
mappings "net.fabricmc:yarn:${project.yarn_version}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

modImplementation("meteordevelopment:meteor-client:${project.meteor_version}-SNAPSHOT")
modImplementation("meteordevelopment:meteor-client:${project.minecraft_version}-SNAPSHOT")
modCompileOnly "meteordevelopment:baritone:${project.baritone_version}-SNAPSHOT"

// seed .locate and ore sim
Expand Down
7 changes: 3 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
org.gradle.jvmargs=-Xmx2G

# Fabric Properties
minecraft_version=1.21.3
yarn_version=1.21.3+build.2
minecraft_version=1.21.4
yarn_version=1.21.4+build.8
loader_version=0.16.9

# Mod Properties
mod_version = 0.3
maven_group = anticope.rejects
archives_base_name = meteor-rejects-addon

meteor_version=0.5.9
baritone_version=1.21.3
baritone_version=1.21.4
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@
import java.util.Map;
import java.util.function.Consumer;

import static net.minecraft.client.render.RenderLayer.getGuiTextured;

/*
Ported from: https://github.com/BleachDrinker420/BleachHack/pull/211
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
package anticope.rejects.mixin;

import net.minecraft.network.packet.c2s.play.VehicleMoveC2SPacket;
import net.minecraft.util.math.Vec3d;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
import org.spongepowered.asm.mixin.gen.Accessor;
import org.spongepowered.asm.mixin.gen.Invoker;

@Mixin(VehicleMoveC2SPacket.class)
public interface VehicleMoveC2SPacketAccessor {
@Mutable
@Accessor("x")
void setX(double x);
@Accessor("position")
Vec3d getPosition();

@Mutable
@Accessor("z")
void setZ(double z);
@Invoker("<init>")
static VehicleMoveC2SPacket create(Vec3d position, float yaw, float pitch, boolean onGround) {
throw new AssertionError();
}
}
1 change: 0 additions & 1 deletion src/main/java/anticope/rejects/modules/AntiCrash.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import meteordevelopment.meteorclient.settings.SettingGroup;
import meteordevelopment.meteorclient.systems.modules.Module;
import meteordevelopment.orbit.EventHandler;
import net.minecraft.entity.player.PlayerPosition;
import net.minecraft.network.packet.s2c.play.EntityVelocityUpdateS2CPacket;
import net.minecraft.network.packet.s2c.play.ExplosionS2CPacket;
import net.minecraft.network.packet.s2c.play.ParticleS2CPacket;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/anticope/rejects/modules/AutoWither.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ private void onTick(TickEvent.Pre event) {

// Register
BlockIterator.register(horizontalRadius.get(), verticalRadius.get(), (blockPos, blockState) -> {
Direction dir = Direction.fromRotation(Rotations.getYaw(blockPos)).getOpposite();
Direction dir = Direction.fromHorizontalDegrees(Rotations.getYaw(blockPos)).getOpposite();
if (isValidSpawn(blockPos, dir)) withers.add(witherPool.get().set(blockPos, dir));
});
}
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/anticope/rejects/modules/NewChunks.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;

import static net.minecraft.world.Heightmap.Type.MOTION_BLOCKING;

/*
Ported from: https://github.com/BleachDrinker420/BleachHack/blob/master/BleachHack-Fabric-1.16/src/main/java/bleach/hack/module/mods/NewChunks.java
*/
Expand Down
51 changes: 14 additions & 37 deletions src/main/java/anticope/rejects/modules/Rendering.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,17 @@
import meteordevelopment.meteorclient.settings.SettingGroup;
import meteordevelopment.meteorclient.systems.modules.Module;
import net.minecraft.client.gl.PostEffectProcessor;
import net.minecraft.client.render.DefaultFramebufferSet;
import net.minecraft.util.Identifier;

import java.io.IOException;

public class Rendering extends Module {

public enum Shader {
None,
Notch,
FXAA,
Art,
Bumpy,
Blobs,
Blobs2,
Pencil,
Vibrant,
Deconverge,
Flip,
Invert,
NTSC,
Outline,
Phosphor,
Scanline,
Sobel,
Bits,
Desaturate,
Green,
Blur,
Wobble,
Antialias,
Creeper,
Spider
Invert,
Spider,
}

private final SettingGroup sgInvisible = settings.createGroup("Invisible");
Expand Down Expand Up @@ -102,19 +81,17 @@ public void onDeactivate() {
}

public void onChanged(Shader s) {
String name;
if (s == Shader.Vibrant) name = "color_convolve";
else if (s == Shader.Scanline) name = "scan_pincushion";
else name = s.toString().toLowerCase();
Identifier shaderID = Identifier.of(String.format("shaders/post/%s.json", name));
// TODO: How do I fix this? I don't know. - xtendera
// It might be helpful to check out https://github.com/Ladysnake/Satin/blob/7da140228c1946ffa707da905c497fd6bc2e950c/1_21_2_model.md
// try {
// PostEffectProcessor shader = new PostEffectProcessor(mc.getTextureManager(), mc.getResourceManager(), mc.getFramebuffer(), shaderID);
// this.shader = shader;
// } catch (IOException e) {
// this.shader = null;
// }
if (mc.world == null) return;
String name = s.toString().toLowerCase();

if (name.equals("none")) {
this.shader = null;
return;
}

Identifier shaderID = Identifier.ofVanilla(name);
PostEffectProcessor shader = mc.getShaderLoader().loadPostEffect(shaderID, DefaultFramebufferSet.MAIN_ONLY);
this.shader = shader;
}

public boolean renderStructureVoid() {
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/anticope/rejects/modules/RoboWalk.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import meteordevelopment.orbit.EventHandler;
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
import net.minecraft.network.packet.c2s.play.VehicleMoveC2SPacket;
import net.minecraft.util.math.Vec3d;

public class RoboWalk extends Module {
public RoboWalk() {
Expand All @@ -30,11 +31,11 @@ private void onPacketSend(PacketEvent.Send event) {
((PlayerMoveC2SPacketAccessor) packet).setX(x);
((PlayerMoveC2SPacketAccessor) packet).setZ(z);
} else if (event.packet instanceof VehicleMoveC2SPacket packet) {
double x = smooth(packet.getX());
double z = smooth(packet.getZ());
Vec3d pos = ((VehicleMoveC2SPacketAccessor) (Object) packet).getPosition();
double x = smooth(pos.getX());
double z = smooth(pos.getZ());

((VehicleMoveC2SPacketAccessor) packet).setX(x);
((VehicleMoveC2SPacketAccessor) packet).setZ(z);
event.packet = VehicleMoveC2SPacketAccessor.create(new Vec3d(x, pos.getY(), z), packet.yaw(), packet.pitch(), packet.onGround());
}
}
}
3 changes: 1 addition & 2 deletions src/main/java/anticope/rejects/modules/SkeletonESP.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ private void onRender(Render3DEvent event) {
float k = j - h;
float m = playerEntity.getPitch(g);
if (mc.player == entity && Rotations.rotationTimer < rotationHoldTicks) m = Rotations.serverPitch;
// TODO: Fix this as well. Not only do I not know what it does, I also cannot figure out how to update this. - xtendera
// playerEntityModel.animateModel(playerEntity, q, p, g);

PlayerEntityRenderState renderState = new PlayerEntityRenderState();
renderState.limbFrequency = q;
renderState.limbAmplitudeMultiplier = p;
Expand Down
18 changes: 3 additions & 15 deletions src/main/java/anticope/rejects/modules/TreeAura.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package anticope.rejects.modules;

import anticope.rejects.MeteorRejectsAddon;
import anticope.rejects.utils.WorldUtils;
import meteordevelopment.meteorclient.events.world.TickEvent;
import meteordevelopment.meteorclient.settings.*;
import meteordevelopment.meteorclient.systems.modules.Module;
Expand Down Expand Up @@ -139,22 +140,9 @@ private boolean canPlant(BlockPos pos) {
return false;
}

private List<BlockPos> getBlocks(BlockPos centerPos, int radius, int height) {
ArrayList<BlockPos> blocks = new ArrayList<>();
for (int i = centerPos.getX() - radius; i < centerPos.getX() + radius; i++) {
for (int j = centerPos.getY() - height; j < centerPos.getY() + height; j++) {
for (int k = centerPos.getZ() - radius; k < centerPos.getZ() + radius; k++) {
BlockPos pos = new BlockPos(i, j, k);
if (distanceBetween(centerPos, pos) <= radius && !blocks.contains(pos)) blocks.add(pos);
}
}
}
return blocks;
}

private List<BlockPos> findSaplings(BlockPos centerPos, int radius, int height) {
ArrayList<BlockPos> blocc = new ArrayList<>();
List<BlockPos> blocks = getBlocks(centerPos, radius, height);
List<BlockPos> blocks = WorldUtils.getSphere(centerPos, radius, height);
for (BlockPos b : blocks) if (isSapling(b)) blocc.add(b);
return blocc;
}
Expand All @@ -169,7 +157,7 @@ private BlockPos findPlantedSapling() {

private List<BlockPos> getPlantLocations(BlockPos centerPos, int radius, int height) {
ArrayList<BlockPos> blocc = new ArrayList<>();
List<BlockPos> blocks = getBlocks(centerPos, radius, height);
List<BlockPos> blocks = WorldUtils.getSphere(centerPos, radius, height);
for (BlockPos b : blocks) if (canPlant(b)) blocc.add(b);
return blocc;
}
Expand Down
8 changes: 3 additions & 5 deletions src/main/java/anticope/rejects/utils/WorldUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
import meteordevelopment.meteorclient.utils.player.FindItemResult;
import meteordevelopment.meteorclient.utils.player.InvUtils;
import meteordevelopment.meteorclient.utils.player.Rotations;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.Hand;
import net.minecraft.util.PlayerInput;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
Expand Down Expand Up @@ -43,13 +41,13 @@ public static double distanceBetween(BlockPos pos1, BlockPos pos2) {
public static boolean interact(BlockPos pos, FindItemResult findItemResult, boolean rotate) {
if (!findItemResult.found()) return false;
Runnable action = () -> {
PlayerInput oldInput = mc.player.input.playerInput;
mc.player.input.playerInput = new PlayerInput(oldInput.forward(), oldInput.backward(), oldInput.left(), oldInput.right(), oldInput.jump(), false, oldInput.sprint());
boolean wasSneaking = mc.player.isSneaking();
mc.player.setSneaking(false);
InvUtils.swap(findItemResult.slot(), true);
mc.interactionManager.interactBlock(mc.player, Hand.MAIN_HAND, new BlockHitResult(Vec3d.ofCenter(pos), Direction.UP, pos, false));
mc.player.swingHand(Hand.MAIN_HAND);
InvUtils.swapBack();
mc.player.input.playerInput = oldInput;
mc.player.setSneaking(wasSneaking);
};
if (rotate) Rotations.rotate(Rotations.getYaw(pos), Rotations.getPitch(pos), -100, action);
else action.run();
Expand Down

0 comments on commit 8c7c94e

Please sign in to comment.