This commit is contained in:
Roman Danilov
2024-08-13 13:55:21 +05:00
parent 7be664b746
commit 8272966d25
36 changed files with 33 additions and 1703 deletions

View File

@@ -8,7 +8,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 18
java-version: 21
distribution: adopt
- name: Build
run: ./gradlew build
@@ -16,8 +16,8 @@ jobs:
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: '${{ secrets.GITHUB_TOKEN }}'
automatic_release_tag: "1.20.4_1.0.9.0"
automatic_release_tag: "1.20.6_1.0.9.0"
prerelease: true
title: "1.20.4 | 1.0.9.0"
title: "1.20.6 | 1.0.9.0"
files: |
./build/libs/*.jar

View File

@@ -8,7 +8,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 18
java-version: 21
distribution: adopt
- name: Build
run: ./gradlew build

View File

@@ -1,8 +1,9 @@
plugins {
id 'fabric-loom' version '0.12-SNAPSHOT'
id "fabric-loom" version "1.6-SNAPSHOT"
id "maven-publish"
}
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_21
archivesBaseName = project.archives_base_name
version = project.mod_version
@@ -42,6 +43,8 @@ repositories {
name = "boze-maven"
url = "https://maven.boze.dev/releases"
}
mavenCentral()
gradlePluginPortal()
}
dependencies {
@@ -55,7 +58,7 @@ dependencies {
// Meteor Client
modImplementation files("libs\\baritone-unoptimized-fabric-1.10.1-11-g3ed49fd4.jar")
modImplementation files("libs\\meteor-client-0.5.6.jar")
modImplementation files("libs\\meteor-client-0.5.7.jar")
// Journey Map
modCompileOnlyApi group: 'info.journeymap', name: 'journeymap-api', version: project.journeymap_api_fabric_version, changing: true

View File

@@ -1,12 +1,12 @@
org.gradle.jvmargs=-Xmx2G
# Fabric (https://fabricmc.net/versions.html)
minecraft_version=1.20.4
yarn_mappings=1.20.4+build.2
loader_version=0.15.1
minecraft_version=1.20.6
yarn_mappings=1.20.6+build.1
loader_version=0.15.11
# Mod Properties
mod_version=1.20.4_1.0.9.0
mod_version=1.20.6_1.0.9.0
maven_group=nekiplay.meteorplus
archives_base_name=meteor-plus
@@ -21,9 +21,9 @@ jm_fabric_version=1.20.4-5.9.20-fabric
# Xaero's Mods
# Xaero's World Map (https://modrinth.com/mod/xaeros-world-map/versions)
xwm_fabric_version=1.38.4_Fabric_1.20.4
xwm_fabric_version=1.38.8_Fabric_1.20.6
# Xaero's Minimap (https://modrinth.com/mod/xaeros-minimap/versions)
xmm_fabric_version=24.1.1_Fabric_1.20.4
xmm_fabric_version=24.2.0_Fabric_1.20.6
# Litematica (https://www.curseforge.com/minecraft/mc-mods/litematica/files/all?page=1&pageSize=20)
litematica_fileid=4946471

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

Binary file not shown.

View File

@@ -1,6 +1,5 @@
package nekiplay;
import nekiplay.bozeplus.BozePlusAddon;
import nekiplay.main.items.ModItems;
import net.fabricmc.api.ModInitializer;
import org.slf4j.Logger;
@@ -8,22 +7,11 @@ import org.slf4j.LoggerFactory;
public class Main implements ModInitializer {
public static final Logger LOG = LoggerFactory.getLogger(Main.class);
public static final String BOZE_LOGPREFIX = "[Boze+]";
public static final String METEOR_LOGPREFIX = "[Meteor+]";
@Override
public void onInitialize() {
LOG.info(METEOR_LOGPREFIX + " Initializing items...");
ModItems.initializeMeteorPlus();
LOG.info(METEOR_LOGPREFIX + " Loaded items");
if (MixinPlugin.isBozeAPI && !MixinPlugin.isMeteorClient) {
LOG.info(METEOR_LOGPREFIX + " & " + BOZE_LOGPREFIX + " Initialization of Boze Client integration because Meteor Client is not found...");
BozePlusAddon bozePlusMain = new BozePlusAddon();
bozePlusMain.onInitialize();
LOG.info(METEOR_LOGPREFIX + " & " + BOZE_LOGPREFIX + " Loaded of Boze Client integration");
}
else if (MixinPlugin.isBozeAPI) {
LOG.info(METEOR_LOGPREFIX + " & " + BOZE_LOGPREFIX + " You have Meteor Client installed, integration with Boze Client is disabled");
}
}
}

View File

@@ -82,11 +82,6 @@ public class MixinPlugin implements IMixinConfigPlugin {
else if (mixinClassName.startsWith(mixinPackageMeteorPlus + ".minecraft")) {
return isMeteorClient;
}
else if (mixinClassName.startsWith(mixinPackageBozePlus + ".minecraft")) {
return isBozeAPI && !isMeteorClient;
}
return false;
}

View File

@@ -1,114 +0,0 @@
package nekiplay.bozeplus;
import com.google.gson.JsonObject;
import dev.boze.api.BozeInstance;
import dev.boze.api.Globals;
import dev.boze.api.addon.Addon;
import dev.boze.api.addon.AddonMetadata;
import dev.boze.api.addon.AddonVersion;
import dev.boze.api.addon.command.AddonDispatcher;
import dev.boze.api.addon.module.AddonModule;
import dev.boze.api.config.Serializable;
import dev.boze.api.exception.AddonInitializationException;
import meteordevelopment.orbit.EventBus;
import meteordevelopment.orbit.IEventBus;
import nekiplay.bozeplus.features.modules.movement.spider.SpiderPlus;
import nekiplay.bozeplus.impl.BozePlusDispatcher;
import nekiplay.bozeplus.impl.BozePlusModule;
import net.fabricmc.loader.impl.util.log.Log;
import net.fabricmc.loader.impl.util.log.LogCategory;
import java.lang.invoke.MethodHandles;
import java.util.ArrayList;
import java.util.List;
public class BozePlusAddon implements Addon, Serializable<BozePlusAddon> {
private static final IEventBus EVENT_BUS = new EventBus();
public static IEventBus getEventBus() {
return EVENT_BUS;
}
private static BozePlusAddon instance;
public static BozePlusAddon getInstance() {
return instance;
}
public final AddonMetadata metadata = new AddonMetadata(
"boze-plus",
"Boze Plus",
"Meteor Plus modules for Boze",
new AddonVersion(1, 0, 0));
private final ArrayList<AddonModule> modules = new ArrayList<>();
private BozePlusDispatcher dispatcher;
public void onInitialize() {
try {
BozeInstance.INSTANCE.registerAddon(this);
} catch (AddonInitializationException e) {
Log.error(LogCategory.LOG, "Failed to initialize addon: " + getMetadata().id(), e);
}
}
private void addModule(AddonModule module) {
modules.add(module);
EVENT_BUS.subscribe(module);
}
@Override
public AddonMetadata getMetadata() {
return metadata;
}
@Override
public boolean initialize() {
instance = this;
BozeInstance.INSTANCE.registerPackage("nekiplay.bozeplus");
EVENT_BUS.registerLambdaFactory("nekiplay.bozeplus" , (lookupInMethod, klass) -> (MethodHandles.Lookup) lookupInMethod.invoke(null, klass, MethodHandles.lookup()));
// Load config
Globals.getJsonTools().loadObject(this, "config", this);
SpiderPlus spiderPlus = new SpiderPlus();
addModule(spiderPlus);
return true;
}
@Override
public void shutdown() {
Globals.getJsonTools().saveObject(this, "config", this);
}
@Override
public List<AddonModule> getModules() {
return modules;
}
@Override
public AddonDispatcher getDispatcher() {
return dispatcher;
}
@Override
public JsonObject toJson() {
JsonObject object = new JsonObject();
for (AddonModule module : modules) {
object.add(module.getInfo().getName(), ((BozePlusModule) module).toJson());
}
return object;
}
@Override
public BozePlusAddon fromJson(JsonObject jsonObject) {
for (AddonModule module : modules) {
if (jsonObject.has(module.getInfo().getName())) {
((BozePlusModule) module).fromJson(jsonObject.getAsJsonObject(module.getInfo().getName()));
}
}
return this;
}
}

View File

@@ -1,26 +0,0 @@
package nekiplay.bozeplus.features.modules.movement.nofall;
import dev.boze.api.event.EventTick;
import nekiplay.main.events.packets.PacketEvent;
import net.minecraft.client.MinecraftClient;
public class NoFallMode {
protected final MinecraftClient mc;
protected final NoFallPlus settings;
private final NoFallModes type;
public NoFallMode(NoFallModes type, NoFallPlus settings) {
this.settings = settings;
this.mc = MinecraftClient.getInstance();
this.type = type;
}
public void onSendPacket(PacketEvent.Send event) {}
public void onSentPacket(PacketEvent.Sent event) {}
public void onTickEventPre(EventTick.Pre event) {}
public void onTickEventPost(EventTick.Post event) {}
public void onActivate() {}
public void onDeactivate() {}
}

View File

@@ -1,5 +0,0 @@
package nekiplay.bozeplus.features.modules.movement.nofall;
public enum NoFallModes {
MatrixNew,
}

View File

@@ -1,64 +0,0 @@
package nekiplay.bozeplus.features.modules.movement.nofall;
import dev.boze.api.addon.module.ToggleableModule;
import dev.boze.api.event.EventTick;
import dev.boze.api.setting.SettingMode;
import meteordevelopment.orbit.EventHandler;
import nekiplay.main.events.packets.PacketEvent;
import nekiplay.bozeplus.features.modules.movement.nofall.modes.MatrixNew;
import java.util.ArrayList;
public class NoFallPlus extends ToggleableModule {
private final SettingMode mode = new SettingMode("Mode", "Bypass mode", new ArrayList<>() {{
add("Matrix");
}});
public NoFallPlus() {
super("No Fall+", "Bypass no fall");
elements.add(mode);
onNoFallModeChanged(mode.getMode());
}
@Override
protected void onEnable() {
onNoFallModeChanged(mode.getMode());
if (currentMode != null) {
currentMode.onActivate();
}
}
@EventHandler
public void onSendPacket(PacketEvent.Send event) {
if (currentMode != null) {
currentMode.onSendPacket(event);
}
}
@EventHandler
public void onSentPacket(PacketEvent.Sent event) {
if (currentMode != null) {
currentMode.onSentPacket(event);
}
}
@EventHandler
public void onTickEventPre(EventTick.Pre event) {
if (currentMode != null) {
currentMode.onTickEventPre(event);
}
}
@EventHandler
public void onTickEventPost(EventTick.Post event) {
if (currentMode != null) {
currentMode.onTickEventPost(event);
}
}
private NoFallMode currentMode = null;
private void onNoFallModeChanged(int mode) {
switch (mode) {
case 0 -> currentMode = new MatrixNew(this);
}
}
}

View File

@@ -1,14 +0,0 @@
package nekiplay.bozeplus.features.modules.movement.nofall.modes;
import nekiplay.Main;
import nekiplay.bozeplus.features.modules.movement.nofall.NoFallMode;
import nekiplay.bozeplus.features.modules.movement.nofall.NoFallModes;
import nekiplay.bozeplus.features.modules.movement.nofall.NoFallPlus;
import nekiplay.bozeplus.features.modules.movement.spider.SpiderModes;
import nekiplay.bozeplus.features.modules.movement.spider.SpiderPlus;
public class MatrixNew extends NoFallMode {
public MatrixNew(NoFallPlus noFallPlus) {
super(NoFallModes.MatrixNew, noFallPlus);
}
}

View File

@@ -1,25 +0,0 @@
package nekiplay.bozeplus.features.modules.movement.spider;
import dev.boze.api.event.EventTick;
import nekiplay.main.events.packets.PacketEvent;
import net.minecraft.client.MinecraftClient;
public class SpiderMode {
protected final MinecraftClient mc;
protected final SpiderPlus settings;
private final SpiderModes type;
public SpiderMode(SpiderModes type, SpiderPlus settings) {
this.settings = settings;
this.mc = MinecraftClient.getInstance();
this.type = type;
}
public void onSendPacket(PacketEvent.Send event) {}
public void onSentPacket(PacketEvent.Sent event) {}
public void onTickEventPre(EventTick.Pre event) {}
public void onTickEventPost(EventTick.Post event) {}
public void onActivate() {}
public void onDeactivate() {}
}

View File

@@ -1,12 +0,0 @@
package nekiplay.bozeplus.features.modules.movement.spider;
public enum SpiderModes {
Matrix,
Vulcan,
Elytra_clip;
@Override
public String toString() {
return super.toString().replace('_', ' ').replaceAll("_Lower_", "<");
}
}

View File

@@ -1,65 +0,0 @@
package nekiplay.bozeplus.features.modules.movement.spider;
import dev.boze.api.addon.module.ToggleableModule;
import dev.boze.api.event.EventTick;
import dev.boze.api.setting.SettingMode;
import meteordevelopment.orbit.EventHandler;
import nekiplay.main.events.packets.PacketEvent;
import nekiplay.bozeplus.features.modules.movement.spider.modes.Matrix;
import java.util.ArrayList;
public class SpiderPlus extends ToggleableModule {
private final SettingMode mode = new SettingMode("Mode", "Bypass mode", new ArrayList<>() {{
add("Matrix");
}});
public SpiderPlus() {
super("Spider", "Climb on walls");
elements.add(mode);
onSpiderModeChanged(mode.getMode());
}
@Override
protected void onEnable() {
onSpiderModeChanged(mode.getMode());
if (currentMode != null) {
currentMode.onActivate();
}
}
@EventHandler
public void onSendPacket(PacketEvent.Send event) {
if (currentMode != null) {
currentMode.onSendPacket(event);
}
}
@EventHandler
public void onSentPacket(PacketEvent.Sent event) {
if (currentMode != null) {
currentMode.onSentPacket(event);
}
}
@EventHandler
public void onTickEventPre(EventTick.Pre event) {
if (currentMode != null) {
currentMode.onTickEventPre(event);
}
}
@EventHandler
public void onTickEventPost(EventTick.Post event) {
if (currentMode != null) {
currentMode.onTickEventPost(event);
}
}
private SpiderMode currentMode = null;
private void onSpiderModeChanged(int mode) {
switch (mode) {
case 0 -> currentMode = new Matrix(this);
}
}
}

View File

@@ -1,121 +0,0 @@
package nekiplay.bozeplus.features.modules.movement.spider.modes;
import dev.boze.api.event.EventTick;
import nekiplay.bozeplus.features.modules.movement.spider.SpiderMode;
import nekiplay.bozeplus.features.modules.movement.spider.SpiderModes;
import nekiplay.bozeplus.features.modules.movement.spider.SpiderPlus;
import nekiplay.bozeplus.mixin.minecraft.PlayerMoveC2SPacketAccessor;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
import net.minecraft.util.math.Vec3d;
public class Matrix extends SpiderMode {
public Matrix(SpiderPlus spiderPlus) {
super(SpiderModes.Matrix, spiderPlus);
}
private int tick = 0;
private boolean modify = false;
private boolean start = false;
private double startY = 0;
private double lastY = 0;
private double coff = 0.0000000000326;
private boolean block = false;
@Override
public void onActivate() {
tick = 0;
start = false;
modify = false;
if (mc.player != null) {
startY = mc.player.getPos().y;
}
}
private boolean YGround(double height, double min, double max) {
String yString = String.valueOf(height);
yString = yString.substring(yString.indexOf("."));
double y = Double.parseDouble(yString);
return y >= min && y <= max;
}
private double RGround(double height) {
String yString = String.valueOf(height);
yString = yString.substring(yString.indexOf("."));
return Double.parseDouble(yString);
}
private void work(Packet<?> packet) {
if (modify && mc.player != null) {
if (packet instanceof PlayerMoveC2SPacket move) {
double y = mc.player.getY();
y = move.getY(y);
if (YGround(y, RGround(startY) - 0.1, RGround(startY) + 0.1)) {
((PlayerMoveC2SPacketAccessor) packet).setOnGround(true);
}
if (mc.player.isOnGround() && block) {
block = false;
startY = mc.player.getPos().y;
start = false;
}
}
} else if (mc.player != null) {
if (mc.player.isOnGround() && block) {
block = false;
startY = mc.player.getPos().y;
start = false;
}
}
}
@Override
public void onTickEventPre(EventTick.Pre event) {
if (modify && mc.player != null) {
ClientPlayerEntity player = mc.player;
double y = player.getPos().y;
if (lastY == y && tick > 1) {
block = true;
} else {
lastY = y;
}
}
}
@Override
public void onTickEventPost(EventTick.Post event) {
ClientPlayerEntity player = mc.player;
if (player != null) {
Vec3d pl_velocity = player.getVelocity();
modify = player.horizontalCollision;
if (mc.player.isOnGround()) {
block = false;
startY = mc.player.getPos().y;
start = false;
}
if (player.horizontalCollision) {
if (!start) {
start = true;
startY = mc.player.getPos().y;
lastY = mc.player.getY();
}
if (!block) {
if (tick == 0) {
mc.player.setVelocity(pl_velocity.x, 0.41999998688698, pl_velocity.z);
tick = 1;
} else if (tick == 1) {
mc.player.setVelocity(pl_velocity.x, 0.41999998688698 - 0.08679999325 - coff, pl_velocity.z);
tick = 2;
} else if (tick == 2) {
mc.player.setVelocity(pl_velocity.x, 0.41999998688698 - 0.17186398826 - coff, pl_velocity.z);
tick = 0;
}
}
} else {
modify = false;
tick = 0;
}
}
}
}

View File

@@ -1,29 +0,0 @@
package nekiplay.bozeplus.impl;
import dev.boze.api.input.Bind;
public class BozePlusBind implements Bind {
private int bind;
private boolean button;
public BozePlusBind(int bind, boolean button) {
this.bind = bind;
this.button = button;
}
public void setBind(int bind, boolean button) {
this.bind = bind;
this.button = button;
}
@Override
public int getBind() {
return bind;
}
@Override
public boolean isButton() {
return button;
}
}

View File

@@ -1,19 +0,0 @@
package nekiplay.bozeplus.impl;
import com.mojang.brigadier.CommandDispatcher;
import dev.boze.api.addon.command.AddonDispatcher;
import net.minecraft.command.CommandSource;
public class BozePlusDispatcher implements AddonDispatcher {
private final CommandDispatcher<CommandSource> DISPATCHER = new CommandDispatcher<>();
@Override
public CommandDispatcher<CommandSource> getDispatcher() {
return DISPATCHER;
}
@Override
public String getPrefix() {
return "example";
}
}

View File

@@ -1,116 +0,0 @@
package nekiplay.bozeplus.impl;
import com.google.gson.JsonObject;
import dev.boze.api.BozeInstance;
import dev.boze.api.addon.gui.AddonElement;
import dev.boze.api.addon.module.AddonModule;
import dev.boze.api.config.Serializable;
import dev.boze.api.input.Bind;
import dev.boze.api.module.ModuleInfo;
import java.util.ArrayList;
import java.util.List;
public abstract class BozePlusModule implements AddonModule, ModuleInfo, Serializable<BozePlusModule> {
private boolean state;
private Bind bind;
private final String name;
private String title;
private final String description;
protected final ArrayList<AddonElement> elements = new ArrayList<>();
public BozePlusModule(String name, String title, String description) {
this.name = name;
this.title = title;
this.description = description;
this.state = false;
this.bind = new BozePlusBind(-1, false);
}
@Override
public ModuleInfo getInfo() {
return this;
}
@Override
public List<AddonElement> getElements() {
return elements;
}
@Override
public JsonObject toJson() {
JsonObject object = new JsonObject();
object.addProperty("title", name);
for (AddonElement element : elements) {
if (element instanceof Serializable) {
object.add(element.getName(), ((Serializable<?>) element).toJson());
}
}
return object;
}
@Override
public BozePlusModule fromJson(JsonObject jsonObject) {
title = jsonObject.get("title").getAsString();
for (AddonElement element : elements) {
if (element instanceof Serializable) {
((Serializable<?>) element).fromJson(jsonObject.get(element.getName()).getAsJsonObject());
}
}
return this;
}
@Override
public String getName() {
return name;
}
@Override
public String getTitle() {
return title;
}
@Override
public String getDescription() {
return description;
}
@Override
public boolean getState() {
return state;
}
@Override
public boolean setState(boolean newState) {
if (state != newState) {
state = newState;
if (state) {
BozeInstance.INSTANCE.subscribe(this);
} else {
BozeInstance.INSTANCE.unsubscribe(this);
}
return true;
}
return false;
}
@Override
public Bind getBind() {
return bind;
}
@Override
public void setBind(Bind bind) {
this.bind = bind;
}
}

View File

@@ -1,39 +0,0 @@
package nekiplay.bozeplus.mixin.minecraft;
import nekiplay.bozeplus.BozePlusAddon;
import nekiplay.main.events.packets.PacketEvent;
import net.minecraft.network.ClientConnection;
import net.minecraft.network.listener.ClientPlayPacketListener;
import net.minecraft.network.listener.PacketListener;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.s2c.play.BundleS2CPacket;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.Iterator;
@Mixin(ClientConnection.class)
public class ClientConnectionMixin {
@Inject(method = "handlePacket", at = @At("HEAD"), cancellable = true)
private static <T extends PacketListener> void onHandlePacket(Packet<T> packet, PacketListener listener, CallbackInfo info) {
if (packet instanceof BundleS2CPacket bundle) {
for (Iterator<Packet<ClientPlayPacketListener>> it = bundle.getPackets().iterator(); it.hasNext(); ) {
if (BozePlusAddon.getEventBus().post(PacketEvent.Receive.get(it.next(), listener)).isCancelled())
it.remove();
}
} else if (BozePlusAddon.getEventBus().post(PacketEvent.Receive.get(packet, listener)).isCancelled()) info.cancel();
}
@Inject(at = @At("HEAD"), method = "send(Lnet/minecraft/network/packet/Packet;)V", cancellable = true)
private void onSendPacketHead(Packet<?> packet, CallbackInfo info) {
if (BozePlusAddon.getEventBus().post(PacketEvent.Send.get(packet)).isCancelled()) info.cancel();
}
@Inject(method = "send(Lnet/minecraft/network/packet/Packet;)V", at = @At("TAIL"))
private void onSendPacketTail(Packet<?> packet, CallbackInfo info) {
BozePlusAddon.getEventBus().post(PacketEvent.Sent.get(packet));
}
}

View File

@@ -1,17 +0,0 @@
package nekiplay.bozeplus.mixin.minecraft;
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
import org.spongepowered.asm.mixin.gen.Accessor;
@Mixin(PlayerMoveC2SPacket.class)
public interface PlayerMoveC2SPacketAccessor {
@Mutable
@Accessor("y")
void setY(double y);
@Mutable
@Accessor("onGround")
void setOnGround(boolean onGround);
}

View File

@@ -1,7 +1,5 @@
package nekiplay.main.items;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroups;
import net.minecraft.registry.Registries;
@@ -9,16 +7,11 @@ import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier;
public class ModItems {
public static final Item METEOR_PLUS_LOGO_ITEM = new Item(new FabricItemSettings());
public static final Item METEOR_PLUS_LOGO_MODS_ITEM = new Item(new FabricItemSettings());
public static final Item METEOR_PLUS_LOGO_ITEM = new Item(new Item.Settings());
public static final Item METEOR_PLUS_LOGO_MODS_ITEM = new Item(new Item.Settings());
public static void initializeMeteorPlus() {
Registry.register(Registries.ITEM, new Identifier("meteorplus", "logo"), METEOR_PLUS_LOGO_ITEM);
Registry.register(Registries.ITEM, new Identifier("meteorplus", "logo_mods"), METEOR_PLUS_LOGO_MODS_ITEM);
ItemGroupEvents.modifyEntriesEvent(ItemGroups.INGREDIENTS).register(content -> {
content.add(ModItems.METEOR_PLUS_LOGO_MODS_ITEM);
content.add(ModItems.METEOR_PLUS_LOGO_ITEM);
});
Registry.register(Registries.ITEM, Identifier.of("meteorplus", "logo"), METEOR_PLUS_LOGO_ITEM);
Registry.register(Registries.ITEM, Identifier.of("meteorplus", "logo_mods"), METEOR_PLUS_LOGO_MODS_ITEM);
}
}

View File

@@ -8,7 +8,6 @@ import meteordevelopment.meteorclient.systems.modules.misc.BetterChat;
import nekiplay.MixinPlugin;
import nekiplay.meteorplus.features.commands.*;
import nekiplay.meteorplus.features.modules.combat.*;
import nekiplay.meteorplus.features.modules.combat.killaura.KillAuraPlus;
import nekiplay.meteorplus.features.modules.combat.velocity.VelocityPlus;
import nekiplay.meteorplus.features.modules.misc.*;
import nekiplay.meteorplus.features.modules.movement.*;
@@ -18,11 +17,9 @@ import nekiplay.meteorplus.features.modules.player.*;
import nekiplay.meteorplus.features.modules.render.*;
import nekiplay.meteorplus.features.modules.render.holograms.*;
import nekiplay.meteorplus.features.modules.world.*;
import nekiplay.meteorplus.features.modules.integrations.*;
import nekiplay.meteorplus.features.modules.world.autoobsidianmine.AutoObsidianFarm;
import nekiplay.meteorplus.gui.tabs.HiddenModulesTab;
import nekiplay.meteorplus.hud.TimerPlusCharge;
import nekiplay.meteorplus.features.modules.integrations.LitematicaPrinter;
import nekiplay.meteorplus.features.modules.integrations.MapIntegration;
import nekiplay.meteorplus.features.modules.world.timer.TimerPlus;
import nekiplay.main.items.ModItems;
@@ -69,11 +66,6 @@ public class MeteorPlusAddon extends MeteorAddon {
LOG.info(METEOR_LOGPREFIX + " Initializing...");
if (MixinPlugin.isZewo2) {
LOG.info(METEOR_LOGPREFIX + " Detected Zero2 addon, full disabling Meteor+");
return;
}
ArrayList<String> notFoundIntegrations = new ArrayList<>();
ArrayList<String> notFoundBaritoneIntegrations = new ArrayList<>();
ArrayList<String> enabledIntegrations = new ArrayList<>();
@@ -121,18 +113,6 @@ public class MeteorPlusAddon extends MeteorAddon {
enabledIntegrations.add("Goto+");
}
if (!isLitematicaMapresent) {
if (!isBaritonePresent) {
notFoundBaritoneIntegrations.add("Litematica printer");
}
else {
notFoundIntegrations.add("Litematica");
}
}
else {
enabledIntegrations.add("Litematica");
}
if (!enabledIntegrations.isEmpty()) {
LOG.info(METEOR_LOGPREFIX + " Enabling integrations for: " + String.join(", ", enabledIntegrations));
}
@@ -174,7 +154,6 @@ public class MeteorPlusAddon extends MeteorAddon {
//modules.add(new KillAuraPlus());
modules.add(new Teams());
modules.add(new HologramModule());
modules.add(new SprintPlus());
modules.add(new ChatPrefix());
modules.add(new ChatGPT());
modules.add(new ItemHighlightPlus());
@@ -216,12 +195,6 @@ public class MeteorPlusAddon extends MeteorAddon {
modules.add(new MapIntegration());
}
}
if (isLitematicaMapresent && isBaritonePresent) {
modules.add(new LitematicaPrinter());
}
if (isWhereIsIt) {
modules.add(new WhereIsIt());
}
LOG.info(METEOR_LOGPREFIX + " Loaded modules");
//endregion

View File

@@ -1,498 +0,0 @@
package nekiplay.meteorplus.features.modules.integrations;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.function.Supplier;
import fi.dy.masa.litematica.data.DataManager;
import fi.dy.masa.litematica.world.SchematicWorldHandler;
import fi.dy.masa.litematica.world.WorldSchematic;
import meteordevelopment.meteorclient.MeteorClient;
import meteordevelopment.meteorclient.events.render.Render3DEvent;
import meteordevelopment.meteorclient.events.world.TickEvent;
import meteordevelopment.meteorclient.renderer.ShapeMode;
import meteordevelopment.meteorclient.settings.BlockListSetting;
import meteordevelopment.meteorclient.settings.BoolSetting;
import meteordevelopment.meteorclient.settings.ColorSetting;
import meteordevelopment.meteorclient.settings.EnumSetting;
import meteordevelopment.meteorclient.settings.IntSetting;
import meteordevelopment.meteorclient.settings.Setting;
import meteordevelopment.meteorclient.settings.SettingGroup;
import meteordevelopment.meteorclient.systems.modules.Module;
import meteordevelopment.meteorclient.utils.Utils;
import meteordevelopment.meteorclient.utils.player.FindItemResult;
import meteordevelopment.meteorclient.utils.player.InvUtils;
import meteordevelopment.meteorclient.utils.render.color.Color;
import meteordevelopment.meteorclient.utils.render.color.SettingColor;
import meteordevelopment.meteorclient.utils.world.BlockIterator;
import meteordevelopment.meteorclient.utils.world.BlockUtils;
import meteordevelopment.orbit.EventHandler;
import nekiplay.meteorplus.utils.RaycastUtils;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.network.packet.c2s.play.CreativeInventoryActionC2SPacket;
import net.minecraft.state.property.Properties;
import net.minecraft.util.Pair;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.Vec3i;
import nekiplay.meteorplus.MeteorPlusAddon;
public class LitematicaPrinter extends Module {
private final SettingGroup sgGeneral = settings.getDefaultGroup();
private final SettingGroup sgWhitelist = settings.createGroup("Whitelist");
private final SettingGroup sgRendering = settings.createGroup("Rendering");
private final Setting<Integer> printing_range = sgGeneral.add(new IntSetting.Builder()
.name("printing-range")
.description("The block place range.")
.defaultValue(2)
.min(1).sliderMin(1)
.max(6).sliderMax(6)
.build()
);
private final Setting<Integer> printing_delay = sgGeneral.add(new IntSetting.Builder()
.name("printing-delay")
.description("Delay between printing blocks in ticks.")
.defaultValue(2)
.min(0).sliderMin(0)
.max(100).sliderMax(40)
.build()
);
private final Setting<Integer> bpt = sgGeneral.add(new IntSetting.Builder()
.name("blocks/tick")
.description("How many blocks place per tick.")
.defaultValue(1)
.min(1).sliderMin(1)
.max(100).sliderMax(100)
.build()
);
private final Setting<Boolean> advanced = sgGeneral.add(new BoolSetting.Builder()
.name("advanced")
.description("Respect block rotation (places blocks in weird places in singleplayer, multiplayer should work fine).")
.defaultValue(false)
.build()
);
private final Setting<Boolean> airPlace = sgGeneral.add(new BoolSetting.Builder()
.name("air-place")
.description("Allow the bot to place in the air.")
.defaultValue(true)
.build()
);
private final Setting<Boolean> placeThroughWall = sgGeneral.add(new BoolSetting.Builder()
.name("Place Through Wall")
.description("Allow the bot to place through walls.")
.defaultValue(true)
.build()
);
private final Setting<Boolean> swing = sgGeneral.add(new BoolSetting.Builder()
.name("swing")
.description("Swing hand when placing.")
.defaultValue(false)
.build()
);
private final Setting<Boolean> returnHand = sgGeneral.add(new BoolSetting.Builder()
.name("return-slot")
.description("Return to old slot.")
.defaultValue(false)
.build()
);
private final Setting<Boolean> rotate = sgGeneral.add(new BoolSetting.Builder()
.name("rotate")
.description("Rotate to the blocks being placed.")
.defaultValue(false)
.build()
);
private final Setting<Boolean> raycastCheck = sgGeneral.add(new BoolSetting.Builder()
.name("raycast")
.description("Rotate to the blocks being placed.")
.defaultValue(false)
.build()
);
private final Setting<Boolean> clientSide = sgGeneral.add(new BoolSetting.Builder()
.name("Client side Rotation")
.description("Rotate to the blocks being placed on client side.")
.defaultValue(false)
.visible(rotate::get)
.build()
);
private final Setting<Boolean> dirtgrass = sgGeneral.add(new BoolSetting.Builder()
.name("dirt-as-grass")
.description("Use dirt instead of grass.")
.defaultValue(true)
.build()
);
private final Setting<SortAlgorithm> firstAlgorithm = sgGeneral.add(new EnumSetting.Builder<SortAlgorithm>()
.name("first-sorting-mode")
.description("The blocks you want to place first.")
.defaultValue(SortAlgorithm.None)
.build()
);
private final Setting<SortingSecond> secondAlgorithm = sgGeneral.add(new EnumSetting.Builder<SortingSecond>()
.name("second-sorting-mode")
.description("Second pass of sorting eg. place first blocks higher and closest to you.")
.defaultValue(SortingSecond.None)
.visible(()-> firstAlgorithm.get().applySecondSorting)
.build()
);
private final Setting<Boolean> whitelistenabled = sgWhitelist.add(new BoolSetting.Builder()
.name("whitelist-enabled")
.description("Only place selected blocks.")
.defaultValue(false)
.build()
);
private final Setting<List<Block>> whitelist = sgWhitelist.add(new BlockListSetting.Builder()
.name("whitelist")
.description("Blocks to place.")
.visible(whitelistenabled::get)
.build()
);
private final Setting<Boolean> renderBlocks = sgRendering.add(new BoolSetting.Builder()
.name("render-placed-blocks")
.description("Renders block placements.")
.defaultValue(true)
.build()
);
private final Setting<Integer> fadeTime = sgRendering.add(new IntSetting.Builder()
.name("fade-time")
.description("Time for the rendering to fade, in ticks.")
.defaultValue(3)
.min(1).sliderMin(1)
.max(1000).sliderMax(20)
.visible(renderBlocks::get)
.build()
);
private final Setting<SettingColor> colour = sgRendering.add(new ColorSetting.Builder()
.name("colour")
.description("The cubes colour.")
.defaultValue(new SettingColor(95, 190, 255))
.visible(renderBlocks::get)
.build()
);
private int timer;
private int usedSlot = -1;
private final List<BlockPos> toSort = new ArrayList<>();
private final List<Pair<Integer, BlockPos>> placed_fade = new ArrayList<>();
// TODO: Add an option for smooth rotation. Make it look legit.
// Might use liquidbounce RotationUtils to make it happen.
// https://github.com/CCBlueX/LiquidBounce/blob/nextgen/src/main/kotlin/net/ccbluex/liquidbounce/utils/aiming/RotationsUtil.kt#L257
public LitematicaPrinter() {
super(MeteorPlusAddon.CATEGORYMODS, "printer", "Automatically prints open schematics");
}
@Override
public void onActivate() {
onDeactivate();
}
@Override
public void onDeactivate() {
placed_fade.clear();
}
@EventHandler
private void onTick(TickEvent.Post event) {
if (mc.player == null || mc.world == null) {
placed_fade.clear();
return;
}
placed_fade.forEach(s -> s.setLeft(s.getLeft() - 1));
placed_fade.removeIf(s -> s.getLeft() <= 0);
WorldSchematic worldSchematic = SchematicWorldHandler.getSchematicWorld();
if (worldSchematic == null) {
placed_fade.clear();
toggle();
return;
}
toSort.clear();
if (timer >= printing_delay.get()) {
BlockIterator.register(printing_range.get() + 1, printing_range.get() + 1, (pos, blockState) -> {
BlockState required = worldSchematic.getBlockState(pos);
if (
mc.player.getBlockPos().isWithinDistance(pos, printing_range.get())
&& blockState.isReplaceable()
&& !required.isLiquid()
&& !required.isAir()
&& blockState.getBlock() != required.getBlock()
&& DataManager.getRenderLayerRange().isPositionWithinRange(pos)
&& !mc.player.getBoundingBox().intersects(Vec3d.of(pos), Vec3d.of(pos).add(1, 1, 1))
&& required.canPlaceAt(mc.world, pos)
) {
boolean isBlockInLineOfSight = MyUtils.isBlockInLineOfSight(pos, required);
if(
airPlace.get()
&& placeThroughWall.get()
|| !airPlace.get()
&& !placeThroughWall.get()
&& isBlockInLineOfSight
&& MyUtils.getVisiblePlaceSide(
pos,
required,
printing_range.get(),
advanced.get() ? dir(required) : null
) != null
|| airPlace.get()
&& !placeThroughWall.get()
&& isBlockInLineOfSight
|| !airPlace.get()
&& placeThroughWall.get()
&& BlockUtils.getPlaceSide(pos) != null
) {
if (!whitelistenabled.get() || whitelist.get().contains(required.getBlock())) {
toSort.add(new BlockPos(pos));
}
}
}
});
BlockIterator.after(() -> {
//if (!tosort.isEmpty()) info(tosort.toString());
if (firstAlgorithm.get() != SortAlgorithm.None) {
if (firstAlgorithm.get().applySecondSorting) {
if (secondAlgorithm.get() != SortingSecond.None) {
toSort.sort(secondAlgorithm.get().algorithm);
}
}
toSort.sort(firstAlgorithm.get().algorithm);
}
int placed = 0;
for (BlockPos pos : toSort) {
BlockState state = worldSchematic.getBlockState(pos);
Item item = state.getBlock().asItem();
if (dirtgrass.get() && item == Items.GRASS_BLOCK)
item = Items.DIRT;
if (switchItem(item, state, () -> place(state, pos))) {
timer = 0;
placed++;
if (renderBlocks.get()) {
placed_fade.add(new Pair<>(fadeTime.get(), new BlockPos(pos)));
}
if (placed >= bpt.get()) {
return;
}
}
}
});
} else timer++;
}
public boolean place(BlockState required, BlockPos pos) {
if (mc.player == null || mc.world == null) return false;
if (!mc.world.getBlockState(pos).isReplaceable()) return false;
Direction wantedSide = advanced.get() ? dir(required) : null;
Direction placeSide = placeThroughWall.get() ?
MyUtils.getPlaceSide(pos, wantedSide)
: MyUtils.getVisiblePlaceSide(
pos,
required,
printing_range.get(),
wantedSide
);
return MyUtils.place(pos, placeSide, airPlace.get(), swing.get(), rotate.get(), clientSide.get(), printing_range.get());
}
private boolean switchItem(Item item, BlockState state, Supplier<Boolean> action) {
if (mc.player == null) return false;
int selectedSlot = mc.player.getInventory().selectedSlot;
boolean isCreative = mc.player.getAbilities().creativeMode;
ItemStack requiredItemStack = item.getDefaultStack();
NbtCompound nbt = MyUtils.getNbtFromBlockState(requiredItemStack, state);
requiredItemStack.setNbt(nbt);
FindItemResult result = InvUtils.find(item);
// TODO: Check if ItemStack nbt has BlockStateTag == BlockState required when in creative
if (
!isCreative &&
mc.player.getMainHandStack().getItem() == item ||
isCreative &&
mc.player.getMainHandStack().getItem() == item &&
ItemStack
.canCombine(
mc.player.getMainHandStack()
,
requiredItemStack)
) {
if (action.get()) {
usedSlot = mc.player.getInventory().selectedSlot;
return true;
} else return false;
} else if (
!isCreative &&
usedSlot != -1 &&
mc.player.getInventory().getStack(usedSlot).getItem() == item ||
isCreative &&
usedSlot != -1 &&
mc.player.getInventory().getStack(usedSlot).getItem() == item &&
ItemStack
.canCombine(
mc.player.getInventory().getStack(usedSlot),
requiredItemStack)
) {
InvUtils.swap(usedSlot, returnHand.get());
if (action.get()) {
return true;
} else {
InvUtils.swap(selectedSlot, returnHand.get());
return false;
}
} else if (
result.found() &&
!isCreative ||
result.found() &&
isCreative &&
result.found() &&
result.slot() != -1 &&
ItemStack
.canCombine(
requiredItemStack,
mc.player.getInventory().getStack(result.slot())
)
) {
if (result.isHotbar()) {
InvUtils.swap(result.slot(), returnHand.get());
if (action.get()) {
usedSlot = mc.player.getInventory().selectedSlot;
return true;
} else {
InvUtils.swap(selectedSlot, returnHand.get());
return false;
}
} else if (result.isMain()) {
FindItemResult empty = InvUtils.findEmpty();
if (empty.found() && empty.isHotbar()) {
InvUtils.move().from(result.slot()).toHotbar(empty.slot());
InvUtils.swap(empty.slot(), returnHand.get());
if (action.get()) {
usedSlot = mc.player.getInventory().selectedSlot;
return true;
} else {
InvUtils.swap(selectedSlot, returnHand.get());
return false;
}
} else if (usedSlot != -1) {
InvUtils.move().from(result.slot()).toHotbar(usedSlot);
InvUtils.swap(usedSlot, returnHand.get());
if (action.get()) {
return true;
} else {
InvUtils.swap(selectedSlot, returnHand.get());
return false;
}
} else return false;
} else return false;
} else if (isCreative) {
int slot = 0;
FindItemResult fir = InvUtils.find(ItemStack::isEmpty, 0, 8);
if (fir.found()) {
slot = fir.slot();
}
mc.getNetworkHandler().sendPacket(new CreativeInventoryActionC2SPacket(36 + slot, requiredItemStack));
InvUtils.swap(slot, returnHand.get());
return true;
} else return false;
}
private Direction dir(BlockState state) {
if (state.contains(Properties.FACING)) return state.get(Properties.FACING);
else if (state.contains(Properties.AXIS)) return Direction.from(state.get(Properties.AXIS), Direction.AxisDirection.POSITIVE);
else if (state.contains(Properties.HORIZONTAL_AXIS)) return Direction.from(state.get(Properties.HORIZONTAL_AXIS), Direction.AxisDirection.POSITIVE);
else return Direction.UP;
}
@EventHandler
private void onRender(Render3DEvent event) {
placed_fade.forEach(s -> {
Color a = new Color(colour.get().r, colour.get().g, colour.get().b, (int) (((float)s.getLeft() / (float) fadeTime.get()) * colour.get().a));
event.renderer.box(s.getRight(), a, null, ShapeMode.Sides, 0);
});
}
@SuppressWarnings("unused")
public enum SortAlgorithm {
None(false, (a, b) -> 0),
TopDown(true, Comparator.comparingInt(value -> value.getY() * -1)),
DownTop(true, Comparator.comparingInt(Vec3i::getY)),
Nearest(false, Comparator.comparingDouble(value -> MeteorClient.mc.player != null ? Utils.squaredDistance(MeteorClient.mc.player.getX(), MeteorClient.mc.player.getY(), MeteorClient.mc.player.getZ(), value.getX() + 0.5, value.getY() + 0.5, value.getZ() + 0.5) : 0)),
Furthest(false, Comparator.comparingDouble(value -> MeteorClient.mc.player != null ? (Utils.squaredDistance(MeteorClient.mc.player.getX(), MeteorClient.mc.player.getY(), MeteorClient.mc.player.getZ(), value.getX() + 0.5, value.getY() + 0.5, value.getZ() + 0.5)) * -1 : 0));
final boolean applySecondSorting;
final Comparator<BlockPos> algorithm;
SortAlgorithm(boolean applySecondSorting, Comparator<BlockPos> algorithm) {
this.applySecondSorting = applySecondSorting;
this.algorithm = algorithm;
}
}
@SuppressWarnings("unused")
public enum SortingSecond {
None(SortAlgorithm.None.algorithm),
Nearest(SortAlgorithm.Nearest.algorithm),
Furthest(SortAlgorithm.Furthest.algorithm);
final Comparator<BlockPos> algorithm;
SortingSecond(Comparator<BlockPos> algorithm) {
this.algorithm = algorithm;
}
}
}

View File

@@ -1,268 +0,0 @@
package nekiplay.meteorplus.features.modules.integrations;
import baritone.api.utils.BetterBlockPos;
import baritone.api.utils.RayTraceUtils;
import baritone.api.utils.Rotation;
import baritone.api.utils.RotationUtils;
import meteordevelopment.meteorclient.utils.player.ChatUtils;
import meteordevelopment.meteorclient.utils.player.Rotations;
import meteordevelopment.meteorclient.utils.world.BlockUtils;
import net.minecraft.block.AmethystClusterBlock;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.PointedDripstoneBlock;
import net.minecraft.block.ScaffoldingBlock;
import net.minecraft.block.ShulkerBoxBlock;
import net.minecraft.block.SlabBlock;
import net.minecraft.block.StainedGlassBlock;
import net.minecraft.block.StairsBlock;
import net.minecraft.block.enums.SlabType;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.network.packet.c2s.play.HandSwingC2SPacket;
import net.minecraft.state.property.Property;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.RaycastContext;
import net.minecraft.world.RaycastContext.FluidHandling;
import net.minecraft.world.RaycastContext.ShapeType;
import static meteordevelopment.meteorclient.MeteorClient.mc;
import static meteordevelopment.meteorclient.utils.world.BlockUtils.canPlace;
public class MyUtils {
public static boolean place(BlockPos blockPos, Direction direction, boolean airPlace, boolean swingHand, boolean rotate, boolean clientSide, int range) {
if (mc.player == null) return false;
if (!canPlace(blockPos)) return false;
Vec3d hitPos = new Vec3d(blockPos.getX() + 0.5, blockPos.getY() + 0.5, blockPos.getZ() + 0.5);
BlockPos neighbour;
if (direction == null) {
direction = Direction.UP;
neighbour = blockPos;
} else if(airPlace) {
neighbour = blockPos;
}else {
neighbour = blockPos.offset(direction.getOpposite());
hitPos.add(direction.getOffsetX() * 0.5, direction.getOffsetY() * 0.5, direction.getOffsetZ() * 0.5);
}
Direction s = direction;
if (rotate) {
BetterBlockPos placeAgainstPos = new BetterBlockPos(neighbour.getX(), neighbour.getY(), neighbour.getZ());
VoxelShape collisionShape = mc.world.getBlockState(placeAgainstPos).getCollisionShape(mc.world, placeAgainstPos);
if(collisionShape.isEmpty()) {
Rotations.rotate(Rotations.getYaw(hitPos), Rotations.getPitch(hitPos), 50, clientSide,
() ->
place(new BlockHitResult(hitPos, s, neighbour, false), swingHand)
);
return true;
}
Box aabb = collisionShape.getBoundingBox();
for (Vec3d placementMultiplier : aabbSideMultipliers(direction.getOpposite())) {
double placeX = placeAgainstPos.x + aabb.minX * placementMultiplier.x + aabb.maxX * (1 - placementMultiplier.x);
double placeY = placeAgainstPos.y + aabb.minY * placementMultiplier.y + aabb.maxY * (1 - placementMultiplier.y);
double placeZ = placeAgainstPos.z + aabb.minZ * placementMultiplier.z + aabb.maxZ * (1 - placementMultiplier.z);
Vec3d testHitPos = new Vec3d(placeX, placeY, placeZ);
Vec3d playerHead = new Vec3d(mc.player.getX(), mc.player.getEyeY(), mc.player.getZ());
Rotation rot = RotationUtils.calcRotationFromVec3d(playerHead, testHitPos, new Rotation(mc.player.getYaw(), mc.player.getPitch()));
HitResult res = RayTraceUtils.rayTraceTowards(mc.player, rot, range, false);
BlockHitResult blockHitRes = ((BlockHitResult) res);
if(
res == null ||
!blockHitRes.getBlockPos().equals(placeAgainstPos) ||
blockHitRes.getSide() != direction
) continue;
Rotations.rotate(Rotations.getYaw(testHitPos), Rotations.getPitch(testHitPos), 50, clientSide,
() ->
place(new BlockHitResult(testHitPos, s, neighbour, false), swingHand)
);
return true;
}
} else {
place(new BlockHitResult(hitPos, s, neighbour, false), swingHand);
}
return true;
}
private static void place(BlockHitResult blockHitResult, boolean swing) {
if (mc.player == null || mc.interactionManager == null || mc.getNetworkHandler() == null) return;
boolean wasSneaking = mc.player.input.sneaking;
mc.player.input.sneaking = false;
ActionResult result = mc.interactionManager.interactBlock(mc.player, Hand.MAIN_HAND, blockHitResult);
if (result.shouldSwingHand()) {
if (swing) mc.player.swingHand(Hand.MAIN_HAND);
else mc.getNetworkHandler().sendPacket(new HandSwingC2SPacket(Hand.MAIN_HAND));
}
mc.player.input.sneaking = wasSneaking;
}
public static boolean isBlockNormalCube(BlockState state) {
Block block = state.getBlock();
if (block instanceof ScaffoldingBlock
|| block instanceof ShulkerBoxBlock
|| block instanceof PointedDripstoneBlock
|| block instanceof AmethystClusterBlock) {
return false;
}
try {
return Block.isShapeFullCube(state.getCollisionShape(null, null)) || state.getBlock() instanceof StairsBlock;
} catch (Exception ignored) {
// if we can't get the collision shape, assume it's bad...
}
return false;
}
public static boolean canPlaceAgainst(BlockState placeAtState, BlockState placeAgainstState, Direction against) {
// can we look at the center of a side face of this block and likely be able to place?
// therefore dont include weird things that we technically could place against (like carpet) but practically can't
return isBlockNormalCube(placeAgainstState) ||
placeAgainstState.getBlock() == Blocks.GLASS ||
placeAgainstState.getBlock() instanceof StainedGlassBlock ||
placeAgainstState.getBlock() instanceof SlabBlock &&
(
placeAgainstState.get(SlabBlock.TYPE) != SlabType.BOTTOM &&
placeAtState.getBlock() == placeAgainstState.getBlock() &&
against != Direction.DOWN ||
placeAtState.getBlock() != placeAgainstState.getBlock()
);
}
public static boolean isBlockInLineOfSight(BlockPos placeAt, BlockState placeAtState) {
Vec3d playerHead = new Vec3d(mc.player.getX(), mc.player.getEyeY(), mc.player.getZ());
Vec3d placeAtVec = new Vec3d(placeAt.getX(), placeAt.getY(), placeAt.getZ());
ShapeType type = RaycastContext.ShapeType.COLLIDER;
FluidHandling fluid = RaycastContext.FluidHandling.NONE;
RaycastContext context =
new RaycastContext(playerHead, placeAtVec, type, fluid, mc.player);
BlockHitResult bhr = mc.world.raycast(context);
// check line of sight
return (bhr.getType() == HitResult.Type.MISS);
}
public static Direction getVisiblePlaceSide(BlockPos placeAt, BlockState placeAtState, int range, Direction requiredDir) {
if (mc.world == null) return null;
for (Direction against : Direction.values()) {
BetterBlockPos placeAgainstPos = new BetterBlockPos(placeAt.getX(), placeAt.getY(), placeAt.getZ()).relative(against);
// BlockState placeAgainstState = mc.world.getBlockState(placeAgainstPos);
if(requiredDir != null && requiredDir != against && requiredDir != Direction.UP)
continue;
if(!canPlaceAgainst(
placeAtState,
mc.world.getBlockState(placeAgainstPos),
against
))
continue;
Box aabb = mc.world.getBlockState(placeAgainstPos).getCollisionShape(mc.world, placeAgainstPos).getBoundingBox();
for (Vec3d placementMultiplier : aabbSideMultipliers(against)) {
double placeX = placeAgainstPos.x + aabb.minX * placementMultiplier.x + aabb.maxX * (1 - placementMultiplier.x);
double placeY = placeAgainstPos.y + aabb.minY * placementMultiplier.y + aabb.maxY * (1 - placementMultiplier.y);
double placeZ = placeAgainstPos.z + aabb.minZ * placementMultiplier.z + aabb.maxZ * (1 - placementMultiplier.z);
Vec3d hitPos = new Vec3d(placeX, placeY, placeZ);
Vec3d playerHead = new Vec3d(mc.player.getX(), mc.player.getEyeY(), mc.player.getZ());
Rotation rot = RotationUtils.calcRotationFromVec3d(playerHead, hitPos, new Rotation(mc.player.getYaw(), mc.player.getPitch()));
HitResult res = RayTraceUtils.rayTraceTowards(mc.player, rot, range, false);
BlockHitResult blockHitRes = ((BlockHitResult) res);
if(
res == null
|| res.getType() != HitResult.Type.BLOCK
|| !blockHitRes.getBlockPos().equals(placeAgainstPos)
|| blockHitRes.getSide() != against.getOpposite()
) continue;
return against.getOpposite();
}
}
return null;
}
public static Direction getPlaceSide(BlockPos blockPos, Direction requiredDir) {
for (Direction side : Direction.values()) {
BlockPos neighbor = blockPos.offset(side);
Direction side2 = side.getOpposite();
if(requiredDir != null && requiredDir != side2 && requiredDir != Direction.UP)
continue;
BlockState state = mc.world.getBlockState(neighbor);
// Check if neighbour isn't empty
if (state.isAir() || !BlockUtils.isClickable(state.getBlock())) continue;
// Check if neighbour is a fluid
if (!state.getFluidState().isEmpty()) continue;
ChatUtils.info("" + side2);
return side2;
}
return null;
}
public static NbtCompound getNbtFromBlockState (ItemStack itemStack, BlockState state) {
NbtCompound nbt = itemStack.getOrCreateNbt();
NbtCompound subNbt = new NbtCompound();
for (Property<?> property : state.getProperties()) {
subNbt.putString(property.getName(), state.get(property).toString());
}
nbt.put("BlockStateTag", subNbt);
return nbt;
}
private static Vec3d[] aabbSideMultipliers(Direction side) {
switch (side) {
case UP -> {
return new Vec3d[]{new Vec3d(0.5, 1, 0.5), new Vec3d(0.1, 1, 0.5), new Vec3d(0.9, 1, 0.5), new Vec3d(0.5, 1, 0.1), new Vec3d(0.5, 1, 0.9)};
}
case DOWN -> {
return new Vec3d[]{new Vec3d(0.5, 0, 0.5), new Vec3d(0.1, 0, 0.5), new Vec3d(0.9, 0, 0.5), new Vec3d(0.5, 0, 0.1), new Vec3d(0.5, 0, 0.9)};
}
case NORTH, SOUTH, EAST, WEST -> {
double x = side.getOffsetX() == 0 ? 0.5 : (1 + side.getOffsetX()) / 2D;
double z = side.getOffsetZ() == 0 ? 0.5 : (1 + side.getOffsetZ()) / 2D;
return new Vec3d[]{new Vec3d(x, 0.25, z), new Vec3d(x, 0.75, z)};
}
default -> // null
throw new IllegalStateException();
}
}
}

View File

@@ -1,116 +0,0 @@
package nekiplay.meteorplus.features.modules.integrations.journeymap;
import baritone.api.BaritoneAPI;
import baritone.api.IBaritone;
import baritone.api.pathing.goals.GoalBlock;
import journeymap.client.api.IClientAPI;
import journeymap.client.api.IClientPlugin;
import journeymap.client.api.display.ModPopupMenu;
import journeymap.client.api.event.ClientEvent;
import journeymap.client.api.event.fabric.FabricEvents;
import meteordevelopment.meteorclient.systems.modules.Modules;
import meteordevelopment.meteorclient.utils.player.ChatUtils;
import meteordevelopment.meteorclient.utils.player.PlayerUtils;
import meteordevelopment.meteorclient.utils.world.Dimension;
import nekiplay.Main;
import nekiplay.meteorplus.MeteorPlusAddon;
import nekiplay.meteorplus.features.modules.integrations.MapIntegration;
import net.minecraft.text.Text;
public class JourneyMapMeteorPlus implements IClientPlugin {
public final String JourneyMapLOGPREFIX = "[Journey Map]";
@Override
public void initialize(final IClientAPI jmClientApi) {
MapIntegration mapIntegration = Modules.get().get(MapIntegration.class);
MeteorPlusAddon.LOG.info(Main.METEOR_LOGPREFIX + " " + JourneyMapLOGPREFIX + " loading Journey Map integrate");
FabricEvents.FULLSCREEN_POPUP_MENU_EVENT.register(event -> {
MeteorPlusAddon.LOG.info(Main.METEOR_LOGPREFIX + " " + JourneyMapLOGPREFIX + " register fullscreen Journey Map");
ModPopupMenu popupMenu = event.getPopupMenu();
if (mapIntegration.baritoneGoto.get()) {
popupMenu.addMenuItem(Text.translatable("gui.world_map.baritone_goal_here").getString(), p -> {
GoalBlock goal = new GoalBlock(p.up());
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoal(goal);
});
popupMenu.addMenuItem(Text.translatable("gui.world_map.baritone_path_here").getString(), p -> {
GoalBlock goal = new GoalBlock(p.up());
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoal(goal);
});
if (mapIntegration.baritoneElytra.get() && PlayerUtils.getDimension() == Dimension.Nether) {
popupMenu.addMenuItem(Text.translatable("gui.world_map.baritone_elytra_here").getString(), p -> {
GoalBlock goal = new GoalBlock(p.up());
if (goal.y > 0 && goal.y < 128) {
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoal(goal);
for (IBaritone baritone : BaritoneAPI.getProvider().getAllBaritones()) {
if (!baritone.getCommandManager().getRegistry().stream().filter((a) -> a.getNames().get(0).equalsIgnoreCase("elytra")).findAny().isEmpty()) {
baritone.getCommandManager().execute("elytra");
break;
}
}
}
else {
ChatUtils.error("The y of the goal is not between 0 and 128");
}
});
}
}
MeteorPlusAddon.LOG.info(Main.METEOR_LOGPREFIX + " " + JourneyMapLOGPREFIX + " register fullscreen Journey Map done");
});
FabricEvents.WAYPOINT_POPUP_MENU_EVENT.register(event -> {
MeteorPlusAddon.LOG.info(Main.METEOR_LOGPREFIX + " " + JourneyMapLOGPREFIX + " register waypoints Journey Map");
ModPopupMenu popupMenu = event.getPopupMenu();
if (mapIntegration != null && mapIntegration.baritoneGoto.get()) {
popupMenu.addMenuItem(Text.translatable("gui.world_map.baritone_goal_here").getString(), p -> {
GoalBlock goal = new GoalBlock(p.up());
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoal(goal);
});
popupMenu.addMenuItem(Text.translatable("gui.world_map.baritone_path_here").getString(), p -> {
GoalBlock goal = new GoalBlock(p.up());
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoal(goal);
});
if (mapIntegration.baritoneElytra.get() && PlayerUtils.getDimension() == Dimension.Nether) {
popupMenu.addMenuItem(Text.translatable("gui.world_map.baritone_elytra_here").getString(), p -> {
GoalBlock goal = new GoalBlock(p.up());
if (goal.y > 0 && goal.y < 128) {
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoal(goal);
for (IBaritone baritone : BaritoneAPI.getProvider().getAllBaritones()) {
if (!baritone.getCommandManager().getRegistry().stream().filter((a) -> a.getNames().get(0).equalsIgnoreCase("elytra")).findAny().isEmpty()) {
baritone.getCommandManager().execute("elytra");
break;
}
}
}
else {
ChatUtils.error("The y of the goal is not between 0 and 128");
}
});
}
}
MeteorPlusAddon.LOG.info(Main.METEOR_LOGPREFIX + " " + JourneyMapLOGPREFIX + " register waypoints Journey Map done");
});
MeteorPlusAddon.LOG.info(Main.METEOR_LOGPREFIX + " " + JourneyMapLOGPREFIX + " initializing tab...");
MeteorPlusAddon.LOG.info(Main.METEOR_LOGPREFIX + " " + JourneyMapLOGPREFIX + " loaded tab");
MeteorPlusAddon.LOG.info(Main.METEOR_LOGPREFIX + " " + JourneyMapLOGPREFIX + " Journey Map integrate loaded");
}
@Override
public String getModId() {
return "meteorplus";
}
@Override
public void onEvent(ClientEvent event) {
}
}

View File

@@ -1,31 +0,0 @@
package nekiplay.meteorplus.features.modules.movement;
import meteordevelopment.meteorclient.settings.BoolSetting;
import meteordevelopment.meteorclient.settings.Setting;
import meteordevelopment.meteorclient.settings.SettingGroup;
import meteordevelopment.meteorclient.systems.modules.Categories;
import meteordevelopment.meteorclient.systems.modules.Module;
import meteordevelopment.meteorclient.utils.player.Rotations;
public class SprintPlus extends Module {
public SprintPlus() {
super(Categories.Movement, "sprint+", "Better sprint module.");
}
private final SettingGroup sgGeneral = settings.getDefaultGroup();
private final Setting<Boolean> allDirections = sgGeneral.add(new BoolSetting.Builder()
.name("All-directions")
.defaultValue(false)
.build()
);
private final Setting<Boolean> ignoreBlindness = sgGeneral.add(new BoolSetting.Builder()
.name("Ignore-blindness")
.defaultValue(false)
.build()
);
public boolean shouldSprintOmnidirectionally() { return isActive() && allDirections.get(); }
public boolean shouldIgnoreBlindness() { return isActive() && ignoreBlindness.get(); }
}

View File

@@ -202,7 +202,7 @@ public class AutoToolMixin extends Module
if (enchantPreference == AutoTool.EnchantPreference.SilkTouch) score += EnchantmentHelper.getLevel(Enchantments.SILK_TOUCH, itemStack);
if (itemStack.getItem() instanceof SwordItem item && (state.getBlock() instanceof BambooBlock || state.getBlock() instanceof BambooShootBlock))
score += 9000 + (item.getMaterial().getMiningLevel() * 1000);
score += 9000 + (item.getMaterial().getMiningSpeedMultiplier() * 1000);
return score;

View File

@@ -1,19 +1,13 @@
package nekiplay.meteorplus.mixin.minecraft.entity;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import meteordevelopment.meteorclient.MeteorClient;
import meteordevelopment.meteorclient.systems.modules.Modules;
import nekiplay.main.events.PlayerUseMultiplierEvent;
import nekiplay.meteorplus.features.modules.movement.SprintPlus;
import nekiplay.meteorplus.features.modules.movement.noslow.NoSlowPlus;
import net.minecraft.client.input.Input;
import net.minecraft.client.network.ClientPlayerEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.*;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(value = ClientPlayerEntity.class, priority = 1002)
public abstract class ClientPlayerEntityMixin {
@@ -41,40 +35,4 @@ public abstract class ClientPlayerEntityMixin {
input.movementForward *= playerUseMultiplier.getForward();
input.movementSideways *= playerUseMultiplier.getSideways();
}
/**
* Hook sprint effect from NoSlow module
*/
@Inject(method = "canStartSprinting", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isUsingItem()Z"), cancellable = true)
private void hookSprintAffectStartF(CallbackInfoReturnable<Boolean> cir) {
if (Modules.get().get(NoSlowPlus.class).isActive()) {
cir.setReturnValue(true);
}
}
@Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isWalking()Z"))
private boolean hookOmnidirectionalSprintB(ClientPlayerEntity instance) {
return isOmniWalking(instance);
}
@ModifyExpressionValue(method = "canStartSprinting", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;hasStatusEffect(Lnet/minecraft/entity/effect/StatusEffect;)Z"))
private boolean hookSprintIgnoreBlindnessF(boolean original) {
SprintPlus sprintPlus = Modules.get().get(SprintPlus.class);
if (sprintPlus == null) { return false; }
return !sprintPlus.shouldIgnoreBlindness() && original;
}
@Redirect(method = "canStartSprinting", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isWalking()Z"))
private boolean hookOmnidirectionalSprintC(ClientPlayerEntity instance) {
return isOmniWalking(instance);
}
@Unique
private boolean isOmniWalking(ClientPlayerEntity instance) {
boolean hasMovement = Math.abs(instance.input.movementForward) > 1.0E-5F || Math.abs(instance.input.movementSideways) > 1.0E-5F;
boolean isWalking = (double) Math.abs(instance.input.movementForward) >= 0.8 || (double) Math.abs(instance.input.movementSideways) >= 0.8;
boolean modifiedIsWalking = this.isSubmergedInWater() ? hasMovement : isWalking;
SprintPlus sprintPlus = Modules.get().get(SprintPlus.class);
if (sprintPlus == null) { return false; }
return sprintPlus.shouldSprintOmnidirectionally() ? modifiedIsWalking : this.isWalking();
}
}

View File

@@ -40,7 +40,7 @@ public class RenderingMixin {
pose.translate(pos.x, pos.y + whereIsIt.y_offset.get(), pos.z);
pose.multiply(camera.getRotation());
var factor = 0.025f * WhereIsItConfig.INSTANCE.instance().getClient().containerNameLabelScale;
var factor = 0.025f * 1;
pose.scale(-factor, -factor, factor);
var matrix4f = pose.peek().getPositionMatrix();

View File

@@ -74,7 +74,7 @@ public abstract class GuiMapMixin {
int mouseBlockPosZ = (int) Math.floor(mousePosZ);
int renderedCaveLayer = mapProcessor.getCurrentCaveLayer();
MapRegion leafRegion = this.mapProcessor.getMapRegion(renderedCaveLayer, mouseBlockPosX >> 9, mouseBlockPosZ >> 9, false);
MapRegion leafRegion = this.mapProcessor.getLeafMapRegion(renderedCaveLayer, mouseBlockPosX >> 9, mouseBlockPosZ >> 9, false);
MapTileChunk chunk = leafRegion == null ? null : leafRegion.getChunk(mouseBlockPosX >> 6 & 7, mouseBlockPosZ >> 6 & 7);
MapTile mouseTile = chunk == null ? null : chunk.getTile(mouseBlockPosX >> 4 & 3, mouseBlockPosZ >> 4 & 3);

View File

@@ -21,6 +21,7 @@ import net.minecraft.item.Items;
import net.minecraft.network.packet.c2s.play.ClientStatusC2SPacket;
import net.minecraft.registry.Registries;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.stat.Stat;
import net.minecraft.stat.Stats;
import net.minecraft.util.Identifier;
@@ -29,6 +30,7 @@ import net.minecraft.util.math.Vec3d;
import org.apache.commons.lang3.StringUtils;
import java.util.Arrays;
import java.util.Optional;
import java.util.stream.Collectors;
import static meteordevelopment.meteorclient.MeteorClient.mc;
@@ -473,10 +475,10 @@ public class ConfigModifier {
Identifier name = popIdentifier(ss, "First argument to player.has_potion_effect() needs to a string.");
StatusEffect effect = Registries.STATUS_EFFECT.get(name);
if (effect == null) return Value.bool(false);
Optional<RegistryEntry.Reference<StatusEffect>> effect = Registries.STATUS_EFFECT.getEntry(name);
if (effect.isEmpty()) return Value.null_();
StatusEffectInstance effectInstance = mc.player.getStatusEffect(effect);
StatusEffectInstance effectInstance = mc.player.getStatusEffect(effect.get());
return Value.bool(effectInstance != null);
}
@@ -486,10 +488,10 @@ public class ConfigModifier {
Identifier name = popIdentifier(ss, "First argument to player.get_potion_effect() needs to a string.");
StatusEffect effect = Registries.STATUS_EFFECT.get(name);
if (effect == null) return Value.null_();
Optional<RegistryEntry.Reference<StatusEffect>> effect = Registries.STATUS_EFFECT.getEntry(name);
if (effect.isEmpty()) return Value.null_();
StatusEffectInstance effectInstance = mc.player.getStatusEffect(effect);
StatusEffectInstance effectInstance = mc.player.getStatusEffect(effect.get());
if (effectInstance == null) return Value.null_();
return wrap(effectInstance);

View File

@@ -79,7 +79,7 @@ public class BlockHelper {
}
public static boolean outOfRange(BlockPos cityBlock) {
return MathHelper.sqrt((float) mc.player.squaredDistanceTo(cityBlock.getX(), cityBlock.getY(), cityBlock.getZ())) > mc.interactionManager.getReachDistance();
return MathHelper.sqrt((float) mc.player.squaredDistanceTo(cityBlock.getX(), cityBlock.getY(), cityBlock.getZ())) > 4;
}
public static BlockPos opposite(BlockPos pos, Dimension dimension)

View File

@@ -22,9 +22,6 @@
],
"meteor": [
"nekiplay.meteorplus.MeteorPlusAddon"
],
"journeymap": [
"nekiplay.meteorplus.modules.integrations.journeymap.JourneyMapMeteorPlus"
]
},
"mixins": [