Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ jobs:
run: |
echo 'value<<EOF' >> "$GITHUB_OUTPUT"
echo 'cloth-config(required){modrinth:9s6osm5g}{curseforge:348521}' >> "$GITHUB_OUTPUT"
echo 'yarrp(required){modrinth:Z2RtCqwR}{curseforge:1385339}' >> "$GITHUB_OUTPUT"
if [ "${{ endsWith(matrix.subproject, '-fabric') }}" = "true" ]; then
# shellcheck disable=SC2129
echo 'fabric-api(required){modrinth:P7dR8mSH}{curseforge:306612}' >> "$GITHUB_OUTPUT"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This is my vision of the Inventory Update for Minecraft. Of
[features](#Features) I believe are in line with Mojang's vision and could be
potentially added to the game.

Available for both Fabric and (Neo)Forge.
Available for both Fabric and NeoForge.

## Installation

Expand Down
19 changes: 15 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,19 @@ preprocess {
// which we would need for strict mappings to work
strictExtraMappings = false

val mc12006_common = createNode("1.20.6-common", 1_20_06, "yarn")
val mc12006_fabric = createNode("1.20.6-fabric", 1_20_06, "yarn")
val mc12006_neoforge = createNode("1.20.6-neoforge", 1_20_06, "yarn")

val mc12101_common = createNode("1.21.1-common", 1_21_01, "yarn")
val mc12101_fabric = createNode("1.21.1-fabric", 1_21_01, "yarn")
val mc12101_neoforge = createNode("1.21.1-neoforge", 1_21_01, "yarn")

// 1.20.6
mc12006_common.link(mc12006_fabric, null)
mc12006_common.link(mc12006_neoforge, file("versions/mappings-common-neoforge.txt"))
mc12101_fabric.link(mc12006_fabric, null)
mc12101_neoforge.link(mc12006_neoforge, file("versions/mappings-neoforge-1.21.1-1.20.6.txt"))
// 1.21.1
mc12101_common.link(mc12101_fabric, null)
mc12101_common.link(mc12101_neoforge, file("versions/mappings-common-neoforge.txt"))
}

spotless {
Expand All @@ -46,12 +52,13 @@ spotless {
"ktlint_standard_no-wildcard-imports" to "disabled",
"ktlint_standard_blank-line-before-declaration" to "disabled",
"ktlint_standard_spacing-between-declarations-with-annotations" to "disabled",
"ktlint_standard_no-empty-file" to "disabled",
// these are replaced by the custom rule set
"ktlint_standard_import-ordering" to "disabled",
"ktlint_standard_comment-spacing" to "disabled",
"ktlint_standard_chain-wrapping" to "disabled",
),
).customRuleSets(listOf("com.github.RubixDev:ktlint-ruleset-mc-preprocessor:2c5a3687bb"))
).customRuleSets(listOf("com.github.RubixDev:ktlint-ruleset-mc-preprocessor:54d81aa9b4"))

kotlinGradle {
target("**/*.gradle.kts")
Expand All @@ -73,6 +80,10 @@ spotless {
eclipse("4.31").configFile("eclipse-prefs.xml")
formatAnnotations()
}
json {
target("**/*.json")
gson().indentWithSpaces(2)
}
}

tasks.register("buildAndGather") {
Expand Down
18 changes: 15 additions & 3 deletions common.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class Props {
val neoforge_version_range: String by prop

val cloth_version: String by prop
val yarrp_version: String by prop
val clumps_version: String by prop

val early_loading_screen_version: String by prop
Expand Down Expand Up @@ -135,11 +136,12 @@ repositories {

// Mixin
maven("https://repo.spongepowered.org/maven/")
// Conditional Mixin
maven("https://maven.fallenbreath.me/releases")
// Cloth Config
maven("https://maven.shedaniel.me/")
// Conditional Mixin
// YARRP
maven("https://jitpack.io")
maven("https://maven.fallenbreath.me/releases")
// Other mods from Modrinth
maven("https://api.modrinth.com/maven")
}
Expand Down Expand Up @@ -171,6 +173,7 @@ dependencies {
exclude(group = "net.fabricmc.fabric-api")
}
modCompileOnly("me.fallenbreath:conditional-mixin-common:${props.conditional_mixin_version}")
modCompileOnly("com.github.RubixDev.YARRP:yarrp-mc${props.minecraft_version}-fabric:${props.yarrp_version}")
}
Loader.FABRIC -> {
modLocalRuntime("maven.modrinth:early-loading-screen:${props.early_loading_screen_version}")
Expand All @@ -185,6 +188,7 @@ dependencies {
modImplementation("me.shedaniel.cloth:cloth-config-fabric:${props.cloth_version}") {
exclude(group = "net.fabricmc.fabric-api")
}
modImplementation("com.github.RubixDev.YARRP:yarrp-mc${props.minecraft_version}-fabric:${props.yarrp_version}")

// other mods we do integration with
// - Trinkets
Expand All @@ -200,6 +204,7 @@ dependencies {
exclude(group = "net.neoforged.fancymodloader", module = "loader")
}
modImplementation("me.shedaniel.cloth:cloth-config-neoforge:${props.cloth_version}")
modImplementation("com.github.RubixDev.YARRP:yarrp-mc${props.minecraft_version}-neoforge:${props.yarrp_version}")

// other mods we do integration with
// - Curios API
Expand Down Expand Up @@ -227,7 +232,14 @@ tasks.named<ProcessResources>("processResources") {

// See https://minecraft.wiki/w/Pack_format#List_of_resource_pack_formats
val resourcePackVersions = mapOf(
12006 to 32,
12006 to "32",
12101 to "34",
12103 to "42",
12104 to "46",
12105 to "55",
12106 to "63",
12108 to "64",
12110 to "69.0",
)

val replaceProperties = mapOf(
Expand Down
6 changes: 4 additions & 2 deletions settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"versions": [
"1.20.6-common",
"1.20.6-fabric",
"1.20.6-neoforge"
"1.20.6-neoforge",
"1.21.1-common",
"1.21.1-fabric",
"1.21.1-neoforge"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private void inventorioDisplayOffhand(EquipmentSlot slot, CallbackInfoReturnable
* hands. First, the offhand is attached to the utility belt, rather than a
* vanilla slot. Second, a player can swap the main hand and the offhand.
*/
@SuppressWarnings({ "unchecked", "MixinExtrasOperationParameters" })
@SuppressWarnings("unchecked")
@WrapOperation(
method = "equipStack",
at = @At(
Expand Down Expand Up @@ -102,7 +102,7 @@ private <E> E inventorioEquipOffhand(DefaultedList<E> defaultedList, int index,
*/
@Inject(method = "equipStack", at = @At(value = "RETURN"))
private void inventorioOnEquipArmor(EquipmentSlot slot, ItemStack stack, CallbackInfo ci) {
if (slot.getType() == EquipmentSlot.Type.ARMOR) MixinHelpers
if (slot.getType() == EquipmentSlot.Type.HUMANOID_ARMOR) MixinHelpers
.withScreenHandler((PlayerEntity) (Object) this, InventorioScreenHandler::updateDeepPocketsCapacity);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

//#if MC >= 12101
import net.minecraft.entity.Entity;
//#endif

@Mixin(PlayerManager.class)
public class PlayerManagerMixin {
/**
Expand All @@ -34,9 +38,12 @@ private void inventorioSetPlayerSettings(
* server to the client
*/
@Inject(method = "respawnPlayer", at = @At(value = "RETURN"), require = 0)
private void inventorioSetPlayerSettings(
private void inventorioSetPlayerSettings(/* #if <- hack around formatter */
ServerPlayerEntity oldPlayer,
boolean alive,
//#if MC >= 12101
Entity.RemovalReason removalReason,
//#endif
CallbackInfoReturnable<ServerPlayerEntity> cir
) {
ServerPlayerEntity newPlayer = cir.getReturnValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;

//#if MC >= 12101
import net.minecraft.recipe.CraftingRecipe;
import net.minecraft.recipe.RecipeEntry;
import org.jetbrains.annotations.Nullable;
//#endif

@Mixin(CraftingScreenHandler.class)
public interface CraftingScreenHandlerAccessor {
@Invoker("updateResult")
Expand All @@ -18,5 +24,8 @@ static void updateTheResult(
PlayerEntity player,
RecipeInputInventory craftingInventory,
CraftingResultInventory resultInventory
//#if MC >= 12101
, @Nullable RecipeEntry<CraftingRecipe> recipe
//#endif
) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,27 @@
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

//#if MC >= 12101
import net.minecraft.client.render.RenderTickCounter;
//#endif

@Mixin(value = InGameHud.class, priority = 1500)
@Environment(EnvType.CLIENT)
public class InGameHudMixinHP {
/**
* This mixin calls the renderer of hotbar addons. Note: this mixin doesn't
* work in (Neo)Forge and is substituted with a (Neo)Forge event.
* work in NeoForge and is substituted with a NeoForge event.
*/
@Inject(method = "render", at = @At(value = "RETURN"))
private void inventorioRenderHotbarAddons(DrawContext context, float tickDelta, CallbackInfo ci) {
private void inventorioRenderHotbarAddons(/* #if <- hack around formatter */
DrawContext context,
//#if MC >= 12101
RenderTickCounter tickCounter,
//#else
//$$ float tickDelta,
//#endif
CallbackInfo ci
) {
HotbarHUDRenderer.INSTANCE.renderHotbarAddons(context);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

//#if MC >= 12101
import net.minecraft.client.render.RenderTickCounter;
//#endif

@Mixin(value = InGameHud.class, priority = 99)
@Environment(EnvType.CLIENT)
public class InGameHudMixinLP {
Expand All @@ -22,12 +26,28 @@ public class InGameHudMixinLP {
* is selected.
*/
@Inject(method = "renderHotbar", at = @At(value = "HEAD"), cancellable = true, require = 0)
private void inventorioRenderSegmentedHotbar(DrawContext context, float tickDelta, CallbackInfo ci) {
private void inventorioRenderSegmentedHotbar(/* #if <- hack around formatter */
DrawContext context,
//#if MC >= 12101
RenderTickCounter tickCounter,
//#else
//$$ float tickDelta,
//#endif
CallbackInfo ci
) {
if (HotbarHUDRenderer.INSTANCE.renderSegmentedHotbar(context)) ci.cancel();
}

@Inject(method = "renderHotbar", at = @At(value = "RETURN"), require = 0)
private void inventorioRenderFunctionOnlySelector(DrawContext context, float tickDelta, CallbackInfo ci) {
private void inventorioRenderFunctionOnlySelector(/* #if <- hack around formatter */
DrawContext context,
//#if MC >= 12101
RenderTickCounter tickCounter,
//#else
//$$ float tickDelta,
//#endif
CallbackInfo ci
) {
HotbarHUDRenderer.INSTANCE.renderFunctionOnlySelector(context);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,39 @@
import me.fallenbreath.conditionalmixin.api.annotation.Condition;
import me.fallenbreath.conditionalmixin.api.annotation.Restriction;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

@Restriction(require = @Condition(type = Condition.Type.TESTER, tester = BowTester.class))
@Mixin(PlayerEntity.class)
public class PlayerEntityMixin {
public abstract class PlayerEntityMixin extends LivingEntity {
protected PlayerEntityMixin(EntityType<? extends LivingEntity> entityType, World world) {
super(entityType, world);
}

/**
* This fixes a bug that an Infinity Bow requires an arrow to shoot.
*/
@ModifyExpressionValue(
method = "getProjectileType",
at = @At(value = "FIELD", target = "Lnet/minecraft/entity/player/PlayerAbilities;creativeMode:Z")
at = @At(
value = "FIELD",
target = "Lnet/minecraft/entity/player/PlayerAbilities;creativeMode:Z",
opcode = Opcodes.GETFIELD
)
)
private boolean inventorioFixInfinityBow(boolean original, ItemStack bow) {
return original || RandomStuff.getLevelOn(Enchantments.INFINITY, bow) > 0;
//#if MC >= 12101
var infinity = RandomStuff.getEnchantment(this, Enchantments.INFINITY);
//#else
//$$ var infinity = Enchantments.INFINITY;
//#endif
return original || RandomStuff.getLevelOn(infinity, bow) > 0;
}
}
Loading