Add an option to change your UA (#244)

This commit is contained in:
Soda5601
2023-04-08 16:07:21 +08:00
committed by GitHub
parent 5ee9db0987
commit cc91428cb8
6 changed files with 34 additions and 41 deletions

View File

@@ -20,6 +20,14 @@ public class ConfigModifier {
.build()
);
public final Setting<String> httpUserAgent = sgRejects.add(new StringSetting.Builder()
.name("http-user-agent")
.description("Changes the HTTP user agent. Empty for none.")
.defaultValue(RejectsConfig.get().httpUserAgent)
.onChanged(v -> RejectsConfig.get().httpUserAgent = v)
.build()
);
public final Setting<List<Module>> hiddenModules = sgRejects.add(new ModuleListSetting.Builder()
.name("hidden-modules")
.description("Which modules to hide.")

View File

@@ -26,6 +26,7 @@ public class RejectsConfig extends System<RejectsConfig> {
}
public HttpAllowed httpAllowed = HttpAllowed.Everything;
public String httpUserAgent = "Meteor Client";
public Set<String> hiddenModules = new HashSet<>();
public boolean loadSystemFonts = true;
public boolean duplicateModuleNames = false;
@@ -66,6 +67,7 @@ public class RejectsConfig extends System<RejectsConfig> {
public NbtCompound toTag() {
NbtCompound tag = new NbtCompound();
tag.putString("httpAllowed", httpAllowed.toString());
tag.putString("httpUserAgent", httpUserAgent);
tag.putBoolean("loadSystemFonts", loadSystemFonts);
tag.putBoolean("duplicateModuleNames", duplicateModuleNames);
@@ -79,6 +81,7 @@ public class RejectsConfig extends System<RejectsConfig> {
@Override
public RejectsConfig fromTag(NbtCompound tag) {
httpAllowed = HttpAllowed.valueOf(tag.getString("httpAllowed"));
httpUserAgent = tag.getString("httpUserAgent");
loadSystemFonts = tag.getBoolean("loadSystemFonts");
duplicateModuleNames = tag.getBoolean("duplicateModuleNames");

View File

@@ -1,38 +0,0 @@
package anticope.rejects.utils;
import meteordevelopment.meteorclient.MeteorClient;
import meteordevelopment.meteorclient.utils.Utils;
import net.minecraft.block.BlockState;
import net.minecraft.fluid.FluidState;
import net.minecraft.util.math.BlockPos;
import java.util.Optional;
public class TntDamage {
public static int calculate(BlockPos bp) {
if (!Utils.canUpdate()) return 0;
int score = 0;
for(int j = -5; j <= 5; ++j) {
for(int k = -5; k <= 5; ++k) {
for(int l = -5; l <= 5; ++l) {
BlockPos blockPos = new BlockPos(j, k, l);
BlockState blockState = MeteorClient.mc.world.getBlockState(blockPos);
FluidState fluidState = MeteorClient.mc.world.getFluidState(blockPos);
float h = 2.8F;
Optional<Float> optional = blockState.isAir() && fluidState.isEmpty() ? Optional.empty() : Optional.of(Math.max(blockState.getBlock().getBlastResistance(), fluidState.getBlastResistance()));;
if (optional.isPresent()) {
h -= (optional.get() + 0.3F) * 0.3F;
}
if (h > 0.0F) {
score++;
}
}
}
}
return score;
}
}