Skip to content

Commit fb05c94

Browse files
committed
[Fabric] Add 1.20.3-pre1 support
1 parent 607b9fc commit fb05c94

File tree

7 files changed

+23
-10
lines changed

7 files changed

+23
-10
lines changed

worldedit-core/src/main/java/com/sk89q/worldedit/LocalConfiguration.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,9 @@ protected String[] getDefaultDisallowedBlocks() {
121121
BlockTypes.YELLOW_BED,
122122
BlockTypes.POWERED_RAIL,
123123
BlockTypes.DETECTOR_RAIL,
124+
// Keep grass for <1.20.3 compat
124125
BlockTypes.GRASS,
126+
BlockTypes.SHORT_GRASS,
125127
BlockTypes.DEAD_BUSH,
126128
BlockTypes.MOVING_PISTON,
127129
BlockTypes.PISTON_HEAD,

worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,11 @@ public class MultiStageReorder extends AbstractBufferingExtent implements Reorde
8585
priorityMap.put(BlockTypes.RED_BED, PlacementPriority.LAST);
8686
priorityMap.put(BlockTypes.WHITE_BED, PlacementPriority.LAST);
8787
priorityMap.put(BlockTypes.YELLOW_BED, PlacementPriority.LAST);
88-
priorityMap.put(BlockTypes.GRASS, PlacementPriority.LAST);
88+
// Keep "grass" for <1.20.3 compat
89+
@SuppressWarnings("deprecation")
90+
BlockType grass = BlockTypes.GRASS;
91+
priorityMap.put(grass, PlacementPriority.LAST);
92+
priorityMap.put(BlockTypes.SHORT_GRASS, PlacementPriority.LAST);
8993
priorityMap.put(BlockTypes.TALL_GRASS, PlacementPriority.LAST);
9094
priorityMap.put(BlockTypes.ROSE_BUSH, PlacementPriority.LAST);
9195
priorityMap.put(BlockTypes.DANDELION, PlacementPriority.LAST);

worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/FloraGenerator.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import com.sk89q.worldedit.function.pattern.RandomPattern;
2727
import com.sk89q.worldedit.math.BlockVector3;
2828
import com.sk89q.worldedit.world.block.BlockState;
29+
import com.sk89q.worldedit.world.block.BlockType;
2930
import com.sk89q.worldedit.world.block.BlockTypes;
3031

3132
/**
@@ -95,7 +96,12 @@ public static Pattern getDesertPattern() {
9596
*/
9697
public static Pattern getTemperatePattern() {
9798
RandomPattern pattern = new RandomPattern();
98-
pattern.add(BlockTypes.GRASS.getDefaultState(), 300);
99+
BlockType grass = BlockTypes.SHORT_GRASS;
100+
if (grass == null) {
101+
// Fallback for <1.20.3 compat
102+
grass = BlockTypes.GRASS;
103+
}
104+
pattern.add(grass.getDefaultState(), 300);
99105
pattern.add(BlockTypes.POPPY.getDefaultState(), 5);
100106
pattern.add(BlockTypes.DANDELION.getDefaultState(), 5);
101107
return pattern;

worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypes.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ public final class BlockTypes {
410410
@Nullable public static final BlockType GRANITE_SLAB = get("minecraft:granite_slab");
411411
@Nullable public static final BlockType GRANITE_STAIRS = get("minecraft:granite_stairs");
412412
@Nullable public static final BlockType GRANITE_WALL = get("minecraft:granite_wall");
413-
@Nullable public static final BlockType GRASS = get("minecraft:grass");
413+
@Deprecated @Nullable public static final BlockType GRASS = get("minecraft:grass");
414414
@Nullable public static final BlockType GRASS_BLOCK = get("minecraft:grass_block");
415415
@Deprecated @Nullable public static final BlockType GRASS_PATH = get("minecraft:grass_path");
416416
@Nullable public static final BlockType GRAVEL = get("minecraft:gravel");
@@ -839,6 +839,7 @@ public final class BlockTypes {
839839
@Nullable public static final BlockType SEA_LANTERN = get("minecraft:sea_lantern");
840840
@Nullable public static final BlockType SEA_PICKLE = get("minecraft:sea_pickle");
841841
@Nullable public static final BlockType SEAGRASS = get("minecraft:seagrass");
842+
@Nullable public static final BlockType SHORT_GRASS = get("minecraft:short_grass");
842843
@Nullable public static final BlockType SHROOMLIGHT = get("minecraft:shroomlight");
843844
@Nullable public static final BlockType SHULKER_BOX = get("minecraft:shulker_box");
844845
@Deprecated @Nullable public static final BlockType SIGN = get("minecraft:sign");

worldedit-fabric/build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ applyShadowConfiguration()
2222
apply(plugin = "fabric-loom")
2323
apply(plugin = "java-library")
2424

25-
val minecraftVersion = "1.20.2"
26-
val loaderVersion = "0.14.22"
25+
val minecraftVersion = "1.20.3-pre1"
26+
val loaderVersion = "0.14.24"
2727

2828
val fabricApiConfiguration: Configuration = configurations.create("fabricApi")
2929

@@ -64,7 +64,7 @@ dependencies {
6464
.toSet()
6565
// [2] Request the matching dependency from fabric-loom
6666
for (wantedDependency in wantedDependencies) {
67-
val dep = project.the<FabricApiExtension>().module(wantedDependency, "0.89.1+1.20.2")
67+
val dep = project.the<FabricApiExtension>().module(wantedDependency, "0.90.11+1.20.3")
6868
"include"(dep)
6969
"modImplementation"(dep)
7070
}

worldedit-fabric/src/main/java/com/sk89q/worldedit/fabric/FabricWorld.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -610,8 +610,8 @@ public boolean equals(Object o) {
610610
public List<? extends Entity> getEntities(Region region) {
611611
final Level world = getWorld();
612612
AABB box = new AABB(
613-
FabricAdapter.toBlockPos(region.getMinimumPoint()),
614-
FabricAdapter.toBlockPos(region.getMaximumPoint().add(BlockVector3.ONE))
613+
FabricAdapter.toVec3(region.getMinimumPoint()),
614+
FabricAdapter.toVec3(region.getMaximumPoint().add(BlockVector3.ONE))
615615
);
616616
List<net.minecraft.world.entity.Entity> nmsEntities = world.getEntities(
617617
(net.minecraft.world.entity.Entity) null,

worldedit-fabric/src/main/java/com/sk89q/worldedit/fabric/mixin/MixinMinecraftServer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@
3636
public abstract class MixinMinecraftServer implements Watchdog, ExtendedMinecraftServer {
3737

3838
@Shadow
39-
private long nextTickTime;
39+
private long nextTickTimeNanos;
4040
@Final
4141
@Shadow
4242
protected LevelStorageSource.LevelStorageAccess storageSource;
4343

4444
@Unique
4545
@Override
4646
public void tick() {
47-
nextTickTime = Util.getMillis();
47+
nextTickTimeNanos = Util.getNanos();
4848
}
4949

5050
@Unique

0 commit comments

Comments
 (0)