Skip to content

Commit 0b02a35

Browse files
committed
Port to 1.21.5 pre-release 3
1 parent 75927b7 commit 0b02a35

4 files changed

Lines changed: 12 additions & 10 deletions

File tree

gradle.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ org.gradle.jvmargs=-Xmx1G
33

44
# Fabric Properties
55
# check these on https://fabricmc.net/develop
6-
minecraft_version=1.21.5-pre2
7-
yarn_mappings=1.21.5-pre2+build.6
6+
minecraft_version=1.21.5-pre3
7+
yarn_mappings=1.21.5-pre3+build.2
88
loader_version=0.18.4
99

1010
# Mod Properties
@@ -13,4 +13,4 @@ org.gradle.jvmargs=-Xmx1G
1313
archives_base_name = itematic
1414

1515
# Dependencies
16-
fabric_version=0.119.0+1.21.5
16+
fabric_version=0.119.2+1.21.5

src/main/java/net/errorcraft/itematic/item/component/components/MappableItemComponent.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import net.minecraft.registry.RegistryKeys;
1717
import net.minecraft.registry.entry.RegistryEntry;
1818
import net.minecraft.registry.entry.RegistryFixedCodec;
19+
import net.minecraft.server.world.ServerWorld;
1920
import net.minecraft.sound.SoundEvents;
2021
import net.minecraft.stat.Stats;
2122
import net.minecraft.util.Hand;
@@ -42,19 +43,19 @@ public Codec<MappableItemComponent> codec() {
4243

4344
@Override
4445
public ItemResult use(World world, PlayerEntity user, Hand hand, ItemStack stack, ItemStackExchanger stackExchanger) {
45-
if (world.isClient()) {
46+
if (!(world instanceof ServerWorld serverWorld)) {
4647
return ItemResult.SUCCEED;
4748
}
4849

4950
user.incrementStat(Stats.USED.itematic$getOrCreateStat(stack.getRegistryEntry()));
5051
world.playSoundFromEntity(null, user, SoundEvents.UI_CARTOGRAPHY_TABLE_TAKE_RESULT, user.getSoundCategory(), 1.0f, 1.0f);
51-
ItemStack resultStack = this.createStack(world, user.getBlockX(), user.getBlockZ(), 0, true, false);
52+
ItemStack resultStack = this.createStack(serverWorld, user.getBlockX(), user.getBlockZ(), 0, true, false);
5253
stack.decrementUnlessCreative(1, user);
5354
stackExchanger.exchange(resultStack);
5455
return ItemResult.CONSUME;
5556
}
5657

57-
public ItemStack createStack(World world, int x, int z, int scale, boolean showIcons, boolean unlimitedTracking) {
58+
public ItemStack createStack(ServerWorld world, int x, int z, int scale, boolean showIcons, boolean unlimitedTracking) {
5859
ItemStack resultStack = new ItemStack(this.transformsInto);
5960
MapIdComponent mapId = FilledMapItemAccessor.allocateMapId(world, x, z, scale, showIcons, unlimitedTracking, world.getRegistryKey());
6061
resultStack.set(DataComponentTypes.MAP_ID, mapId);

src/main/java/net/errorcraft/itematic/mixin/item/FilledMapItemAccessor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
import net.minecraft.component.type.MapIdComponent;
44
import net.minecraft.item.FilledMapItem;
55
import net.minecraft.registry.RegistryKey;
6+
import net.minecraft.server.world.ServerWorld;
67
import net.minecraft.world.World;
78
import org.spongepowered.asm.mixin.Mixin;
89
import org.spongepowered.asm.mixin.gen.Invoker;
910

1011
@Mixin(FilledMapItem.class)
1112
public interface FilledMapItemAccessor {
1213
@Invoker("allocateMapId")
13-
static MapIdComponent allocateMapId(World world, int x, int z, int scale, boolean showIcons, boolean unlimitedTracking, RegistryKey<World> dimension) {
14+
static MapIdComponent allocateMapId(ServerWorld world, int x, int z, int scale, boolean showIcons, boolean unlimitedTracking, RegistryKey<World> dimension) {
1415
throw new AssertionError();
1516
}
1617
}

src/main/java/net/errorcraft/itematic/mixin/loot/function/ExplorationMapLootFunctionExtender.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import net.minecraft.item.Item;
88
import net.minecraft.item.ItemStack;
99
import net.minecraft.loot.function.ExplorationMapLootFunction;
10-
import net.minecraft.world.World;
10+
import net.minecraft.server.world.ServerWorld;
1111
import org.spongepowered.asm.mixin.Mixin;
1212
import org.spongepowered.asm.mixin.injection.At;
1313
import org.spongepowered.asm.mixin.injection.Redirect;
@@ -33,10 +33,10 @@ private boolean isOfForMapUseItemComponentCheck(ItemStack instance, Item item, @
3333
method = "process",
3434
at = @At(
3535
value = "INVOKE",
36-
target = "Lnet/minecraft/item/FilledMapItem;createMap(Lnet/minecraft/world/World;IIBZZ)Lnet/minecraft/item/ItemStack;"
36+
target = "Lnet/minecraft/item/FilledMapItem;createMap(Lnet/minecraft/server/world/ServerWorld;IIBZZ)Lnet/minecraft/item/ItemStack;"
3737
)
3838
)
39-
private ItemStack createMapUseItemComponent(World world, int x, int z, byte scale, boolean showIcons, boolean unlimitedTracking, @Share("mappableItemComponent") LocalRef<MappableItemComponent> mappableItemComponent) {
39+
private ItemStack createMapUseItemComponent(ServerWorld world, int x, int z, byte scale, boolean showIcons, boolean unlimitedTracking, @Share("mappableItemComponent") LocalRef<MappableItemComponent> mappableItemComponent) {
4040
return mappableItemComponent.get().createStack(world, x, z, scale, showIcons, unlimitedTracking);
4141
}
4242
}

0 commit comments

Comments
 (0)