Skip to content

Commit edde9bb

Browse files
committed
cleanup most of the aws
1 parent 2e377bc commit edde9bb

7 files changed

Lines changed: 70 additions & 79 deletions

File tree

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx4G
99

1010
# Mod Properties
1111

12-
mod_version = 1.2.0+alpha.6
12+
mod_version = 1.2.0+alpha.7
1313
maven_group = soltweaks
1414
archives_base_name = soltweaks
1515

src/main/java/dev/solcraft/soltweaks/mixins/accessors/SimplexNoiseSamplerAccessors.java

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,51 @@
11
package dev.solcraft.soltweaks.mixins.accessors;
22

3+
import com.mojang.brigadier.exceptions.CommandSyntaxException;
4+
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
5+
import net.minecraft.server.command.ServerCommandSource;
36
import net.minecraft.server.command.WorldBorderCommand;
7+
import net.minecraft.util.math.Vec2f;
48
import org.spongepowered.asm.mixin.Mixin;
9+
import org.spongepowered.asm.mixin.gen.Accessor;
10+
import org.spongepowered.asm.mixin.gen.Invoker;
511

612
@Mixin(WorldBorderCommand.class)
713
public interface WorldBorderCommandAccessor {
8-
}
14+
15+
@Invoker("executeGet")
16+
static int executeGet(ServerCommandSource source) {
17+
throw new AssertionError();
18+
}
19+
20+
@Invoker("executeSet")
21+
static int executeSet(ServerCommandSource source, double distance, long time) throws CommandSyntaxException {
22+
throw new AssertionError();
23+
}
24+
25+
@Invoker("executeCenter")
26+
static int executeCenter(ServerCommandSource source, Vec2f pos) {
27+
throw new AssertionError();
28+
}
29+
30+
@Invoker("executeWarningDistance")
31+
static int executeWarningDistance(ServerCommandSource source, int i)
32+
{
33+
throw new AssertionError();
34+
}
35+
36+
@Invoker("executeBuffer")
37+
static int executeBuffer(ServerCommandSource source, float f) {
38+
throw new AssertionError();
39+
}
40+
41+
@Invoker("executeDamage")
42+
static int executeDamage(ServerCommandSource source, float f) {
43+
throw new AssertionError();
44+
}
45+
46+
@Invoker("executeWarningTime")
47+
static int executeWarningTime(ServerCommandSource source, int i) {
48+
throw new AssertionError();
49+
}
50+
51+
}

src/main/java/dev/solcraft/soltweaks/mixins/worldborder/supercoder/MixinWorld.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public abstract class MixinWorld implements WorldAccess {
1818
* @reason
1919
*/
2020
@Overwrite @Final
21-
public static boolean isValidHorizontally(BlockPos pos) {
21+
private static boolean isValidHorizontally(BlockPos pos) {
2222
return pos.getX() >= Integer.MIN_VALUE && pos.getZ() >= Integer.MIN_VALUE && pos.getX() < Integer.MAX_VALUE && pos.getZ() < Integer.MAX_VALUE;
2323
}
2424

@@ -29,7 +29,7 @@ public static boolean isValidHorizontally(BlockPos pos) {
2929
* @reason
3030
*/
3131
@Overwrite @Final
32-
public static boolean isInvalidVertically(int y) {
32+
private static boolean isInvalidVertically(int y) {
3333
return y < Integer.MIN_VALUE || y >= Integer.MAX_VALUE;
3434
}
3535

src/main/java/dev/solcraft/soltweaks/mixins/worldborder/zeta/MixinWorldBorderCommand.java

Lines changed: 20 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.mojang.brigadier.builder.RequiredArgumentBuilder;
99
import com.mojang.brigadier.exceptions.CommandSyntaxException;
1010
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
11+
import dev.solcraft.soltweaks.mixins.accessors.WorldBorderCommandAccessor;
1112
import net.minecraft.command.argument.Vec2ArgumentType;
1213
import net.minecraft.server.command.CommandManager;
1314
import net.minecraft.server.command.ServerCommandSource;
@@ -20,7 +21,9 @@
2021
import org.spongepowered.asm.mixin.Overwrite;
2122
import org.spongepowered.asm.mixin.Shadow;
2223
import org.spongepowered.asm.mixin.injection.At;
24+
import org.spongepowered.asm.mixin.injection.Constant;
2325
import org.spongepowered.asm.mixin.injection.Inject;
26+
import org.spongepowered.asm.mixin.injection.ModifyConstant;
2427
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
2528

2629
import java.util.Locale;
@@ -30,7 +33,7 @@
3033
@Mixin(WorldBorderCommand.class)
3134
public abstract class MixinWorldBorderCommand {
3235
@Shadow
33-
public static SimpleCommandExceptionType SET_FAILED_BIG_EXCEPTION;
36+
private static SimpleCommandExceptionType SET_FAILED_BIG_EXCEPTION;
3437

3538
@Shadow
3639
@Final
@@ -40,67 +43,43 @@ public abstract class MixinWorldBorderCommand {
4043

4144
@Inject(method = "<clinit>", at = @At("RETURN"))
4245
private static void handleConstructor(CallbackInfo ci) {
43-
SET_FAILED_BIG_EXCEPTION = new SimpleCommandExceptionType(new TranslatableText("commands.worldborder.set.failed.big", 4294967294D));
46+
SET_FAILED_BIG_EXCEPTION = new SimpleCommandExceptionType(new TranslatableText("commands.worldborder.set.failed.big", 4294967294D));
4447
}
4548
/**
4649
* @author Zeta
4750
* @reason Fix wb
4851
*/
52+
@SuppressWarnings("all")
4953
@Overwrite
5054
public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
5155
dispatcher.register((LiteralArgumentBuilder)((LiteralArgumentBuilder)((LiteralArgumentBuilder)((LiteralArgumentBuilder)((LiteralArgumentBuilder)((LiteralArgumentBuilder)((LiteralArgumentBuilder) CommandManager.literal("worldborder").requires((source) -> {
5256
return source.hasPermissionLevel(2);
5357
//TODO: Change these back and remove static import
5458
})).then(CommandManager.literal("add").then(((RequiredArgumentBuilder)CommandManager.argument("distance", DoubleArgumentType.doubleArg(-4294967294D, 4294967294D)).executes((context) -> {
55-
return executeSet((ServerCommandSource)context.getSource(), ((ServerCommandSource)context.getSource()).getWorld().getWorldBorder().getSize() + DoubleArgumentType.getDouble(context, "distance"), 0L);
59+
return WorldBorderCommandAccessor.executeSet((ServerCommandSource)context.getSource(), ((ServerCommandSource)context.getSource()).getWorld().getWorldBorder().getSize() + DoubleArgumentType.getDouble(context, "distance"), 0L);
5660
})).then(CommandManager.argument("time", IntegerArgumentType.integer(0)).executes((context) -> {
57-
return executeSet((ServerCommandSource)context.getSource(), ((ServerCommandSource)context.getSource()).getWorld().getWorldBorder().getSize() + DoubleArgumentType.getDouble(context, "distance"), ((ServerCommandSource)context.getSource()).getWorld().getWorldBorder().getSizeLerpTime() + (long)IntegerArgumentType.getInteger(context, "time") * 1000L);
61+
return WorldBorderCommandAccessor.executeSet((ServerCommandSource)context.getSource(), ((ServerCommandSource)context.getSource()).getWorld().getWorldBorder().getSize() + DoubleArgumentType.getDouble(context, "distance"), ((ServerCommandSource)context.getSource()).getWorld().getWorldBorder().getSizeLerpTime() + (long)IntegerArgumentType.getInteger(context, "time") * 1000L);
5862
}))))).then(CommandManager.literal("set").then(((RequiredArgumentBuilder)CommandManager.argument("distance", DoubleArgumentType.doubleArg(-4294967294D, 4294967294D)).executes((context) -> {
59-
return executeSet((ServerCommandSource)context.getSource(), DoubleArgumentType.getDouble(context, "distance"), 0L);
63+
return WorldBorderCommandAccessor.executeSet((ServerCommandSource)context.getSource(), DoubleArgumentType.getDouble(context, "distance"), 0L);
6064
})).then(CommandManager.argument("time", IntegerArgumentType.integer(0)).executes((context) -> {
61-
return executeSet((ServerCommandSource)context.getSource(), DoubleArgumentType.getDouble(context, "distance"), (long)IntegerArgumentType.getInteger(context, "time") * 1000L);
65+
return WorldBorderCommandAccessor.executeSet((ServerCommandSource)context.getSource(), DoubleArgumentType.getDouble(context, "distance"), (long)IntegerArgumentType.getInteger(context, "time") * 1000L);
6266
}))))).then(CommandManager.literal("center").then(CommandManager.argument("pos", Vec2ArgumentType.vec2()).executes((context) -> {
63-
return executeCenter((ServerCommandSource)context.getSource(), Vec2ArgumentType.getVec2(context, "pos"));
67+
return WorldBorderCommandAccessor.executeCenter((ServerCommandSource)context.getSource(), Vec2ArgumentType.getVec2(context, "pos"));
6468
})))).then(((LiteralArgumentBuilder)CommandManager.literal("damage").then(CommandManager.literal("amount").then(CommandManager.argument("damagePerBlock", FloatArgumentType.floatArg(0.0F)).executes((context) -> {
65-
return executeDamage((ServerCommandSource)context.getSource(), FloatArgumentType.getFloat(context, "damagePerBlock"));
69+
return WorldBorderCommandAccessor.executeDamage((ServerCommandSource)context.getSource(), FloatArgumentType.getFloat(context, "damagePerBlock"));
6670
})))).then(CommandManager.literal("buffer").then(CommandManager.argument("distance", FloatArgumentType.floatArg(0.0F)).executes((context) -> {
67-
return executeBuffer((ServerCommandSource)context.getSource(), FloatArgumentType.getFloat(context, "distance"));
71+
return WorldBorderCommandAccessor.executeBuffer((ServerCommandSource)context.getSource(), FloatArgumentType.getFloat(context, "distance"));
6872
}))))).then(CommandManager.literal("get").executes((context) -> {
69-
return executeGet((ServerCommandSource)context.getSource());
73+
return WorldBorderCommandAccessor.executeGet(((ServerCommandSource)context.getSource()));
7074
}))).then(((LiteralArgumentBuilder)CommandManager.literal("warning").then(CommandManager.literal("distance").then(CommandManager.argument("distance", IntegerArgumentType.integer(0)).executes((context) -> {
71-
return executeWarningDistance((ServerCommandSource)context.getSource(), IntegerArgumentType.getInteger(context, "distance"));
75+
return WorldBorderCommandAccessor.executeWarningDistance((ServerCommandSource)context.getSource(), IntegerArgumentType.getInteger(context, "distance"));
7276
})))).then(CommandManager.literal("time").then(CommandManager.argument("time", IntegerArgumentType.integer(0)).executes((context) -> {
73-
return executeWarningTime((ServerCommandSource)context.getSource(), IntegerArgumentType.getInteger(context, "time"));
77+
return WorldBorderCommandAccessor.executeWarningTime((ServerCommandSource)context.getSource(), IntegerArgumentType.getInteger(context, "time"));
7478
})))));
7579
}
76-
/**
77-
* @author
78-
* @reason
79-
*/
80-
@Overwrite
81-
private static int executeSet(ServerCommandSource source, double distance, long time) throws CommandSyntaxException {
82-
WorldBorder worldBorder = source.getWorld().getWorldBorder();
83-
double d = worldBorder.getSize();
84-
if (d == distance) {
85-
throw SET_FAILED_NO_CHANGE_EXCEPTION.create();
86-
} else if (distance < 1.0D) {
87-
throw SET_FAILED_SMALL_EXCEPTION.create();
88-
} else if (distance > 4294967294D) {
89-
throw SET_FAILED_BIG_EXCEPTION.create();
90-
} else {
91-
if (time > 0L) {
92-
worldBorder.interpolateSize(d, distance, time);
93-
if (distance > d) {
94-
source.sendFeedback(new TranslatableText("commands.worldborder.set.grow", new Object[]{String.format(Locale.ROOT, "%.1f", distance), Long.toString(time / 1000L)}), true);
95-
} else {
96-
source.sendFeedback(new TranslatableText("commands.worldborder.set.shrink", new Object[]{String.format(Locale.ROOT, "%.1f", distance), Long.toString(time / 1000L)}), true);
97-
}
98-
} else {
99-
worldBorder.setSize(distance);
100-
source.sendFeedback(new TranslatableText("commands.worldborder.set.immediate", new Object[]{String.format(Locale.ROOT, "%.1f", distance)}), true);
101-
}
102-
103-
return (int)(distance - d);
104-
}
80+
// Modify the constant in the executeSet method
81+
@ModifyConstant(method = "executeSet", constant = @Constant(doubleValue = 5.9999968E7))
82+
private static double replaceMaxBorderSize(double original) {
83+
return 4294967294D;
10584
}
10685
}

src/main/resources/soltweaks.accesswidener

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,8 @@ accessWidener v1 named
33
accessible class net/minecraft/world/border/WorldBorder$Area
44
accessible class net/minecraft/world/border/WorldBorder$StaticArea
55

6-
# For shard farlands
7-
8-
#accessible method net/minecraft/util/math/noise/PerlinNoiseSampler sampleDerivative (IIIDDD[D)D
6+
accessible field net/minecraft/server/command/WorldBorderCommand SET_FAILED_BIG_EXCEPTION Lcom/mojang/brigadier/exceptions/SimpleCommandExceptionType;
97

108
accessible class net/minecraft/world/gen/chunk/AquiferSampler$Impl$FluidLevel
119
accessible class net/minecraft/world/gen/chunk/AquiferSampler$Impl
12-
accessible class net/minecraft/util/collection/LinkedBlockPosHashSet$Storage
13-
accessible method net/minecraft/server/command/WorldBorderCommand executeBuffer (Lnet/minecraft/server/command/ServerCommandSource;F)I
14-
accessible method net/minecraft/server/command/WorldBorderCommand executeDamage (Lnet/minecraft/server/command/ServerCommandSource;F)I
15-
accessible method net/minecraft/server/command/WorldBorderCommand executeCenter (Lnet/minecraft/server/command/ServerCommandSource;Lnet/minecraft/util/math/Vec2f;)I
16-
17-
accessible method net/minecraft/server/command/WorldBorderCommand executeGet (Lnet/minecraft/server/command/ServerCommandSource;)I
18-
accessible method net/minecraft/server/command/WorldBorderCommand executeWarningDistance (Lnet/minecraft/server/command/ServerCommandSource;I)I
19-
accessible method net/minecraft/server/command/WorldBorderCommand executeWarningTime (Lnet/minecraft/server/command/ServerCommandSource;I)I
20-
accessible field net/minecraft/server/command/WorldBorderCommand SET_FAILED_BIG_EXCEPTION Lcom/mojang/brigadier/exceptions/SimpleCommandExceptionType;
21-
22-
# Mutables
23-
mutable field net/minecraft/util/collection/LinkedBlockPosHashSet$Storage STARTING_OFFSET I
24-
mutable field net/minecraft/util/collection/LinkedBlockPosHashSet$Storage HORIZONTAL_COLUMN_BIT_SEPARATION I
25-
mutable field net/minecraft/server/command/WorldBorderCommand SET_FAILED_BIG_EXCEPTION Lcom/mojang/brigadier/exceptions/SimpleCommandExceptionType;
26-
27-
# Hopefully fix incompats
28-
29-
accessible method net/minecraft/world/World isInvalidVertically (I)Z
30-
accessible method net/minecraft/world/World isValidHorizontally (Lnet/minecraft/util/math/BlockPos;)Z
10+
accessible class net/minecraft/util/collection/LinkedBlockPosHashSet$Storage

src/main/resources/soltweaks.mixins.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"worldborder.zeta.MixinLinkedBlockPosHashSetStorage",
2020
"worldborder.zeta.MixinWorldBorderCommand",
2121
"accessors.PerlinNoiseSamplerAccessor",
22+
"accessors.WorldBorderCommandAccessor",
2223
"worldborder.zeta.MixinWorldView",
2324
"IndividualNoiseMixin",
2425
"SpawnEggFixMixin"

0 commit comments

Comments
 (0)