Skip to content

Commit

Permalink
[Fabric] Add 1.20.3-pre1 support
Browse files Browse the repository at this point in the history
  • Loading branch information
me4502 committed Nov 21, 2023
1 parent 607b9fc commit fb05c94
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ protected String[] getDefaultDisallowedBlocks() {
BlockTypes.YELLOW_BED,
BlockTypes.POWERED_RAIL,
BlockTypes.DETECTOR_RAIL,
// Keep grass for <1.20.3 compat
BlockTypes.GRASS,
BlockTypes.SHORT_GRASS,
BlockTypes.DEAD_BUSH,
BlockTypes.MOVING_PISTON,
BlockTypes.PISTON_HEAD,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ public class MultiStageReorder extends AbstractBufferingExtent implements Reorde
priorityMap.put(BlockTypes.RED_BED, PlacementPriority.LAST);
priorityMap.put(BlockTypes.WHITE_BED, PlacementPriority.LAST);
priorityMap.put(BlockTypes.YELLOW_BED, PlacementPriority.LAST);
priorityMap.put(BlockTypes.GRASS, PlacementPriority.LAST);
// Keep "grass" for <1.20.3 compat
@SuppressWarnings("deprecation")
BlockType grass = BlockTypes.GRASS;
priorityMap.put(grass, PlacementPriority.LAST);
priorityMap.put(BlockTypes.SHORT_GRASS, PlacementPriority.LAST);
priorityMap.put(BlockTypes.TALL_GRASS, PlacementPriority.LAST);
priorityMap.put(BlockTypes.ROSE_BUSH, PlacementPriority.LAST);
priorityMap.put(BlockTypes.DANDELION, PlacementPriority.LAST);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.sk89q.worldedit.function.pattern.RandomPattern;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;

/**
Expand Down Expand Up @@ -95,7 +96,12 @@ public static Pattern getDesertPattern() {
*/
public static Pattern getTemperatePattern() {
RandomPattern pattern = new RandomPattern();
pattern.add(BlockTypes.GRASS.getDefaultState(), 300);
BlockType grass = BlockTypes.SHORT_GRASS;
if (grass == null) {
// Fallback for <1.20.3 compat
grass = BlockTypes.GRASS;
}
pattern.add(grass.getDefaultState(), 300);
pattern.add(BlockTypes.POPPY.getDefaultState(), 5);
pattern.add(BlockTypes.DANDELION.getDefaultState(), 5);
return pattern;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ public final class BlockTypes {
@Nullable public static final BlockType GRANITE_SLAB = get("minecraft:granite_slab");
@Nullable public static final BlockType GRANITE_STAIRS = get("minecraft:granite_stairs");
@Nullable public static final BlockType GRANITE_WALL = get("minecraft:granite_wall");
@Nullable public static final BlockType GRASS = get("minecraft:grass");
@Deprecated @Nullable public static final BlockType GRASS = get("minecraft:grass");
@Nullable public static final BlockType GRASS_BLOCK = get("minecraft:grass_block");
@Deprecated @Nullable public static final BlockType GRASS_PATH = get("minecraft:grass_path");
@Nullable public static final BlockType GRAVEL = get("minecraft:gravel");
Expand Down Expand Up @@ -839,6 +839,7 @@ public final class BlockTypes {
@Nullable public static final BlockType SEA_LANTERN = get("minecraft:sea_lantern");
@Nullable public static final BlockType SEA_PICKLE = get("minecraft:sea_pickle");
@Nullable public static final BlockType SEAGRASS = get("minecraft:seagrass");
@Nullable public static final BlockType SHORT_GRASS = get("minecraft:short_grass");
@Nullable public static final BlockType SHROOMLIGHT = get("minecraft:shroomlight");
@Nullable public static final BlockType SHULKER_BOX = get("minecraft:shulker_box");
@Deprecated @Nullable public static final BlockType SIGN = get("minecraft:sign");
Expand Down
6 changes: 3 additions & 3 deletions worldedit-fabric/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ applyShadowConfiguration()
apply(plugin = "fabric-loom")
apply(plugin = "java-library")

val minecraftVersion = "1.20.2"
val loaderVersion = "0.14.22"
val minecraftVersion = "1.20.3-pre1"
val loaderVersion = "0.14.24"

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

Expand Down Expand Up @@ -64,7 +64,7 @@ dependencies {
.toSet()
// [2] Request the matching dependency from fabric-loom
for (wantedDependency in wantedDependencies) {
val dep = project.the<FabricApiExtension>().module(wantedDependency, "0.89.1+1.20.2")
val dep = project.the<FabricApiExtension>().module(wantedDependency, "0.90.11+1.20.3")
"include"(dep)
"modImplementation"(dep)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -610,8 +610,8 @@ public boolean equals(Object o) {
public List<? extends Entity> getEntities(Region region) {
final Level world = getWorld();
AABB box = new AABB(
FabricAdapter.toBlockPos(region.getMinimumPoint()),
FabricAdapter.toBlockPos(region.getMaximumPoint().add(BlockVector3.ONE))
FabricAdapter.toVec3(region.getMinimumPoint()),
FabricAdapter.toVec3(region.getMaximumPoint().add(BlockVector3.ONE))
);
List<net.minecraft.world.entity.Entity> nmsEntities = world.getEntities(
(net.minecraft.world.entity.Entity) null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@
public abstract class MixinMinecraftServer implements Watchdog, ExtendedMinecraftServer {

@Shadow
private long nextTickTime;
private long nextTickTimeNanos;
@Final
@Shadow
protected LevelStorageSource.LevelStorageAccess storageSource;

@Unique
@Override
public void tick() {
nextTickTime = Util.getMillis();
nextTickTimeNanos = Util.getNanos();
}

@Unique
Expand Down

0 comments on commit fb05c94

Please sign in to comment.