Skip to content

Commit

Permalink
1.20
Browse files Browse the repository at this point in the history
It works
  • Loading branch information
bluepanee committed Jun 19, 2023
1 parent b5a8fb0 commit a13953c
Show file tree
Hide file tree
Showing 13 changed files with 67 additions and 63 deletions.
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
org.gradle.jvmargs=-Xmx2G

# Fabric Properties
minecraft_version=1.19.4
yarn_version=1.19.4+build.1
loader_version=0.14.17
minecraft_version=1.20
yarn_version=1.20+build.1
loader_version=0.14.21

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

meteor_version=0.5.3
meteor_version=0.5.4
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public void build(LiteralArgumentBuilder<CommandSource> builder) {
if (info != null) {
mc.world.disconnect();
ConnectScreen.connect(new MultiplayerScreen(new TitleScreen()), mc,
ServerAddress.parse(info.address), info);
ServerAddress.parse(info.address), info, false);
}
return SINGLE_SUCCESS;
});
Expand Down
73 changes: 38 additions & 35 deletions src/main/java/anticope/rejects/gui/screens/InteractionScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import meteordevelopment.starscript.utils.Error;
import meteordevelopment.starscript.utils.StarscriptError;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.ingame.InventoryScreen;
Expand Down Expand Up @@ -238,27 +239,29 @@ public boolean isPauseScreen() {
return false;
}

public void render(MatrixStack matrix, int mouseX, int mouseY, float delta) {
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
MatrixStack matrix = context.getMatrices();
// Fake crosshair stuff
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.setShader(GameRenderer::getPositionTexProgram);
RenderSystem.setShaderTexture(0, GUI_ICONS_TEXTURE);
// idk, GUI_ICONS_TEXTURE does not exists
// RenderSystem.setShaderTexture(0, GUI_ICONS_TEXTURE);
RenderSystem.enableBlend();
RenderSystem.blendFuncSeparate(GlStateManager.SrcFactor.ONE_MINUS_DST_COLOR,
GlStateManager.DstFactor.ONE_MINUS_SRC_COLOR, GlStateManager.SrcFactor.ONE,
GlStateManager.DstFactor.ZERO);
drawTexture(matrix, crosshairX - 8, crosshairY - 8, 0, 0, 15, 15);
// idk, Identifier is required
// context.drawTexture(matrix, crosshairX - 8, crosshairY - 8, 0, 0, 15, 15);

drawDots(matrix, (int) (Math.min(height, width) / 2 * 0.75), mouseX, mouseY);
drawDots(context, (int) (Math.min(height, width) / 2 * 0.75), mouseX, mouseY);
matrix.scale(2f, 2f, 1f);
drawCenteredTextWithShadow(matrix, textRenderer, entity.getName(), width / 4, 6, 0xFFFFFFFF);
context.drawCenteredTextWithShadow(textRenderer, entity.getName(), width / 4, 6, 0xFFFFFFFF);

int scale = client.options.getGuiScale().getValue();
Vector2 mouse = new Vector2(mouseX, mouseY);
Vector2 center = new Vector2(width / 2, height / 2);
mouse.subtract(center);
mouse.normalize();
Vector2 cross = mouse;

if (scale == 0)
scale = 4;
Expand All @@ -272,13 +275,13 @@ public void render(MatrixStack matrix, int mouseX, int mouseY, float delta) {
this.crosshairX = (int) mouse.x + width / 2;
this.crosshairY = (int) mouse.y + height / 2;

client.player.setYaw(yaw + cross.x / 3);
client.player.setPitch(MathHelper.clamp(pitch + cross.y / 3, -90f, 90f));
super.render(matrix, mouseX, mouseY, delta);
client.player.setYaw(yaw + mouse.x / 3);
client.player.setPitch(MathHelper.clamp(pitch + mouse.y / 3, -90f, 90f));
super.render(context, mouseX, mouseY, delta);
}


private void drawDots(MatrixStack matrix, int radius, int mouseX, int mouseY) {
private void drawDots(DrawContext context, int radius, int mouseX, int mouseY) {
ArrayList<Point> pointList = new ArrayList<Point>();
String cache[] = new String[functions.size()];
double lowestDistance = Double.MAX_VALUE;
Expand All @@ -289,7 +292,7 @@ private void drawDots(MatrixStack matrix, int radius, int mouseX, int mouseY) {
double s = (double) i / functions.size() * 2 * Math.PI;
int x = (int) Math.round(radius * Math.cos(s) + width / 2);
int y = (int) Math.round(radius * Math.sin(s) + height / 2);
drawTextField(matrix, x, y, string);
drawTextField(context, x, y, string);

// Calculate lowest distance between mouse and dot
if (Math.hypot(x - mouseX, y - mouseY) < lowestDistance) {
Expand All @@ -306,46 +309,46 @@ private void drawDots(MatrixStack matrix, int radius, int mouseX, int mouseY) {
for (int j = 0; j < functions.size(); j++) {
Point point = pointList.get(j);
if (pointList.get(focusedDot) == point) {
drawDot(matrix, point.x - 4, point.y - 4, selectedDotColor);
drawDot(context, point.x - 4, point.y - 4, selectedDotColor);
this.focusedString = cache[focusedDot];
} else
drawDot(matrix, point.x - 4, point.y - 4, dotColor);
drawDot(context, point.x - 4, point.y - 4, dotColor);
}
}

private void drawRect(MatrixStack matrix, int startX, int startY, int width, int height, int colorInner, int colorOuter) {
drawHorizontalLine(matrix, startX, startX + width, startY, colorOuter);
drawHorizontalLine(matrix, startX, startX + width, startY + height, colorOuter);
drawVerticalLine(matrix, startX, startY, startY + height, colorOuter);
drawVerticalLine(matrix, startX + width, startY, startY + height, colorOuter);
fill(matrix, startX + 1, startY + 1, startX + width, startY + height, colorInner);
private void drawRect(DrawContext context, int startX, int startY, int width, int height, int colorInner, int colorOuter) {
context.drawHorizontalLine(startX, startX + width, startY, colorOuter);
context.drawHorizontalLine(startX, startX + width, startY + height, colorOuter);
context.drawVerticalLine(startX, startY, startY + height, colorOuter);
context.drawVerticalLine(startX + width, startY, startY + height, colorOuter);
context.fill(startX + 1, startY + 1, startX + width, startY + height, colorInner);
}

private void drawTextField(MatrixStack matrix, int x, int y, String key) {
private void drawTextField(DrawContext context, int x, int y, String key) {
if (x >= width / 2) {
drawRect(matrix, x + 10, y - 8, textRenderer.getWidth(key) + 3, 15, backgroundColor, borderColor);
drawTextWithShadow(matrix, textRenderer, key, x + 12, y - 4, textColor);
drawRect(context,x + 10, y - 8, textRenderer.getWidth(key) + 3, 15, backgroundColor, borderColor);
context.drawTextWithShadow(textRenderer, key, x + 12, y - 4, textColor);
} else {
drawRect(matrix, x - 14 - textRenderer.getWidth(key), y - 8, textRenderer.getWidth(key) + 3, 15, backgroundColor, borderColor);
drawTextWithShadow(matrix, textRenderer, key, x - 12 - textRenderer.getWidth(key), y - 4, textColor);
drawRect(context, x - 14 - textRenderer.getWidth(key), y - 8, textRenderer.getWidth(key) + 3, 15, backgroundColor, borderColor);
context.drawTextWithShadow(textRenderer, key, x - 12 - textRenderer.getWidth(key), y - 4, textColor);
}
}

// Literally drawing it in code
private void drawDot(MatrixStack matrix, int startX, int startY, int colorInner) {
private void drawDot(DrawContext context, int startX, int startY, int colorInner) {
// Draw dot itself
drawHorizontalLine(matrix, startX + 2, startX + 5, startY, borderColor);
drawHorizontalLine(matrix, startX + 1, startX + 6, startY + 1, borderColor);
drawHorizontalLine(matrix, startX + 2, startX + 5, startY + 1, colorInner);
fill(matrix, startX, startY + 2, startX + 8, startY + 6, borderColor);
fill(matrix, startX + 1, startY + 2, startX + 7, startY + 6, colorInner);
drawHorizontalLine(matrix, startX + 1, startX + 6, startY + 6, borderColor);
drawHorizontalLine(matrix, startX + 2, startX + 5, startY + 6, colorInner);
drawHorizontalLine(matrix, startX + 2, startX + 5, startY + 7, borderColor);
context.drawHorizontalLine(startX + 2, startX + 5, startY, borderColor);
context.drawHorizontalLine(startX + 1, startX + 6, startY + 1, borderColor);
context.drawHorizontalLine(startX + 2, startX + 5, startY + 1, colorInner);
context.fill(startX, startY + 2, startX + 8, startY + 6, borderColor);
context.fill(startX + 1, startY + 2, startX + 7, startY + 6, colorInner);
context.drawHorizontalLine(startX + 1, startX + 6, startY + 6, borderColor);
context.drawHorizontalLine(startX + 2, startX + 5, startY + 6, colorInner);
context.drawHorizontalLine(startX + 2, startX + 5, startY + 7, borderColor);

// Draw light overlay
drawHorizontalLine(matrix, startX + 2, startX + 3, startY + 1, 0x80FFFFFF);
drawHorizontalLine(matrix, startX + 1, startX + 1, startY + 2, 0x80FFFFFF);
context.drawHorizontalLine(startX + 2, startX + 3, startY + 1, 0x80FFFFFF);
context.drawHorizontalLine(startX + 1, startX + 1, startY + 2, 0x80FFFFFF);
}

private class StaticListener {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/anticope/rejects/gui/screens/StatsScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ private void updateData() {
liv.getActiveStatusEffects().forEach((effect, instance) -> {
String status = lang.get(effect.getTranslationKey());
if (instance.getAmplifier() != 0) {
status += (String.format(" %d (%s)", instance.getAmplifier()+1, StatusEffectUtil.durationToString(instance, 1)));
status += (String.format(" %d (%s)", instance.getAmplifier()+1, StatusEffectUtil.getDurationText(instance, 1)));
} else {
status += (String.format(" (%s)", StatusEffectUtil.durationToString(instance, 1)));
status += (String.format(" (%s)", StatusEffectUtil.getDurationText(instance, 1)));
}
effectList.add(theme.label(status)).expandX();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, doub
double pad = pad();

animationProgress1 += delta * 4 * ((module.isActive() || mouseOver) ? 1 : -1);
animationProgress1 = Utils.clamp(animationProgress1, 0, 1);
animationProgress1 = Math.max(0, Math.min(1, animationProgress1));

animationProgress2 += delta * 6 * (module.isActive() ? 1 : -1);
animationProgress2 = Utils.clamp(animationProgress2, 0, 1);
animationProgress2 = Math.max(0, Math.min(1, animationProgress2));

if (animationProgress1 > 0) {
renderer.quad(x, y, width * animationProgress1, height, theme.moduleBackground.get());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ else if (placeholder != null) {

// Cursor
animProgress += delta * 10 * (focused && cursorVisible ? 1 : -1);
animProgress = Utils.clamp(animProgress, 0, 1);
animProgress = Math.max(0, Math.min(1, animProgress));

if ((focused && cursorVisible) || animProgress > 0) {
renderer.setAlpha(animProgress);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, doub
MeteorRoundedGuiTheme theme = theme();

animProgress += (checked ? 1 : -1) * delta * 14;
animProgress = Utils.clamp(animProgress, 0, 1);
animProgress = Math.max(0, Math.min(1, animProgress));

renderBackground(renderer, this, pressed, mouseOver);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import anticope.rejects.mixininterface.INoRender;
import meteordevelopment.meteorclient.systems.modules.Modules;
import meteordevelopment.meteorclient.systems.modules.render.NoRender;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.ChatInputSuggestor;
import net.minecraft.client.util.math.MatrixStack;
import org.spongepowered.asm.mixin.Mixin;
Expand All @@ -13,7 +14,7 @@
@Mixin(ChatInputSuggestor.class)
public class CommandSuggestorMixin {
@Inject(method = "render", at = @At(value = "HEAD"), cancellable = true)
public void onRenderCommandSuggestion(MatrixStack matrices, int mouseX, int mouseY, CallbackInfo info) {
public void onRenderCommandSuggestion(DrawContext context, int mouseX, int mouseY, CallbackInfo info) {
if (((INoRender) Modules.get().get(NoRender.class)).noCommandSuggestions()) info.cancel();
}
}
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 @@ -301,7 +301,7 @@ private boolean isValidSpawn(BlockPos blockPos, Direction direction) {
for (int z = blockPos.getZ() - widthZ; z <= blockPos.getZ(); z++) {
for (int y = blockPos.getY(); y <= blockPos.getY() + 2; y++) {
bp.set(x, y, z);
if (!mc.world.getBlockState(bp).getMaterial().isReplaceable()) return false;
if (!mc.world.getBlockState(bp).isReplaceable()) return false;
if (!mc.world.canPlace(Blocks.STONE.getDefaultState(), bp, ShapeContext.absent())) return false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/anticope/rejects/modules/Confuse.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ private void onTick(TickEvent.Pre event) {

case Switch:
Vec3d diff = entityPos.subtract(playerPos);
Vec3d diff1 = new Vec3d(Utils.clamp(diff.x, -halfRange, halfRange), Utils.clamp(diff.y, -halfRange, halfRange), Utils.clamp(diff.z, -halfRange, halfRange));
Vec3d diff1 = new Vec3d(Math.max(-halfRange, Math.min(halfRange, diff.x)), Math.max(-halfRange, Math.min(halfRange, diff.y)), Math.max(-halfRange, Math.min(halfRange, diff.z)));
Vec3d goal2 = entityPos.add(diff1);
hit = mc.world.raycast(new RaycastContext(mc.player.getPos(), goal2, RaycastContext.ShapeType.COLLIDER, RaycastContext.FluidHandling.ANY, mc.player));
if (!moveThroughBlocks.get() && hit.isInsideBlock()) {
Expand Down
18 changes: 9 additions & 9 deletions src/main/java/anticope/rejects/modules/Painter.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@ private void onTick(TickEvent.Post event) {

private boolean shouldPlace(BlockPos blockPos, Block useBlock) {
// Self
if (!mc.world.getBlockState(blockPos).getMaterial().isReplaceable()) return false;
if (!mc.world.getBlockState(blockPos).isReplaceable()) return false;

// One block height
if (!oneBlockHeight.get() &&
!mc.world.getBlockState(blockPos.up()).getMaterial().isReplaceable() &&
!mc.world.getBlockState(blockPos.down()).getMaterial().isReplaceable()) return false;
!mc.world.getBlockState(blockPos.up()).isReplaceable() &&
!mc.world.getBlockState(blockPos.down()).isReplaceable()) return false;


boolean north = true;
Expand All @@ -144,21 +144,21 @@ private boolean shouldPlace(BlockPos blockPos, Block useBlock) {

// Top surface
if (topSurfaces.get()) {
if (upState.getMaterial().isReplaceable() || upState.getBlock() == useBlock) up = false;
if (upState.isReplaceable() || upState.getBlock() == useBlock) up = false;
}

// Side surfaces
if (sideSurfaces.get()) {

if (northState.getMaterial().isReplaceable() || northState.getBlock() == useBlock) north = false;
if (southState.getMaterial().isReplaceable() || southState.getBlock() == useBlock) south = false;
if (eastState.getMaterial().isReplaceable() || eastState.getBlock() == useBlock) east = false;
if (westState.getMaterial().isReplaceable() || westState.getBlock() == useBlock) west = false;
if (northState.isReplaceable() || northState.getBlock() == useBlock) north = false;
if (southState.isReplaceable() || southState.getBlock() == useBlock) south = false;
if (eastState.isReplaceable() || eastState.getBlock() == useBlock) east = false;
if (westState.isReplaceable() || westState.getBlock() == useBlock) west = false;
}

// Bottom surface
if (bottomSurfaces.get()) {
if (bottomState.getMaterial().isReplaceable() || bottomState.getBlock() == useBlock) bottom = false;
if (bottomState.isReplaceable() || bottomState.getBlock() == useBlock) bottom = false;
}

return north || south || east || west || up || bottom;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/anticope/rejects/modules/ShieldBypass.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private void onAttackEntity(AttackEntityEvent event) {
Vec3d newPos = tp.add(e.getPos());
BlockPos pos = BlockPos.ofFloored(newPos);
for (int i = -2; i <= 2; i++) {
if (mc.player.world.getBlockState(pos.up(i)).isAir() && mc.player.world.getBlockState(pos).isAir()) {
if (mc.player.getWorld().getBlockState(pos.up(i)).isAir() && mc.player.getWorld().getBlockState(pos).isAir()) {
this.originalPos = originalPos;
if (rotate.get()) Rotations.rotate(-mc.player.getYaw(), mc.player.getPitch(), -10);
target = e;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.mojang.authlib.Environment;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.exceptions.AuthenticationException;
import com.mojang.authlib.minecraft.InsecureTextureException;
import com.mojang.authlib.minecraft.InsecurePublicKeyException;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.authlib.properties.Property;
import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
Expand Down Expand Up @@ -134,11 +134,11 @@ public Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> getTextures(fi
if (requireSecure) {
if (!textureProperty.hasSignature()) {
LOGGER.error("Signature is missing from textures payload");
throw new InsecureTextureException("Signature is missing from textures payload");
throw new InsecurePublicKeyException("Signature is missing from textures payload");
}
if (!textureProperty.isSignatureValid(publicKey)) {
LOGGER.error("Textures payload has been tampered with (signature invalid)");
throw new InsecureTextureException("Textures payload has been tampered with (signature invalid)");
throw new InsecurePublicKeyException("Textures payload has been tampered with (signature invalid)");
}
}

Expand Down

0 comments on commit a13953c

Please sign in to comment.