generated from FabricMC/fabric-example-mod
-
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
66 additions
and
120 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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
13 changes: 11 additions & 2 deletions
13
fabric/src/main/java/org/samo_lego/taterzens/compatibility/fabric/LoaderSpecificImpl.java
This file contains 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,12 +1,21 @@ | ||
package org.samo_lego.taterzens.compatibility.fabric; | ||
|
||
import net.minecraft.commands.CommandSourceStack; | ||
import org.samo_lego.taterzens.fabric.mixin.MappedRegistryAccessor; | ||
|
||
import static net.minecraft.core.Registry.ITEM; | ||
import static org.samo_lego.taterzens.Taterzens.LUCKPERMS_LOADED; | ||
import static org.samo_lego.taterzens.compatibility.PermissionHelper.checkPermission; | ||
|
||
import net.minecraft.commands.CommandSourceStack; | ||
|
||
public class LoaderSpecificImpl { | ||
|
||
private static final int REGISTRY_ITEMS_SIZE = ((MappedRegistryAccessor) ITEM).getById().size(); | ||
|
||
public static boolean permissions$checkPermission(CommandSourceStack source, String permissionNode, int fallbackLevel) { | ||
return LUCKPERMS_LOADED ? checkPermission(source, permissionNode, fallbackLevel) : source.hasPermission(fallbackLevel); | ||
} | ||
|
||
public static int getItemRegistrySize() { | ||
return REGISTRY_ITEMS_SIZE; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...xin/accessors/MappedRegistryAccessor.java → .../fabric/mixin/MappedRegistryAccessor.java
This file contains 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 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 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
8 changes: 8 additions & 0 deletions
8
forge/src/main/java/org/samo_lego/taterzens/compatibility/forge/LoaderSpecificImpl.java
This file contains 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,10 +1,18 @@ | ||
package org.samo_lego.taterzens.compatibility.forge; | ||
|
||
import net.minecraft.commands.CommandSourceStack; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraftforge.registries.RegistryManager; | ||
|
||
public class LoaderSpecificImpl { | ||
|
||
private static final ResourceLocation ITEM_ID = new ResourceLocation("item"); | ||
|
||
public static boolean permissions$checkPermission(CommandSourceStack source, String permissionNode, int fallbackLevel) { | ||
return source.hasPermission(fallbackLevel); | ||
} | ||
|
||
public static int getItemRegistrySize() { | ||
return RegistryManager.ACTIVE.getRegistry(ITEM_ID).getValues().size(); | ||
} | ||
} |
This file contains 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 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