Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into master-ame
Browse files Browse the repository at this point in the history
# Conflicts:
#	build.gradle
#	src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayerEntityMixin.java
#	src/main/java/meteordevelopment/meteorclient/systems/commands/Commands.java
#	src/main/java/meteordevelopment/meteorclient/systems/modules/player/AutoTool.java
#	src/main/resources/meteor-client.accesswidener
  • Loading branch information
JFronny committed Dec 13, 2022
2 parents 5998eb0 + 790d9b3 commit 7e5db0c
Show file tree
Hide file tree
Showing 173 changed files with 2,034 additions and 1,405 deletions.
18 changes: 13 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '0.12-SNAPSHOT'
id 'fabric-loom' version '1.0-SNAPSHOT'
id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '7.1.2'
}
Expand All @@ -20,7 +20,15 @@ repositories {
url = "https://maven.meteordev.org/snapshots"
}
maven {
url "https://gitlab.com/api/v4/projects/25805200/packages/maven"
name = "modrinth"
url = "https://api.modrinth.com/maven"

content {
includeGroup "maven.modrinth"
}
}
maven {
url = "https://maven.frohnmeyer-wds.de/artifacts"
}
maven {
name = "vram"
Expand All @@ -47,9 +55,9 @@ dependencies {
transitive = false
}

// Compat fixes
modCompileOnly("me.jellysquid.mods:sodium-fabric:${project.sodium_version}") { transitive = false }
modCompileOnly("io.vram:canvas-fabric-mc119:1.0.+") { transitive = false }
// Compat fixes
modCompileOnly("maven.modrinth:sodium:${project.sodium_version}") { transitive = false }
//modCompileOnly("io.vram:canvas-fabric-mc119:1.0.+") { transitive = false } // TODO: 1.19.3

// Baritone (https://github.com/MeteorDevelopment/baritone)
modInclude "baritone:fabric:${project.minecraft_version}-SNAPSHOT"
Expand Down
14 changes: 7 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
org.gradle.jvmargs=-Xmx2G

# Fabric (https://fabricmc.net/develop)
minecraft_version=1.19.2
yarn_mappings=1.19.2+build.9
loader_version=0.14.9
fapi_version=0.60.0+1.19.2
minecraft_version=1.19.3
yarn_mappings=1.19.3+build.2
loader_version=0.14.11
fapi_version=0.68.1+1.19.3

# Mod Properties
mod_version=0.5.1
mod_version=0.5.2
maven_group=meteordevelopment
archives_base_name=meteor-client

# Dependency Versions

# Sodium (https://github.com/CaffeineMC/sodium-fabric)
sodium_version=0.4.2
sodium_version=mc1.19.3-0.4.6

# Orbit (https://github.com/MeteorDevelopment/orbit)
orbit_version=0.2.3
Expand All @@ -23,7 +23,7 @@ orbit_version=0.2.3
starscript_version=0.2.2

# LibJF (https://gitlab.com/jfmods/libjf)
libjf_version=3.0.3
libjf_version=3.3.1

# Reflections (https://github.com/ronmamo/reflections)
reflections_version=0.10.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ public String getCommit() {
MeteorAddon addon = entrypoint.getEntrypoint();

addon.name = metadata.getName();

if (metadata.getAuthors().isEmpty()) throw new RuntimeException("Addon %s requires at least 1 author to be defined in it's fabric.mod.json. See https://fabricmc.net/wiki/documentation:fabric_mod_json_spec".formatted(addon.name));
addon.authors = new String[metadata.getAuthors().size()];

if (metadata.containsCustomValue(MeteorClient.MOD_ID + ":color")) {
addon.color.parse(metadata.getCustomValue(MeteorClient.MOD_ID + ":color").getAsString());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client).
* Copyright (c) Meteor Development.
*/

package meteordevelopment.meteorclient.events.game;

import net.minecraft.item.ItemStack;

public class SectionVisibleEvent {
private static final SectionVisibleEvent INSTANCE = new SectionVisibleEvent();

public ItemStack.TooltipSection section;
public boolean visible;

public static SectionVisibleEvent get(ItemStack.TooltipSection section, boolean visible) {
INSTANCE.section = section;
INSTANCE.visible = visible;
return INSTANCE;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client).
* Copyright (c) Meteor Development.
*/

package meteordevelopment.meteorclient.events.packets;

import net.minecraft.network.packet.s2c.play.InventoryS2CPacket;

public class InventoryEvent {
private static final InventoryEvent INSTANCE = new InventoryEvent();

public InventoryS2CPacket packet;

public static InventoryEvent get(InventoryS2CPacket packet) {
INSTANCE.packet = packet;
return INSTANCE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import it.unimi.dsi.fastutil.ints.IntList;
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
import meteordevelopment.meteorclient.gui.screens.settings.*;
import meteordevelopment.meteorclient.gui.themes.meteor.widgets.WMeteorLabel;
import meteordevelopment.meteorclient.gui.utils.Cell;
import meteordevelopment.meteorclient.gui.utils.CharFilter;
import meteordevelopment.meteorclient.gui.utils.SettingsWidgetFactory;
Expand All @@ -26,7 +27,9 @@
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;

import static meteordevelopment.meteorclient.MeteorClient.mc;

Expand Down Expand Up @@ -415,9 +418,19 @@ private void colorListWFill(WTable t, ColorListSetting setting) {
// Other

private void selectW(WContainer c, Setting<?> setting, Runnable action) {
WButton button = c.add(theme.button("Select")).expandCellX().widget();
boolean addCount = WSelectedCountLabel.getSize(setting) != -1;

WContainer c2 = c;
if (addCount) {
c2 = c.add(theme.horizontalList()).expandCellX().widget();
((WHorizontalList) c2).spacing *= 2;
}

WButton button = c2.add(theme.button("Select")).expandCellX().widget();
button.action = action;

if (addCount) c2.add(new WSelectedCountLabel(setting).color(theme.textSecondaryColor()));

reset(c, setting, null);
}

Expand All @@ -428,4 +441,34 @@ private void reset(WContainer c, Setting<?> setting, Runnable action) {
if (action != null) action.run();
};
}

private static class WSelectedCountLabel extends WMeteorLabel {
private final Setting<?> setting;
private int lastSize = -1;

public WSelectedCountLabel(Setting<?> setting) {
super("", false);

this.setting = setting;
}

@Override
protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
int size = getSize(setting);

if (size != lastSize) {
set("(" + size + " selected)");
lastSize = size;
}

super.onRender(renderer, mouseX, mouseY, delta);
}

public static int getSize(Setting<?> setting) {
if (setting.get() instanceof Collection<?> collection) return collection.size();
if (setting.get() instanceof Map<?, ?> map) return map.size();

return -1;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Set;

import static meteordevelopment.meteorclient.utils.Utils.getWindowHeight;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import meteordevelopment.meteorclient.utils.misc.ISerializable;
import meteordevelopment.meteorclient.utils.misc.Names;
import net.minecraft.block.Block;
import net.minecraft.util.registry.Registry;
import net.minecraft.registry.Registries;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
Expand Down Expand Up @@ -57,7 +57,7 @@ public void initWidgets() {
}

public <T extends ICopyable<T> & ISerializable<T> & IChangeable & IBlockData<T>> void initTable() {
for (Block block : Registry.BLOCK) {
for (Block block : Registries.BLOCK) {
T blockData = (T) setting.get().get(block);

if (blockData != null && blockData.isChanged()) BLOCKS.add(0, block);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import meteordevelopment.meteorclient.utils.misc.Names;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;

import java.util.List;
import java.util.function.Predicate;
Expand All @@ -23,7 +23,7 @@ public class BlockListSettingScreen extends LeftRightListSettingScreen<Block> {
private static final Identifier ID = new Identifier("minecraft", "");

public BlockListSettingScreen(GuiTheme theme, Setting<List<Block>> setting) {
super(theme, "Select Blocks", setting, setting.get(), Registry.BLOCK);
super(theme, "Select Blocks", setting, setting.get(), Registries.BLOCK);
}

@Override
Expand All @@ -46,15 +46,15 @@ protected String getValueName(Block value) {

@Override
protected boolean skipValue(Block value) {
return Registry.BLOCK.getId(value).getPath().endsWith("_wall_banner");
return Registries.BLOCK.getId(value).getPath().endsWith("_wall_banner");
}

@Override
protected Block getAdditionalValue(Block value) {
String path = Registry.BLOCK.getId(value).getPath();
String path = Registries.BLOCK.getId(value).getPath();
if (!path.endsWith("_banner")) return null;

((IdentifierAccessor) ID).setPath(path.substring(0, path.length() - 6) + "wall_banner");
return Registry.BLOCK.get(ID);
return Registries.BLOCK.get(ID);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import meteordevelopment.meteorclient.utils.misc.Names;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.util.registry.Registry;
import net.minecraft.registry.Registries;
import org.apache.commons.lang3.StringUtils;

public class BlockSettingScreen extends WindowScreen {
Expand Down Expand Up @@ -49,7 +49,7 @@ public void initWidgets() {
}

private void initTable() {
for (Block block : Registry.BLOCK) {
for (Block block : Registries.BLOCK) {
if (setting.filter != null && !setting.filter.test(block)) continue;
if (skipValue(block)) continue;

Expand All @@ -68,6 +68,6 @@ private void initTable() {
}

protected boolean skipValue(Block value) {
return value == Blocks.AIR || Registry.BLOCK.getId(value).getPath().endsWith("_wall_banner");
return value == Blocks.AIR || Registries.BLOCK.getId(value).getPath().endsWith("_wall_banner");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,12 @@ public boolean fromClipboard() {
SettingColor parsed;

if ((parsed = parseRGBA(clipboard)) != null) {
setting.get().rainbow(false);
setting.set(parsed);
setting.get().validate();
return true;
}

if ((parsed = parseHex(clipboard)) != null) {
setting.get().rainbow(false);
setting.set(parsed);
setting.get().validate();
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
import meteordevelopment.meteorclient.settings.Setting;
import meteordevelopment.meteorclient.utils.misc.Names;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.util.registry.Registry;
import net.minecraft.registry.Registries;

import java.util.List;

public class EnchantmentListSettingScreen extends LeftRightListSettingScreen<Enchantment> {
public EnchantmentListSettingScreen(GuiTheme theme, Setting<List<Enchantment>> setting) {
super(theme, "Select Enchantments", setting, setting.get(), Registry.ENCHANTMENT);
super(theme, "Select Enchantments", setting, setting.get(), Registries.ENCHANTMENT);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@
import meteordevelopment.meteorclient.utils.entity.EntityUtils;
import meteordevelopment.meteorclient.utils.misc.Names;
import net.minecraft.entity.EntityType;
import net.minecraft.registry.Registries;
import net.minecraft.util.Pair;
import net.minecraft.util.registry.Registry;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Locale;
import java.util.function.Consumer;

public class EntityTypeListSettingScreen extends WindowScreen {
Expand Down Expand Up @@ -162,10 +161,10 @@ public void initWidgets() {

// Sort all entities
if (filterText.isEmpty()) {
Registry.ENTITY_TYPE.forEach(entityTypeForEach);
Registries.ENTITY_TYPE.forEach(entityTypeForEach);
} else {
List<Pair<EntityType<?>, Integer>> entities = new ArrayList<>();
Registry.ENTITY_TYPE.forEach(entity -> {
Registries.ENTITY_TYPE.forEach(entity -> {
int words = Utils.searchInWords(Names.get(entity), filterText);
int diff = Utils.searchLevenshteinDefault(Names.get(entity), filterText, false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
import meteordevelopment.meteorclient.utils.misc.Names;
import net.minecraft.item.Item;
import net.minecraft.item.Items;
import net.minecraft.util.registry.Registry;
import net.minecraft.registry.Registries;

import java.util.function.Predicate;

public class ItemListSettingScreen extends LeftRightListSettingScreen<Item> {
public ItemListSettingScreen(GuiTheme theme, ItemListSetting setting) {
super(theme, "Select Items", setting, setting.get(), Registry.ITEM);
super(theme, "Select Items", setting, setting.get(), Registries.ITEM);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import meteordevelopment.meteorclient.utils.misc.Names;
import net.minecraft.item.Item;
import net.minecraft.item.Items;
import net.minecraft.util.registry.Registry;
import net.minecraft.registry.Registries;
import org.apache.commons.lang3.StringUtils;

public class ItemSettingScreen extends WindowScreen {
Expand Down Expand Up @@ -48,7 +48,7 @@ public void initWidgets() {
}

public void initTable() {
for (Item item : Registry.ITEM) {
for (Item item : Registries.ITEM) {
if (setting.filter != null && !setting.filter.test(item)) continue;
if (item == Items.AIR) continue;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
import meteordevelopment.meteorclient.gui.widgets.pressable.WPressable;
import meteordevelopment.meteorclient.settings.Setting;
import meteordevelopment.meteorclient.utils.Utils;
import net.minecraft.registry.Registry;
import net.minecraft.util.Pair;
import net.minecraft.util.registry.Registry;

import java.util.ArrayList;
import java.util.Collection;
Expand Down
Loading

0 comments on commit 7e5db0c

Please sign in to comment.