Skip to content

Commit f306467

Browse files
Fix Maps Crashing On Blocks IDs > 256 (#224)
* Fix * Refactor --------- Co-authored-by: mine_diver <arsbsdn@gmail.com>
1 parent 42153a9 commit f306467

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package net.modificationstation.stationapi.mixin.flattening;
2+
3+
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
4+
import net.minecraft.block.Block;
5+
import net.minecraft.item.MapItem;
6+
import org.spongepowered.asm.mixin.Mixin;
7+
import org.spongepowered.asm.mixin.injection.At;
8+
9+
@Mixin(MapItem.class)
10+
class MapItemMixin {
11+
@ModifyExpressionValue(
12+
method = "update",
13+
at = @At(
14+
value = "CONSTANT",
15+
args = "intValue=256"
16+
)
17+
)
18+
private int stationapi_adjustArray(int constant) {
19+
return Block.BLOCKS.length;
20+
}
21+
}

station-flattening-v0/src/main/resources/station-flattening-v0.mixins.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"FireBlockMixin",
2222
"ItemMixin",
2323
"ItemStackMixin",
24+
"MapItemMixin",
2425
"MobSpawnerLogicMixin",
2526
"NetherCaveGenMixin",
2627
"NetherChunkGeneratorMixin",

0 commit comments

Comments
 (0)