Skip to content

Commit c0eef21

Browse files
committed
1.21
1 parent 7f745f2 commit c0eef21

File tree

11 files changed

+217
-112
lines changed

11 files changed

+217
-112
lines changed

.github/workflows/dev build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ jobs:
77
steps:
88
- name: Checkout
99
uses: actions/checkout@v3
10-
- name: Setup JDK 17
10+
- name: Setup JDK 21
1111
uses: actions/[email protected]
1212
with:
13-
java-version: 17
13+
java-version: 21
1414
distribution: adopt
1515
- name: Build
1616
run: |
@@ -20,8 +20,8 @@ jobs:
2020
uses: marvinpinto/action-automatic-releases@latest
2121
with:
2222
repo_token: '${{ secrets.GITHUB_TOKEN }}'
23-
automatic_release_tag: "mc_1.20.4_meteor_0.5.6_ver_1.3"
23+
automatic_release_tag: "mc_1.21_meteor_0.5.8_ver_1.3"
2424
prerelease: false
25-
title: "Version 1.3 for meteor 0.5.6 and Minecraft 1.20.4"
25+
title: "Version 1.3 for meteor 0.5.8 and Minecraft 1.21"
2626
files: |
2727
./build/libs/*.jar

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
# Meteor Litematica Printer
22

3-
Fast printer to litematica mod
3+
Fast printer to litematica made with meteor client
4+
5+
Works best with simple blocks witout rotation or other properties like dirt stone etc.
6+
7+
For 1.21+ use fork of litematica maintaind by [sakura-ryoko](https://github.com/sakura-ryoko)
8+
- [litematica](https://github.com/sakura-ryoko/litematica)
9+
- [malilib (needed for litematica to work)](https://github.com/sakura-ryoko/malilib)

build.gradle

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
plugins {
2-
id 'fabric-loom' version '1.5-SNAPSHOT'
3-
id 'maven-publish'
2+
id 'fabric-loom' version '1.7-SNAPSHOT'
43
}
54

65
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17
@@ -10,12 +9,14 @@ version = project.mod_version
109
group = project.maven_group
1110

1211
repositories {
13-
14-
maven { url = "https://www.cursemaven.com" }
15-
maven { url = "https://masa.dy.fi/maven" }
16-
12+
mavenCentral()
1713
maven { url = "https://maven.meteordev.org/releases" }
1814
maven { url = "https://maven.meteordev.org/snapshots" }
15+
maven { url 'https://jitpack.io' }
16+
17+
//maven { url = "https://masa.dy.fi/maven" }
18+
19+
1920
}
2021

2122
dependencies {
@@ -26,11 +27,14 @@ dependencies {
2627

2728
// Meteor
2829
modImplementation "meteordevelopment:meteor-client:${project.meteor_version}-SNAPSHOT"
29-
modImplementation "meteordevelopment:baritone:${project.minecraft_version}-SNAPSHOT"
30+
//modImplementation "meteordevelopment:baritone:${project.baritone_version}-SNAPSHOT"
3031

3132
//litematica
32-
modImplementation "curse.maven:litematica-${project.litematica_projectid}:${project.litematica_fileid}"
33-
modImplementation "fi.dy.masa.malilib:malilib-fabric-${project.minecraft_version}:${project.malilib_version}"
33+
//modImplementation "curse.maven:litematica-${project.litematica_projectid}:${project.litematica_fileid}"
34+
modImplementation 'com.github.sakura-ryoko:litematica:1.21-sakura.23'
35+
//modImplementation "fi.dy.masa.malilib:malilib-fabric-${project.minecraft_version}:${project.malilib_version}"
36+
modImplementation 'com.github.sakura-ryoko:malilib:1.21-sakura.8'
37+
3438

3539
}
3640

gradle.properties

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
org.gradle.jvmargs=-Xmx4G
22

33
# Fabric (https://fabricmc.net/versions.html)
4-
minecraft_version=1.20.4
5-
yarn_mappings=1.20.4+build.3
6-
loader_version=0.15.7
4+
minecraft_version=1.21
5+
yarn_mappings=1.21+build.9
6+
loader_version=0.15.11
77

88
# Mod Properties
99
mod_version=1.3
1010
maven_group=com.kkllffaa
1111
archives_base_name=meteor-litematica-printer
1212

1313
# litematica
14-
litematica_fileid=5170070
15-
litematica_projectid=308892
16-
malilib_version = 0.18.1
14+
#litematica_fileid=5170070
15+
#litematica_projectid=308892
16+
#malilib_version = 0.18.1
1717

1818
# meteor
19-
meteor_version=0.5.6
19+
meteor_version=0.5.8

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

settings.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ pluginManagement {
44
name = 'Fabric'
55
url = 'https://maven.fabricmc.net/'
66
}
7-
mavenCentral()
87
gradlePluginPortal()
98
}
109
}

src/main/java/com/kkllffaa/meteor_litematica_printer/MyUtils.java

Lines changed: 35 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,36 @@
11
package com.kkllffaa.meteor_litematica_printer;
22

3-
import static meteordevelopment.meteorclient.MeteorClient.mc;
4-
import static meteordevelopment.meteorclient.utils.world.BlockUtils.canPlace;
5-
6-
import baritone.api.utils.BetterBlockPos;
7-
import baritone.api.utils.RayTraceUtils;
8-
import baritone.api.utils.Rotation;
9-
import baritone.api.utils.RotationUtils;
103
import meteordevelopment.meteorclient.utils.player.Rotations;
114
import meteordevelopment.meteorclient.utils.world.BlockUtils;
12-
import net.minecraft.block.AmethystClusterBlock;
13-
import net.minecraft.block.AnvilBlock;
14-
import net.minecraft.block.BellBlock;
15-
import net.minecraft.block.Block;
16-
import net.minecraft.block.BlockState;
17-
import net.minecraft.block.Blocks;
18-
import net.minecraft.block.ButtonBlock;
19-
import net.minecraft.block.ChainBlock;
20-
import net.minecraft.block.EndRodBlock;
21-
import net.minecraft.block.GrindstoneBlock;
22-
import net.minecraft.block.HopperBlock;
23-
import net.minecraft.block.LightningRodBlock;
24-
import net.minecraft.block.ObserverBlock;
25-
import net.minecraft.block.PistonBlock;
26-
import net.minecraft.block.PointedDripstoneBlock;
27-
import net.minecraft.block.ScaffoldingBlock;
28-
import net.minecraft.block.ShulkerBoxBlock;
29-
import net.minecraft.block.SlabBlock;
30-
import net.minecraft.block.StainedGlassBlock;
31-
import net.minecraft.block.StairsBlock;
32-
import net.minecraft.block.TrapdoorBlock;
5+
import net.minecraft.block.*;
336
import net.minecraft.block.enums.BlockHalf;
347
import net.minecraft.block.enums.SlabType;
35-
import net.minecraft.item.ItemStack;
36-
import net.minecraft.nbt.NbtCompound;
378
import net.minecraft.network.packet.c2s.play.HandSwingC2SPacket;
389
import net.minecraft.state.property.Properties;
39-
import net.minecraft.state.property.Property;
4010
import net.minecraft.util.ActionResult;
4111
import net.minecraft.util.Hand;
4212
import net.minecraft.util.hit.BlockHitResult;
4313
import net.minecraft.util.hit.HitResult;
4414
import net.minecraft.util.math.BlockPos;
4515
import net.minecraft.util.math.Box;
4616
import net.minecraft.util.math.Direction;
47-
import net.minecraft.util.math.Vec3d;
4817
import net.minecraft.util.math.Direction.Axis;
18+
import net.minecraft.util.math.Vec3d;
4919
import net.minecraft.util.shape.VoxelShape;
5020
import net.minecraft.world.RaycastContext;
5121
import net.minecraft.world.RaycastContext.FluidHandling;
5222
import net.minecraft.world.RaycastContext.ShapeType;
5323

24+
import static meteordevelopment.meteorclient.MeteorClient.mc;
25+
import static meteordevelopment.meteorclient.utils.world.BlockUtils.canPlace;
26+
27+
//import baritone.api.utils.BetterBlockPos;
28+
//import baritone.api.utils.RayTraceUtils;
29+
//import baritone.api.utils.Rotation;
30+
//import baritone.api.utils.RotationUtils;
31+
5432
public class MyUtils {
55-
33+
5634
public static boolean place(BlockPos blockPos, Direction direction, SlabType slabType, BlockHalf blockHalf, Direction blockHorizontalOrientation, Axis wantedAxies, boolean airPlace, boolean swingHand, boolean rotate, boolean clientSide, int range) {
5735
if (mc.player == null) return false;
5836
if (!canPlace(blockPos)) return false;
@@ -76,8 +54,8 @@ public static boolean place(BlockPos blockPos, Direction direction, SlabType sla
7654
Direction s = direction;
7755

7856
if (rotate) {
79-
BetterBlockPos placeAgainstPos = new BetterBlockPos(neighbour.getX(), neighbour.getY(), neighbour.getZ());
80-
VoxelShape collisionShape = mc.world.getBlockState(placeAgainstPos).getCollisionShape(mc.world, placeAgainstPos);
57+
//BetterBlockPos placeAgainstPos = new BetterBlockPos(neighbour.getX(), neighbour.getY(), neighbour.getZ());
58+
VoxelShape collisionShape = mc.world.getBlockState(neighbour).getCollisionShape(mc.world, neighbour);
8159

8260
if(collisionShape.isEmpty()) {
8361
Rotations.rotate(Rotations.getYaw(hitPos), Rotations.getPitch(hitPos), 50, clientSide,
@@ -93,30 +71,30 @@ public static boolean place(BlockPos blockPos, Direction direction, SlabType sla
9371
for (double x = 0.1; x < 0.9; x+=0.2)
9472
for (Vec3d placementMultiplier : aabbSideMultipliers(direction.getOpposite())) {
9573

96-
double placeX = placeAgainstPos.x + aabb.minX * x + aabb.maxX * (1 - x);
74+
double placeX = neighbour.getX() + aabb.minX * x + aabb.maxX * (1 - x);
9775
if((slabType != null && slabType != SlabType.DOUBLE || blockHalf != null && direction != Direction.UP && direction != Direction.DOWN) && !mc.player.isCreative()) {
9876
if (slabType == SlabType.BOTTOM || blockHalf == BlockHalf.BOTTOM) {
9977
if (placementMultiplier.y <= 0.5) continue;
10078
} else {
10179
if (placementMultiplier.y > 0.5) continue;
10280
}
10381
}
104-
double placeY = placeAgainstPos.y + aabb.minY * placementMultiplier.y + aabb.maxY * (1 - placementMultiplier.y);
105-
double placeZ = placeAgainstPos.z + aabb.minZ * z + aabb.maxZ * (1 - z);
82+
double placeY = neighbour.getY() + aabb.minY * placementMultiplier.y + aabb.maxY * (1 - placementMultiplier.y);
83+
double placeZ = neighbour.getZ() + aabb.minZ * z + aabb.maxZ * (1 - z);
10684

10785
Vec3d testHitPos = new Vec3d(placeX, placeY, placeZ);
10886
Vec3d playerHead = new Vec3d(mc.player.getX(), mc.player.getEyeY(), mc.player.getZ());
10987

110-
Rotation rot = RotationUtils.calcRotationFromVec3d(playerHead, testHitPos, new Rotation(mc.player.getYaw(), mc.player.getPitch()));
88+
Rotation rot = RotationStuff.calcRotationFromVec3d(playerHead, testHitPos, new Rotation(mc.player.getYaw(), mc.player.getPitch()));
11189
Direction testHorizontalDirection = getHorizontalDirectionFromYaw(rot.normalize().getYaw());
11290
if (blockHorizontalOrientation != null
11391
&& ( testHorizontalDirection.getAxis() != blockHorizontalOrientation.getAxis())) continue;
114-
HitResult res = RayTraceUtils.rayTraceTowards(mc.player, rot, range, false);
92+
HitResult res = RotationStuff.rayTraceTowards(mc.player, rot, range);
11593
BlockHitResult blockHitRes = ((BlockHitResult) res);
11694
if(
11795
res == null ||
11896
res.getType() != HitResult.Type.BLOCK ||
119-
!blockHitRes.getBlockPos().equals(placeAgainstPos) ||
97+
!blockHitRes.getBlockPos().equals(neighbour) ||
12098
blockHitRes.getSide() != direction
12199
) continue;
122100

@@ -135,6 +113,7 @@ public static boolean place(BlockPos blockPos, Direction direction, SlabType sla
135113
return true;
136114
}
137115

116+
138117
private static void place(BlockHitResult blockHitResult, boolean swing) {
139118
if (mc.player == null || mc.interactionManager == null || mc.getNetworkHandler() == null) return;
140119
boolean wasSneaking = mc.player.input.sneaking;
@@ -302,11 +281,11 @@ public static boolean isPlayerOrientationDesired(Block block, Direction blockHor
302281

303282
);
304283
}
305-
284+
306285
public static Direction getVisiblePlaceSide(BlockPos placeAt, BlockState placeAtState, SlabType slabType, BlockHalf blockHalf, Direction blockHorizontalOrientation, Axis wantedAxies, int range, Direction requiredDir) {
307286
if (mc.world == null) return null;
308287
for (Direction against : Direction.values()) {
309-
BetterBlockPos placeAgainstPos = new BetterBlockPos(placeAt.getX(), placeAt.getY(), placeAt.getZ()).relative(against);
288+
//BetterBlockPos placeAgainstPos = new BetterBlockPos(placeAt.getX(), placeAt.getY(), placeAt.getZ()).relative(against);
310289
// BlockState placeAgainstState = mc.world.getBlockState(placeAgainstPos);
311290

312291
if(wantedAxies != null && against.getAxis() != wantedAxies || blockHalf != null && (against == Direction.UP && blockHalf == BlockHalf.BOTTOM || against == Direction.DOWN && blockHalf == BlockHalf.TOP))
@@ -324,41 +303,41 @@ public static Direction getVisiblePlaceSide(BlockPos placeAt, BlockState placeAt
324303

325304
if(!canPlaceAgainst(
326305
placeAtState,
327-
mc.world.getBlockState(placeAgainstPos),
306+
mc.world.getBlockState(placeAt),
328307
against
329-
) || BlockUtils.isClickable(mc.world.getBlockState(placeAgainstPos).getBlock()))
308+
) || BlockUtils.isClickable(mc.world.getBlockState(placeAt).getBlock()))
330309
continue;
331-
Box aabb = mc.world.getBlockState(placeAgainstPos).getCollisionShape(mc.world, placeAgainstPos).getBoundingBox();
310+
Box aabb = mc.world.getBlockState(placeAt).getCollisionShape(mc.world, placeAt).getBoundingBox();
332311

333312
for (double z = 0.1; z < 0.9; z+=0.2)
334313
for (double x = 0.1; x < 0.9; x+=0.2)
335314
for (Vec3d placementMultiplier : aabbSideMultipliers(against)) {
336-
double placeX = placeAgainstPos.x + aabb.minX * x + aabb.maxX * (1 - x);
315+
double placeX = placeAt.getX() + aabb.minX * x + aabb.maxX * (1 - x);
337316
if((slabType != null && slabType != SlabType.DOUBLE || blockHalf != null && against != Direction.DOWN && against != Direction.UP) && !mc.player.isCreative()) {
338317
if (slabType == SlabType.BOTTOM || blockHalf == BlockHalf.BOTTOM) {
339318
if (placementMultiplier.y <= 0.5) continue;
340319
} else {
341320
if (placementMultiplier.y > 0.5) continue;
342321
}
343322
}
344-
double placeY = placeAgainstPos.y + aabb.minY * placementMultiplier.y + aabb.maxY * (1 - placementMultiplier.y);
345-
double placeZ = placeAgainstPos.z + aabb.minZ * z + aabb.maxZ * (1 - z);
323+
double placeY = placeAt.getY() + aabb.minY * placementMultiplier.y + aabb.maxY * (1 - placementMultiplier.y);
324+
double placeZ = placeAt.getZ() + aabb.minZ * z + aabb.maxZ * (1 - z);
346325

347326
Vec3d hitPos = new Vec3d(placeX, placeY, placeZ);
348327
Vec3d playerHead = new Vec3d(mc.player.getX(), mc.player.getEyeY(), mc.player.getZ());
349-
Rotation rot = RotationUtils.calcRotationFromVec3d(playerHead, hitPos, new Rotation(mc.player.getYaw(), mc.player.getPitch()));
328+
Rotation rot = RotationStuff.calcRotationFromVec3d(playerHead, hitPos, new Rotation(mc.player.getYaw(), mc.player.getPitch()));
350329

351330
Direction testHorizontalDirection = getHorizontalDirectionFromYaw(rot.normalize().getYaw());
352331
if (placeAtState.getBlock() instanceof TrapdoorBlock && !(against != Direction.DOWN && against != Direction.UP) && !isPlayerOrientationDesired(placeAtState.getBlock(), blockHorizontalOrientation, testHorizontalDirection)
353332
|| !(placeAtState.getBlock() instanceof TrapdoorBlock) && !isPlayerOrientationDesired(placeAtState.getBlock(), blockHorizontalOrientation, testHorizontalDirection)
354333
) continue;
355-
HitResult res = RayTraceUtils.rayTraceTowards(mc.player, rot, range, false);
334+
HitResult res = RotationStuff.rayTraceTowards(mc.player, rot, range);
356335
BlockHitResult blockHitRes = ((BlockHitResult) res);
357336

358337
if(
359338
res == null
360339
|| res.getType() != HitResult.Type.BLOCK
361-
|| !blockHitRes.getBlockPos().equals(placeAgainstPos)
340+
|| !blockHitRes.getBlockPos().equals(placeAt)
362341
|| blockHitRes.getSide() != against.getOpposite()
363342
) continue;
364343

@@ -403,7 +382,7 @@ public static Direction getPlaceSide(BlockPos blockPos, BlockState placeAtState,
403382

404383
Vec3d hitPos = new Vec3d(neighbor.getX(), neighbor.getY(), neighbor.getZ());
405384
Vec3d playerHead = new Vec3d(mc.player.getX(), mc.player.getEyeY(), mc.player.getZ());
406-
Rotation rot = RotationUtils.calcRotationFromVec3d(playerHead, hitPos, new Rotation(mc.player.getYaw(), mc.player.getPitch()));
385+
Rotation rot = RotationStuff.calcRotationFromVec3d(playerHead, hitPos, new Rotation(mc.player.getYaw(), mc.player.getPitch()));
407386

408387
Direction testHorizontalDirection = getHorizontalDirectionFromYaw(rot.normalize().getYaw());
409388

@@ -417,7 +396,9 @@ public static Direction getPlaceSide(BlockPos blockPos, BlockState placeAtState,
417396
return null;
418397
}
419398

399+
/*
420400
public static NbtCompound getNbtFromBlockState (ItemStack itemStack, BlockState state) {
401+
//NbtCompound nbt = itemStack.getOrCreateNbt();
421402
NbtCompound nbt = itemStack.getOrCreateNbt();
422403
NbtCompound subNbt = new NbtCompound();
423404
for (Property<?> property : state.getProperties()) {
@@ -427,7 +408,7 @@ public static NbtCompound getNbtFromBlockState (ItemStack itemStack, BlockState
427408
428409
return nbt;
429410
}
430-
411+
*/
431412
private static Vec3d[] aabbSideMultipliers(Direction side) {
432413
switch (side) {
433414
case UP:

0 commit comments

Comments
 (0)