Skip to content
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 2 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.14-SNAPSHOT'
id 'fabric-loom' version '1.16-SNAPSHOT'
id 'maven-publish'
}

Expand All @@ -12,8 +12,6 @@ repositories {
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.

maven { url 'https://jitpack.io' }
}

dependencies {
Expand All @@ -24,9 +22,6 @@ dependencies {

// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

modImplementation "com.github.Chocohead:Fabric-ASM:v2.3"
include "com.github.Chocohead:Fabric-ASM:v2.3"
}

processResources {
Expand Down Expand Up @@ -107,7 +102,7 @@ loom {
gametestClient {
inherit client
name "GameTest Client"
vmArg "-Dfabric-api.gametest.structures.output-dir=${file("src/gametest/resources/data/itematic/gametest/structure")}"
vmArg "-Ditematic.gametest.structure-output-directory=${file("src/gametest/resources/data")}"

runDir "run"
source sourceSets.gametest
Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.21.3
yarn_mappings=1.21.3+build.2
loader_version=0.18.4
minecraft_version=1.21.5
yarn_mappings=1.21.5+build.1
loader_version=0.19.2

# Mod Properties
mod_version = 0.5.0+1.21.3
mod_version = 0.6.0-preview.2+1.21.5
maven_group = net.errorcraft
archives_base_name = itematic

# Dependencies
fabric_version=0.114.1+1.21.3
fabric_version=0.128.2+1.21.5
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
14 changes: 5 additions & 9 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package net.errorcraft.itematic.access.client.gui.screen;

import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;

public interface GameModeSwitcherScreenAccess {
interface GameModeSelectionAccess {
default ItemStack itematic$icon(Registry<Item> registry) {
return ItemStack.EMPTY;
}
default void itematic$setIcon(RegistryKey<Item> item) {}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package net.errorcraft.itematic.client.gui.screen.recipebook;

import net.errorcraft.itematic.client.recipebook.ItematicSearchRecipeBookTypes;
import net.errorcraft.itematic.mixin.client.gui.screen.recipebook.GhostRecipeAccessor;
import net.errorcraft.itematic.recipe.book.ItematicRecipeBookCategories;
import net.errorcraft.itematic.recipe.display.BrewingRecipeDisplay;
Expand All @@ -9,6 +8,7 @@
import net.minecraft.client.gui.screen.recipebook.GhostRecipe;
import net.minecraft.client.gui.screen.recipebook.RecipeBookWidget;
import net.minecraft.client.gui.screen.recipebook.RecipeResultCollection;
import net.minecraft.client.recipebook.RecipeBookType;
import net.minecraft.item.Items;
import net.minecraft.recipe.RecipeFinder;
import net.minecraft.recipe.display.RecipeDisplay;
Expand All @@ -28,7 +28,7 @@ public class BrewingRecipeBookWidget extends RecipeBookWidget<BrewingStandMenuDe
);
private static final Text TOGGLE_BREWABLE_TEXT = Text.translatable("gui.recipebook.toggleRecipes.brewable");
private static final List<Tab> TABS = List.of(
new Tab(ItematicSearchRecipeBookTypes.BREWING),
new Tab(RecipeBookType.ITEMATIC_BREWING),
// Item references are intended as key conversion is handled by a mixin
new Tab(Items.NETHER_WART, Items.MAGMA_CREAM, ItematicRecipeBookCategories.BREWING_MODIFY),
new Tab(Items.SPLASH_POTION, Items.LINGERING_POTION, ItematicRecipeBookCategories.BREWING_AMPLIFY)
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.tag.TagKey;
import net.minecraft.util.Identifier;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
Expand Down Expand Up @@ -46,17 +44,6 @@ private void setItemBarStyles(MinecraftClient client, MatrixStack matrices, Vert
this.itemBarStyles = ((MinecraftClientAccess) client).itematic$itemBarStyles();
}

@Redirect(
method = "drawItem(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/world/World;Lnet/minecraft/item/ItemStack;IIII)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/item/ItemStack;isIn(Lnet/minecraft/registry/tag/TagKey;)Z"
)
)
private boolean isInForBundlesReturnFalse(ItemStack instance, TagKey<Item> tag) {
return false;
}

@ModifyExpressionValue(
method = "drawItemBar",
at = @At(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package net.errorcraft.itematic.mixin.client.gui.screen;


import net.errorcraft.itematic.access.client.gui.screen.GameModeSelectionScreenGameModeSelectionAccess;
import net.errorcraft.itematic.access.client.gui.screen.GameModeSwitcherScreenAccess;
import net.errorcraft.itematic.item.ItemKeys;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.GameModeSelectionScreen;
import net.minecraft.client.gui.screen.GameModeSwitcherScreen;
import net.minecraft.item.Item;
import net.minecraft.item.ItemConvertible;
import net.minecraft.item.ItemStack;
Expand All @@ -18,54 +18,61 @@
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.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

public class GameModeSelectionScreenExtender {
@Mixin(GameModeSelectionScreen.ButtonWidget.class)
public class GameModeSwitcherScreenExtender {
@Mixin(GameModeSwitcherScreen.ButtonWidget.class)
public static class ButtonWidgetExtender {
@Redirect(
method = "renderWidget",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gui/screen/GameModeSelectionScreen$GameModeSelection;renderIcon(Lnet/minecraft/client/gui/DrawContext;II)V"
target = "Lnet/minecraft/client/gui/screen/GameModeSwitcherScreen$GameModeSelection;renderIcon(Lnet/minecraft/client/gui/DrawContext;II)V"
)
)
private void renderIconUseRegistryEntry(GameModeSelectionScreen.GameModeSelection instance, DrawContext context, int x, int y) {
private void renderIconUseRegistryEntry(GameModeSwitcherScreen.GameModeSelection instance, DrawContext context, int x, int y) {
World world = MinecraftClient.getInstance().world;
if (world == null) {
return;
}

ItemStack stack = instance.itematic$icon(world.getRegistryManager().getOrThrow(RegistryKeys.ITEM));
context.drawItem(stack, x, y);
}
}

@Mixin(GameModeSelectionScreen.GameModeSelection.class)
public static class GameModeSelectionExtender implements GameModeSelectionScreenGameModeSelectionAccess {
@Final
@Mixin(GameModeSwitcherScreen.GameModeSelection.class)
public static class GameModeSelectionExtender implements GameModeSwitcherScreenAccess.GameModeSelectionAccess {
@Shadow
public static GameModeSelectionScreen.GameModeSelection CREATIVE;

@Final
@Shadow
public static GameModeSelectionScreen.GameModeSelection SURVIVAL;
public static GameModeSwitcherScreen.GameModeSelection CREATIVE;

@Final
@Shadow
public static GameModeSelectionScreen.GameModeSelection ADVENTURE;
@Final
public static GameModeSwitcherScreen.GameModeSelection SURVIVAL;

@Shadow
@Final
public static GameModeSwitcherScreen.GameModeSelection ADVENTURE;

@Shadow
public static GameModeSelectionScreen.GameModeSelection SPECTATOR;
@Final
public static GameModeSwitcherScreen.GameModeSelection SPECTATOR;

@Unique
private RegistryKey<Item> icon;

static {
((GameModeSelectionExtender)(Object) CREATIVE).icon = ItemKeys.GRASS_BLOCK;
((GameModeSelectionExtender)(Object) SURVIVAL).icon = ItemKeys.IRON_SWORD;
((GameModeSelectionExtender)(Object) ADVENTURE).icon = ItemKeys.MAP;
((GameModeSelectionExtender)(Object) SPECTATOR).icon = ItemKeys.ENDER_EYE;
@Inject(
method = "<clinit>",
at = @At("TAIL")
)
private static void setIcons(CallbackInfo info) {
CREATIVE.itematic$setIcon(ItemKeys.GRASS_BLOCK);
SURVIVAL.itematic$setIcon(ItemKeys.IRON_SWORD);
ADVENTURE.itematic$setIcon(ItemKeys.MAP);
SPECTATOR.itematic$setIcon(ItemKeys.ENDER_EYE);
}

@Redirect(
Expand All @@ -84,9 +91,15 @@ private static ItemStack newItemStackReturnEmptyStack(ItemConvertible item) {
if (this.icon == null) {
return ItemStack.EMPTY;
}

return registry.getOptional(this.icon)
.map(ItemStack::new)
.orElse(ItemStack.EMPTY);
}

@Override
public void itematic$setIcon(RegistryKey<Item> icon) {
this.icon = icon;
}
}
}
Loading
Loading