-
Notifications
You must be signed in to change notification settings - Fork 30
1.21.10 #585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
1.21.10 #585
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
da85ab8
1.21.10
viciscat 6211720
Convert to stonecutter
tr7zw 455a8cb
Add MixinExtras
tr7zw 8c3bffc
Get builds building
tr7zw d71c5e9
Rework offset logic
tr7zw 250b2f8
every versions build!
viciscat e9d967f
Fix offsets in all versions
tr7zw c03e8cd
Format, rebuild
tr7zw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 49 additions & 41 deletions
90
src/main/java/dev/tr7zw/firstperson/FirstPersonBootstrap.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,41 +1,49 @@ | ||
| //#if FORGE | ||
| //$$package dev.tr7zw.firstperson; | ||
| //$$ | ||
| //$$import net.minecraftforge.api.distmarker.Dist; | ||
| //$$import net.minecraftforge.fml.DistExecutor; | ||
| //$$import net.minecraftforge.fml.common.Mod; | ||
| //$$import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; | ||
| //$$import dev.tr7zw.transition.loader.ModLoaderUtil; | ||
| //$$ | ||
| //$$@Mod("firstperson") | ||
| //$$public class FirstPersonBootstrap { | ||
| //$$ | ||
| //$$ public FirstPersonBootstrap(FMLJavaModLoadingContext context) { | ||
| //$$ ModLoaderUtil.setModLoadingContext(context); | ||
| //$$ DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> { | ||
| //$$ new FirstPersonModelMod().sharedSetup(); | ||
| //$$ }); | ||
| //$$ } | ||
| //$$ public FirstPersonBootstrap() { | ||
| //$$ this(FMLJavaModLoadingContext.get()); | ||
| //$$ } | ||
| //$$ | ||
| //$$} | ||
| //#elseif NEOFORGE | ||
| //$$package dev.tr7zw.firstperson; | ||
| //$$ | ||
| //$$import net.neoforged.api.distmarker.Dist; | ||
| //$$import net.neoforged.fml.loading.FMLEnvironment; | ||
| //$$import net.neoforged.fml.common.Mod; | ||
| //$$ | ||
| //$$@Mod("firstperson") | ||
| //$$public class FirstPersonBootstrap { | ||
| //$$ | ||
| //$$ public FirstPersonBootstrap() { | ||
| //$$ if(FMLEnvironment.dist == Dist.CLIENT) { | ||
| //$$ dev.tr7zw.transition.loader.ModLoaderEventUtil.registerClientSetupListener(() -> new FirstPersonModelMod().sharedSetup()); | ||
| //$$ } | ||
| //$$ } | ||
| //$$ | ||
| //$$} | ||
| //#endif | ||
| //? if forge { | ||
| /* | ||
| package dev.tr7zw.firstperson; | ||
|
|
||
| import net.minecraftforge.api.distmarker.Dist; | ||
| import net.minecraftforge.fml.DistExecutor; | ||
| import net.minecraftforge.fml.common.Mod; | ||
| import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; | ||
| import dev.tr7zw.transition.loader.ModLoaderUtil; | ||
|
|
||
| @Mod("firstperson") | ||
| public class FirstPersonBootstrap { | ||
|
|
||
| public FirstPersonBootstrap(FMLJavaModLoadingContext context) { | ||
| ModLoaderUtil.setModLoadingContext(context); | ||
| DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> { | ||
| new FirstPersonModelMod().sharedSetup(); | ||
| }); | ||
| } | ||
|
|
||
| public FirstPersonBootstrap() { | ||
| this(FMLJavaModLoadingContext.get()); | ||
| } | ||
|
|
||
| } | ||
| *///? } else if neoforge { | ||
| /* | ||
| package dev.tr7zw.firstperson; | ||
|
|
||
| import net.neoforged.api.distmarker.Dist; | ||
| import net.neoforged.fml.loading.FMLEnvironment; | ||
| import net.neoforged.fml.common.Mod; | ||
|
|
||
| @Mod("firstperson") | ||
| public class FirstPersonBootstrap { | ||
|
|
||
| public FirstPersonBootstrap() { | ||
| //? if < 1.21.9 { | ||
| /^ | ||
| if (FMLEnvironment.dist == Dist.CLIENT) { | ||
| ^///? } else { | ||
|
|
||
| if (FMLEnvironment.getDist() == Dist.CLIENT) { | ||
| //? } | ||
| dev.tr7zw.transition.loader.ModLoaderEventUtil.registerClientSetupListener(() -> new FirstPersonModelMod().sharedSetup()); | ||
| } | ||
| } | ||
| } | ||
| *///? } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 10 additions & 7 deletions
17
src/main/java/dev/tr7zw/firstperson/FirstPersonModelMod.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,51 +1,60 @@ | ||
| package dev.tr7zw.firstperson; | ||
|
|
||
| import java.util.List; | ||
| import net.minecraft.world.entity.player.*; | ||
| import net.minecraft.world.item.*; | ||
|
|
||
| import net.minecraft.world.entity.player.Inventory; | ||
| import net.minecraft.world.entity.player.Player; | ||
| import net.minecraft.world.item.ItemStack; | ||
| import java.util.*; | ||
|
|
||
| public class InventoryUtil { | ||
|
|
||
| public static Inventory getInventory(Player player) { | ||
| //#if MC >= 11700 | ||
| //? if >= 1.17.0 { | ||
|
|
||
| return player.getInventory(); | ||
| //#else | ||
| //$$ return player.inventory; | ||
| //#endif | ||
| //? } else { | ||
| /* | ||
| return player.inventory; | ||
| *///? } | ||
| } | ||
|
|
||
| public static ItemStack getSelected(Inventory inventory) { | ||
| //#if MC >= 12105 | ||
| //? if >= 1.21.5 { | ||
|
|
||
| return inventory.getSelectedItem(); | ||
| //#else | ||
| //$$ return inventory.getSelected(); | ||
| //#endif | ||
| //? } else { | ||
| /* | ||
| return inventory.getSelected(); | ||
| *///? } | ||
| } | ||
|
|
||
| public static ItemStack getOffhand(Inventory inventory) { | ||
| //#if MC >= 12105 | ||
| //? if >= 1.21.5 { | ||
|
|
||
| return inventory.getItem(Inventory.SLOT_OFFHAND); | ||
| //#else | ||
| //$$ return inventory.offhand.get(0); | ||
| //#endif | ||
| //? } else { | ||
| /* | ||
| return inventory.offhand.get(0); | ||
| *///? } | ||
| } | ||
|
|
||
| public static int getSelectedId(Inventory inventory) { | ||
| //#if MC >= 12105 | ||
| //? if >= 1.21.5 { | ||
|
|
||
| return inventory.getSelectedSlot(); | ||
| //#else | ||
| //$$ return inventory.selected; | ||
| //#endif | ||
| //? } else { | ||
| /* | ||
| return inventory.selected; | ||
| *///? } | ||
| } | ||
|
|
||
| public static List<ItemStack> getNonEquipmentItems(Inventory inventory) { | ||
| //#if MC >= 12105 | ||
| //? if >= 1.21.5 { | ||
|
|
||
| return inventory.getNonEquipmentItems(); | ||
| //#else | ||
| //$$ return inventory.items; | ||
| //#endif | ||
| //? } else { | ||
| /* | ||
| return inventory.items; | ||
| *///? } | ||
| } | ||
|
|
||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical: Method body must be included in the conditional compilation block.
The conditional block on lines 15-18 only wraps the
@Overrideannotation, but the method declaration and body (lines 19-21) remain unconditionally compiled. When the fabric flag is not defined, this creates an orphaned public method that:ClientModInitializerisn't implemented)Apply this diff to fix the issue:
//? if fabric { @Override -//? } public void onInitializeClient() { sharedSetup(); } +//? }This ensures the entire method is only present when the fabric flag is defined, consistent with the pattern used for the import and interface implementation blocks.
📝 Committable suggestion
🤖 Prompt for AI Agents