diff --git a/README.md b/README.md
index 6b209de0..3a001a6a 100644
--- a/README.md
+++ b/README.md
@@ -30,8 +30,6 @@ To set this up just add the latest litematica version to your mods folder as wel
`easyPlaceActivation`: "When the easyPlaceMode is enabled, this key must be held to enable placing the blocks when using the vanilla Use key"
`easyPlaceToggle`: "Allows quickly toggling on/off the Easy Place mode"
-`easyPlaceLimitMinY`: "it will allow printer's acting y minimum range. for 1.17 datapacks"
-`easyPlaceLimitMaxY`: "it will allow printer's acting y maximum range. for 1.17 datapacks"
## Support
If you have any issues with this mod **DO NOT** contact and bother masa with it. Please message me in discord, I am usually around Scicraft, Mechanists, and Hekate.
diff --git a/src/main/java/io/github/eatmyvenom/litematicin/LitematicaMixinMod.java b/src/main/java/io/github/eatmyvenom/litematicin/LitematicaMixinMod.java
index 5d635f4d..5d0adc0c 100644
--- a/src/main/java/io/github/eatmyvenom/litematicin/LitematicaMixinMod.java
+++ b/src/main/java/io/github/eatmyvenom/litematicin/LitematicaMixinMod.java
@@ -13,8 +13,6 @@ public class LitematicaMixinMod implements ModInitializer {
public static final ConfigInteger EASY_PLACE_MODE_RANGE_X = new ConfigInteger("easyPlaceModeRangeX", 3, 0, 1024, "X Range for EasyPlace");
public static final ConfigInteger EASY_PLACE_MODE_RANGE_Y = new ConfigInteger("easyPlaceModeRangeY", 3, 0, 1024, "Y Range for EasyPlace");
public static final ConfigInteger EASY_PLACE_MODE_RANGE_Z = new ConfigInteger("easyPlaceModeRangeZ", 3, 0, 1024, "Z Range for EasyPlace");
- public static final ConfigInteger EASY_PLACE_Y_MIN = new ConfigInteger("easyplaceLimitMinY", 0, -256, 1024, "Limits or allows easy place acting Y range");
- public static final ConfigInteger EASY_PLACE_Y_MAX = new ConfigInteger("easyplaceLimitMaxY", 255, -256, 1024, "Limits or allows easy place acting Y range");
public static final ConfigInteger EASY_PLACE_MODE_MAX_BLOCKS = new ConfigInteger("easyPlaceModeMaxBlocks", 3, 1, 1000000, "Max block interactions per cycle");
public static final ConfigBoolean EASY_PLACE_MODE_BREAK_BLOCKS = new ConfigBoolean("easyPlaceModeBreakBlocks", false, "Automatically breaks blocks.");
public static final ConfigDouble EASY_PLACE_MODE_DELAY = new ConfigDouble( "easyPlaceModeDelay", 0.2, 0.0, 1.0, "Delay between printing blocks.\nDo not set to 0 if you are playing on a server.");
@@ -48,8 +46,6 @@ public class LitematicaMixinMod implements ModInitializer {
EASY_PLACE_MODE_RANGE_X,
EASY_PLACE_MODE_RANGE_Y,
EASY_PLACE_MODE_RANGE_Z,
- EASY_PLACE_Y_MIN,
- EASY_PLACE_Y_MAX,
EASY_PLACE_MODE_MAX_BLOCKS,
EASY_PLACE_MODE_BREAK_BLOCKS,
EASY_PLACE_MODE_DELAY,
diff --git a/src/main/java/io/github/eatmyvenom/litematicin/mixin/Litematica/MinecraftClientMixin.java b/src/main/java/io/github/eatmyvenom/litematicin/mixin/Litematica/MinecraftClientMixin.java
new file mode 100644
index 00000000..b0efd0c6
--- /dev/null
+++ b/src/main/java/io/github/eatmyvenom/litematicin/mixin/Litematica/MinecraftClientMixin.java
@@ -0,0 +1,22 @@
+package io.github.eatmyvenom.litematicin.mixin.Litematica;
+
+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 io.github.eatmyvenom.litematicin.utils.Printer;
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.world.ClientWorld;
+
+
+@Mixin(MinecraftClient.class)
+public class MinecraftClientMixin {
+
+ // On join a new world/server
+ @Inject(at = @At("HEAD"), method = "joinWorld")
+ public void joinWorld(ClientWorld world, CallbackInfo ci) {
+ Printer.worldBottomY = world.getBottomY();
+ Printer.worldTopY = world.getTopY();
+ }
+}
diff --git a/src/main/java/io/github/eatmyvenom/litematicin/utils/Printer.java b/src/main/java/io/github/eatmyvenom/litematicin/utils/Printer.java
index f0f9fbf4..030dc7e7 100644
--- a/src/main/java/io/github/eatmyvenom/litematicin/utils/Printer.java
+++ b/src/main/java/io/github/eatmyvenom/litematicin/utils/Printer.java
@@ -7,8 +7,6 @@
import static io.github.eatmyvenom.litematicin.LitematicaMixinMod.EASY_PLACE_MODE_RANGE_X;
import static io.github.eatmyvenom.litematicin.LitematicaMixinMod.EASY_PLACE_MODE_RANGE_Y;
import static io.github.eatmyvenom.litematicin.LitematicaMixinMod.EASY_PLACE_MODE_RANGE_Z;
-import static io.github.eatmyvenom.litematicin.LitematicaMixinMod.EASY_PLACE_Y_MIN;
-import static io.github.eatmyvenom.litematicin.LitematicaMixinMod.EASY_PLACE_Y_MAX;
import java.util.ArrayList;
import java.util.Date;
@@ -229,6 +227,9 @@ public static ActionResult doAccuratePlacePrinter(MinecraftClient mc) {
// For printing delay
public static long lastPlaced = new Date().getTime();
public static Breaker breaker = new Breaker();
+
+ public static int worldBottomY = 0;
+ public static int worldTopY = 256;
@Environment(EnvType.CLIENT)
public static ActionResult doPrinterAction(MinecraftClient mc) {
@@ -302,8 +303,6 @@ public static ActionResult doPrinterAction(MinecraftClient mc) {
int rangeY = EASY_PLACE_MODE_RANGE_Y.getIntegerValue();
int rangeZ = EASY_PLACE_MODE_RANGE_Z.getIntegerValue();
int MaxReach = Math.max(Math.max(rangeX,rangeY),rangeZ);
- int LimitMinY = EASY_PLACE_Y_MIN.getIntegerValue();
- int LimitMaxY = EASY_PLACE_Y_MAX.getIntegerValue();
boolean breakBlocks = EASY_PLACE_MODE_BREAK_BLOCKS.getBooleanValue();
Direction[] facingSides = Direction.getEntityFacingOrder(mc.player);
Direction primaryFacing = facingSides[0];
@@ -335,8 +334,8 @@ public static ActionResult doPrinterAction(MinecraftClient mc) {
int toY = Math.min(posY + rangeY, maxY);
int toZ = Math.min(posZ + rangeZ, maxZ);
- toY = Math.max(Math.max(LimitMinY, Math.min(Math.min(toY, LimitMaxY),world.getTopY())),world.getBottomY());
- fromY = Math.max(Math.max(LimitMinY, Math.min(Math.min(fromY, LimitMaxY),world.getTopY())),world.getBottomY());
+ toY = Math.max(Math.min(toY,worldTopY),worldBottomY);
+ fromY = Math.max(Math.min(fromY, worldTopY),worldBottomY);
fromX = Math.max(fromX,(int)mc.player.getX() - rangeX);
fromY = Math.max(fromY,(int)mc.player.getY() - rangeY);
diff --git a/src/main/resources/litematica-printer.mixins.json b/src/main/resources/litematica-printer.mixins.json
index 30d4cd5d..659179fd 100644
--- a/src/main/resources/litematica-printer.mixins.json
+++ b/src/main/resources/litematica-printer.mixins.json
@@ -8,7 +8,8 @@
"client": [
"Litematica.ConfigsMixin",
"Litematica.GuiConfigsMixin",
- "Litematica.WorldUtilsMixin"
+ "Litematica.WorldUtilsMixin",
+ "Litematica.MinecraftClientMixin"
],
"injectors": {
"defaultRequire": 1