Port to 26.1.x#950
Conversation
- Fixed crash on startup (Components not bound yet) caused by InventoryMixin creating an ItemStack as a static field before data components were initialized. Replaced with lazy creation via method call.
|
Thank you so much for this @MasatoNakajima20! BTW, judging from your selection of mods you are updating, by chance are you accepting suggestions for other mods to port? I'm really missing Earth2Java since 1.20.x and wonder if you would like to port that as well. |
cputnam-a11y
left a comment
There was a problem hiding this comment.
Hi, I am not Tschipp, but I figured I would review. please feel free to object / disregard / dismiss if you disagree on any of these points.
| import net.minecraft.world.item.ItemStack; | ||
| import net.minecraft.world.level.block.Blocks; | ||
| import org.spongepowered.asm.mixin.Mixin; | ||
| import org.spongepowered.asm.mixin.Shadow; | ||
| import org.spongepowered.asm.mixin.Unique; | ||
| import org.spongepowered.asm.mixin.injection.At; | ||
| import org.spongepowered.asm.mixin.injection.Inject; | ||
| import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
| import tschipp.carryon.common.carry.CarryOnData; | ||
| import tschipp.carryon.common.carry.CarryOnDataManager; | ||
|
|
||
| @Mixin(Inventory.class) | ||
| public class InventoryMixin | ||
| { | ||
| @Unique | ||
| private static final ItemStack DUMMY_STACK = new ItemStack(Blocks.COBBLESTONE, 1); | ||
| private static ItemStack getDummyStack() { | ||
| return new ItemStack(Blocks.COBBLESTONE, 1); | ||
| } | ||
|
|
||
| @Shadow | ||
| public Player player; | ||
|
|
||
| @Shadow | ||
| public int selected; | ||
|
|
||
| @Shadow | ||
| public NonNullList<ItemStack> items; | ||
|
|
||
| @WrapOperation(method = "getFreeSlot()I", at = @At(value = "INVOKE", ordinal = 0, target = "Lnet/minecraft/core/NonNullList;get(I)Ljava/lang/Object;")) | ||
| private Object getFreeSlotEmptyCheck(NonNullList<Object> instance, int slot, Operation<Object> original) | ||
| { | ||
| if(slot == selected && CarryOnDataManager.getCarryData(player).isCarrying()) | ||
| { | ||
| return DUMMY_STACK; | ||
| return getDummyStack(); |
There was a problem hiding this comment.
| return getDummyStack(); | |
| import net.minecraft.world.item.ItemStackTemplate; | |
| import net.minecraft.world.level.block.Blocks; | |
| import org.spongepowered.asm.mixin.Mixin; | |
| import org.spongepowered.asm.mixin.Shadow; | |
| import org.spongepowered.asm.mixin.Unique; | |
| import org.spongepowered.asm.mixin.injection.At; | |
| import org.spongepowered.asm.mixin.injection.Inject; | |
| import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | |
| import tschipp.carryon.common.carry.CarryOnData; | |
| import tschipp.carryon.common.carry.CarryOnDataManager; | |
| @Mixin(Inventory.class) | |
| public class InventoryMixin | |
| { | |
| @Unique | |
| private static ItemStack DUMMY_STACK = new ItemStackTemplate(Blocks.COBBLESTONE.asItem()); | |
| @Shadow | |
| public Player player; | |
| @@ -56,7 +58,7 @@ | |
| { | |
| if(slot == selected && CarryOnDataManager.getCarryData(player).isCarrying()) | |
| { | |
| return DUMMY_STACK.create(); |
| var layer = renderState.newLayer(); | ||
| layer.setRenderType(RenderTypes.glint()); |
There was a problem hiding this comment.
Is this just no longer needed? It seems like it would be a change in behavior.
| exclusiveContent { | ||
| forRepository { | ||
| maven { | ||
| name = 'Fabric' | ||
| url = uri('https://maven.fabricmc.net') | ||
| } | ||
| } | ||
| filter { | ||
| includeGroup('net.fabricmc') | ||
| includeGroup('net.fabricmc.unpick') | ||
| includeGroup('fabric-loom') | ||
| includeGroup('net.fabricmc.unpick') | ||
| } |
There was a problem hiding this comment.
Is this correct? removing exclusive content will make the build slower (by a small amount, don't know that it matters that much). Usually I see
exclusiveContent {
forRepository {
maven {
name = 'Fabric'
url = uri('https://maven.fabricmc.net')
}
}
filter {
includeGroupAndSubgroups('net.fabricmc')
}
}
}|
And yeah, thanks so much for the p.r. Looking forwards to playing on 26.1 |
Hi @vico93 You're very much welcome. Im not a modder or anything of the sort, It so happen that Im using the 2 mods for our server which were dying to update to 26.1.x. Since there are no movements for months, I just decided to look it up and take it on myself.. I finally made it work on a local save and server so I just went my way and tried to share it with the community. TLDR |
I won't object, disregard or dimiss these comments. As per my reply to Vico93, im not a modder, it so happens that I have a programming background and some knowledge with Java. I dont know anything with minecraft language or its structure, I just play. This was a big task for me, rummaging through doccumentations that I dont fully 100% understand, looking for the file that contians the line of code I need to change, I just wanted to make the mod work for 26.1.x disregarding efficiency, esp with 26.2 just looming around the corner. (Who doesn't want their world to have new features, right?) I got it working on my local and on a deficated server so might as well share.. I'd be happy if you can help correct any mistakes that I made during my attempt to port. I'll be removing this repo anyway once the author started updating the main stream. |
no worries, I'll just leave them here in case tschipp decides to use this as a base. enjoy your server :) |
We sure are enjoying the Little Babies. Yes, Tschipp already has the groundwork in front of him. :D |
|
um can i get the mod fille so i can download it right away? |
I would suggest not requesting unvalidated jar files, with the current wave of Minecraft malware spreading. |
|
Hi @MasatoNakajima20 , Could you please tell me which setup was used to build it successfully? I tried using Java 21 and Gradle 4.9, but it didn’t work because I kept running into errors during the build process, so I’m not sure what the correct environment should be. Thanks! |
The base project requires at least gradle 8.14, but the wrapper will take care of that. The base project requires java 21, but it was bumped to java 25 as part of this pr, so you will need java 25 |
|
This pr also bumps the wrapper version to 9.4 |
|
@cputnam-a11y I’m still running into an issue when trying to build the project with the current setup (Java 25 + Gradle wrapper 9.4). Error: Why does this happen ? |
Sorry for the lack of response.. Jave 25
|
|
Hey, For example: I'm wondering if I might have missed something simple during the setup process. Thanks! |
Hi, Clone/Fork repo Nothing added/deleted |
|
Oh, that's crazy. I honestly don't know why it's not working on my end then. Would it be possible for you to send me the built JAR file, or maybe upload it somewhere? That way I can at least use it while I keep trying to figure out the build issue. |
That would be an outdated version of the toolchain resolver. Not sure why you would have that, but it should be in setting.gradle, near the top |
For security reasons, I would suggest not, but y'all can hash that out without me. |

No description provided.