Skip to content

Commit 0b70418

Browse files
committed
点地狱门
1 parent a429aef commit 0b70418

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

src/main/java/me/aleksilassila/litematica/printer/printer/PlacementGuide.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
public class PlacementGuide extends PrinterUtils {
3636
@NotNull
3737
protected final MinecraftClient client;
38+
public static long createPortalTick = 1;
3839

3940
public PlacementGuide(@NotNull MinecraftClient client) {
4041
this.client = client;
@@ -139,7 +140,7 @@ else if (state == State.MISSING_BLOCK &&
139140
if(facing != null){
140141
return new Action().setSides(facing.getOpposite()).setRequiresSupport();
141142
}
142-
return null;
143+
break;
143144
}
144145
case AMETHYST: {
145146
return new Action()
@@ -317,6 +318,15 @@ else if (state == State.MISSING_BLOCK &&
317318
case BIG_DRIPLEAF_STEM: {
318319
return new Action().setItem(Items.BIG_DRIPLEAF);
319320
}
321+
case NETHER_PORTAL_BLOCK: {
322+
323+
boolean canCreatePortal = net.minecraft.world.dimension.NetherPortal.getNewPortal(world, pos, Direction.Axis.X).isPresent();
324+
if (canCreatePortal && createPortalTick == 1) {
325+
createPortalTick = 0;
326+
return new Action().setItems(Items.FLINT_AND_STEEL,Items.FIRE_CHARGE);
327+
}
328+
break;
329+
}
320330
case SKIP: {
321331
break;
322332
}
@@ -751,6 +761,7 @@ enum ClassHook {
751761
COCOA(CocoaBlock.class),
752762
OBSERVER(ObserverBlock.class),
753763
WALLSKULL(WallSkullBlock.class),
764+
NETHER_PORTAL_BLOCK(NetherPortalBlock.class),
754765

755766
// Only clicks
756767
FLOWER_POT(FlowerPotBlock.class),
@@ -770,7 +781,7 @@ enum ClassHook {
770781
// Other
771782
FARMLAND(FarmlandBlock.class),
772783
DIRT_PATH(DirtPathBlock.class),
773-
SKIP(SkullBlock.class, GrindstoneBlock.class, SignBlock.class, /*Implementation.NewBlocks.LICHEN.clazz,*/ VineBlock.class),
784+
SKIP(SkullBlock.class, GrindstoneBlock.class, SignBlock.class, VineBlock.class,EndPortalBlock.class),
774785
WATER(FluidBlock.class),
775786
DEFAULT;
776787

src/main/java/me/aleksilassila/litematica/printer/printer/Printer.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public static boolean isEnablePrinter(){
145145
public final Queue queue;
146146
public int range2;
147147

148-
static int tick = 0;
148+
public static int tick = 0;
149149

150150
public static void init(MinecraftClient client) {
151151
if (client == null || client.player == null || client.world == null) {
@@ -543,7 +543,7 @@ public boolean verify() {
543543
}
544544
}
545545

546-
int tickRate;
546+
public static int tickRate;
547547
boolean isFacing = false;
548548
Item[] item2 = null;
549549
List<String> fluidBlocklist;
@@ -613,13 +613,16 @@ public void myTick(){
613613
ArrayList<BlockPos> deletePosList = new ArrayList<>();
614614
skipPosMap.forEach((k,v) -> {
615615
skipPosMap.put(k,v+1);
616-
if(v > PUT_COOLING.getIntegerValue()){
616+
if(v >= PUT_COOLING.getIntegerValue()){
617617
deletePosList.add(k);
618618
}
619619
});
620620
for (BlockPos blockPos : deletePosList) {
621621
skipPosMap.remove(blockPos);
622622
}
623+
if (PlacementGuide.createPortalTick != 1) {
624+
PlacementGuide.createPortalTick = 1;
625+
}
623626
}
624627
public void tick() {
625628
if (!verify()) return;
@@ -694,7 +697,6 @@ public void tick() {
694697
if (client.player != null && !canInteracted(pos)) continue;
695698
BlockState requiredState = worldSchematic.getBlockState(pos);
696699
PlacementGuide.Action action = guide.getAction(world, worldSchematic, pos);
697-
if (requiredState.isOf(Blocks.NETHER_PORTAL) || requiredState.isOf(Blocks.END_PORTAL)) continue;
698700

699701
//跳过放置
700702
if (LitematicaMixinMod.PUT_SKIP.getBooleanValue() &&

versions/mapping-1.18.2-1.19.4.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
net.minecraft.util.math.Matrix4f org.joml.Matrix4f
22
net.minecraft.util.registry.RegistryKey net.minecraft.registry.RegistryKey
3-
net.minecraft.util.registry.Registry net.minecraft.registry.Registries
3+
net.minecraft.util.registry.Registry net.minecraft.registry.Registries
4+
net.minecraft.world.dimension.AreaHelper net.minecraft.world.dimension.NetherPortal

0 commit comments

Comments
 (0)