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
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.21.5
yarn_mappings=1.21.5+build.1
minecraft_version=1.21.8
yarn_mappings=1.21.8+build.1
loader_version=0.19.3

# Mod Properties
Expand All @@ -13,4 +13,4 @@ org.gradle.jvmargs=-Xmx1G
archives_base_name = itematic

# Dependencies
fabric_version=0.128.2+1.21.5
fabric_version=0.136.1+1.21.8
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
import net.errorcraft.itematic.client.item.bar.ItemBarStyleLoader;

public interface MinecraftClientAccess {
ItemBarStyleLoader itematic$itemBarStyles();
default ItemBarStyleLoader itematic$itemBarStyles() {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@

import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.llamalad7.mixinextras.sugar.Local;
import net.errorcraft.itematic.access.client.MinecraftClientAccess;
import com.mojang.blaze3d.pipeline.RenderPipeline;
import net.errorcraft.itematic.client.item.bar.ItemBarStyleLoader;
import net.errorcraft.itematic.component.ItematicDataComponentTypes;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gl.RenderPipelines;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.gui.render.state.GuiRenderState;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;
import org.spongepowered.asm.mixin.Final;
import org.joml.Matrix3x2fStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
Expand All @@ -22,26 +21,20 @@
import org.spongepowered.asm.mixin.injection.Slice;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import java.util.function.Function;

@Mixin(DrawContext.class)
public abstract class DrawContextExtender {
@Shadow
@Final
private MatrixStack matrices;

@Shadow
public abstract void drawGuiTexture(Function<Identifier, RenderLayer> function, Identifier identifier, int i, int j, int k, int l, int m);
public abstract void drawGuiTexture(RenderPipeline pipeline, Identifier sprite, int x, int y, int width, int height, int color);

@Unique
private ItemBarStyleLoader itemBarStyles;

@Inject(
method = "<init>(Lnet/minecraft/client/MinecraftClient;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider$Immediate;)V",
method = "<init>(Lnet/minecraft/client/MinecraftClient;Lorg/joml/Matrix3x2fStack;Lnet/minecraft/client/gui/render/state/GuiRenderState;)V",
at = @At("TAIL")
)
private void setItemBarStyles(MinecraftClient client, MatrixStack matrices, VertexConsumerProvider.Immediate vertexConsumers, CallbackInfo info) {
this.itemBarStyles = ((MinecraftClientAccess) client).itematic$itemBarStyles();
private void setItemBarStyles(MinecraftClient client, Matrix3x2fStack matrices, GuiRenderState state, CallbackInfo info) {
this.itemBarStyles = client.itematic$itemBarStyles();
}

@ModifyExpressionValue(
Expand Down Expand Up @@ -75,25 +68,22 @@ private void renderItemBarFromDataComponent(ItemStack stack, int x, int y, Callb
return;
}

this.itemBarStyles.get(itemBarStyleId).ifPresent(itemBarStyle -> {
this.matrices.translate(0.0f, 0.0f, 200.0f);
this.drawGuiTexture(
RenderLayer::getGuiTextured,
itemBarStyle.progressTexture(stack),
x,
y,
16,
16,
itemBarStyle.color(stack)
);
});
this.itemBarStyles.get(itemBarStyleId).ifPresent(itemBarStyle -> this.drawGuiTexture(
RenderPipelines.GUI_TEXTURED,
itemBarStyle.progressTexture(stack),
x,
y,
16,
16,
itemBarStyle.color(stack)
));
}

@Redirect(
method = "drawItemBar",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gui/DrawContext;fill(Lnet/minecraft/client/render/RenderLayer;IIIIII)V"
target = "Lnet/minecraft/client/gui/DrawContext;fill(Lcom/mojang/blaze3d/pipeline/RenderPipeline;IIIII)V"
),
slice = @Slice(
from = @At(
Expand All @@ -102,5 +92,5 @@ private void renderItemBarFromDataComponent(ItemStack stack, int x, int y, Callb
)
)
)
private void doNotRenderOriginalItemBar(DrawContext instance, RenderLayer layer, int x1, int y1, int x2, int y2, int z, int color) {}
private void doNotRenderOriginalItemBar(DrawContext instance, RenderPipeline pipeline, int x1, int y1, int x2, int y2, int z) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -18,8 +17,8 @@

@Mixin(AbstractClientPlayerEntity.class)
public abstract class AbstractClientPlayerEntityExtender extends PlayerEntity {
public AbstractClientPlayerEntityExtender(World world, BlockPos pos, float yaw, GameProfile gameProfile) {
super(world, pos, yaw, gameProfile);
public AbstractClientPlayerEntityExtender(World world, GameProfile profile) {
super(world, profile);
}

@Redirect(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void save(RecipeExporter exporter) {
protected abstract BrewingRecipe<T> createRecipe();

protected Ingredient reagent() {
Ingredient reagent = Ingredient.fromTag(this.reagent);
Ingredient reagent = Ingredient.ofTag(this.reagent);
reagent.itematic$setRemainder(Optional.ofNullable(this.remainder).map(ItemStack::new));
return reagent;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public ShapelessRecipe build() {

public ShapelessRecipeBuilder input(RegistryEntry<Item> input, int count, RegistryEntry<Item> remainder) {
for (int i = 0; i < count; i++) {
Ingredient ingredient = Ingredient.fromTag(RegistryEntryList.of(input));
Ingredient ingredient = Ingredient.ofTag(RegistryEntryList.of(input));
ingredient.itematic$setRemainder(Optional.of(new ItemStack(remainder)));
this.inputs.add(ingredient);
}
Expand Down Expand Up @@ -124,12 +124,12 @@ public ShapedRecipe build() {
}

public ShapedRecipeBuilder input(char key, RegistryEntry<Item> input) {
this.inputs.put(key, Ingredient.fromTag(RegistryEntryList.of(input)));
this.inputs.put(key, Ingredient.ofTag(RegistryEntryList.of(input)));
return this;
}

public ShapedRecipeBuilder input(char key, RegistryEntry<Item> input, RegistryEntry<Item> remainder) {
Ingredient ingredient = Ingredient.fromTag(RegistryEntryList.of(input));
Ingredient ingredient = Ingredient.ofTag(RegistryEntryList.of(input));
ingredient.itematic$setRemainder(Optional.of(new ItemStack(remainder)));
this.inputs.put(key, ingredient);
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ public ActionTagProvider(FabricDataOutput output, CompletableFuture<RegistryWrap

@Override
protected void configure(RegistryWrapper.WrapperLookup lookup) {
this.getOrCreateTagBuilder(ActionTags.USE_HOE_ON_BLOCK)
this.builder(ActionTags.USE_HOE_ON_BLOCK)
.add(Actions.TILL_DIRT)
.add(Actions.TILL_COARSE_DIRT)
.add(Actions.TILL_ROOTED_DIRT);
this.getOrCreateTagBuilder(ActionTags.USE_SHOVEL_ON_BLOCK)
this.builder(ActionTags.USE_SHOVEL_ON_BLOCK)
.add(Actions.FLATTEN_GROUND)
.add(Actions.EXTINGUISH_CAMPFIRE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ public BlockTagProvider(FabricDataOutput output, CompletableFuture<RegistryWrapp

@Override
protected void configure(RegistryWrapper.WrapperLookup lookup) {
this.getOrCreateTagBuilder(ItematicBlockTags.END_CRYSTAL_SPAWNABLE_ON)
this.builder(ItematicBlockTags.END_CRYSTAL_SPAWNABLE_ON)
.add(BlockKeys.BEDROCK)
.add(BlockKeys.OBSIDIAN);
this.getOrCreateTagBuilder(ItematicBlockTags.TILLABLE_INTO_FARMLAND)
this.builder(ItematicBlockTags.TILLABLE_INTO_FARMLAND)
.add(BlockKeys.GRASS_BLOCK)
.add(BlockKeys.DIRT)
.add(BlockKeys.DIRT_PATH);
this.getOrCreateTagBuilder(ItematicBlockTags.FLATTENABLE_INTO_DIRT_PATH)
this.builder(ItematicBlockTags.FLATTENABLE_INTO_DIRT_PATH)
.add(BlockKeys.GRASS_BLOCK)
.add(BlockKeys.DIRT)
.add(BlockKeys.PODZOL)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,27 @@ public ItemGroupEntryProviderTagProvider(FabricDataOutput output, CompletableFut

@Override
protected void configure(RegistryWrapper.WrapperLookup lookup) {
this.getOrCreateTagBuilder(ItemGroupEntryProviderTags.BUILDING_BLOCKS)
this.builder(ItemGroupEntryProviderTags.BUILDING_BLOCKS)
.add(ItemGroupEntryProviderKeys.BUILDING_BLOCKS);
this.getOrCreateTagBuilder(ItemGroupEntryProviderTags.COLORED_BLOCKS)
this.builder(ItemGroupEntryProviderTags.COLORED_BLOCKS)
.add(ItemGroupEntryProviderKeys.COLORED_BLOCKS);
this.getOrCreateTagBuilder(ItemGroupEntryProviderTags.NATURAL_BLOCKS)
this.builder(ItemGroupEntryProviderTags.NATURAL_BLOCKS)
.add(ItemGroupEntryProviderKeys.NATURAL_BLOCKS);
this.getOrCreateTagBuilder(ItemGroupEntryProviderTags.FUNCTIONAL_BLOCKS)
this.builder(ItemGroupEntryProviderTags.FUNCTIONAL_BLOCKS)
.add(ItemGroupEntryProviderKeys.FUNCTIONAL_BLOCKS);
this.getOrCreateTagBuilder(ItemGroupEntryProviderTags.REDSTONE_BLOCKS)
this.builder(ItemGroupEntryProviderTags.REDSTONE_BLOCKS)
.add(ItemGroupEntryProviderKeys.REDSTONE_BLOCKS);
this.getOrCreateTagBuilder(ItemGroupEntryProviderTags.TOOLS_AND_UTILITIES)
this.builder(ItemGroupEntryProviderTags.TOOLS_AND_UTILITIES)
.add(ItemGroupEntryProviderKeys.TOOLS_AND_UTILITIES);
this.getOrCreateTagBuilder(ItemGroupEntryProviderTags.COMBAT)
this.builder(ItemGroupEntryProviderTags.COMBAT)
.add(ItemGroupEntryProviderKeys.COMBAT);
this.getOrCreateTagBuilder(ItemGroupEntryProviderTags.FOOD_AND_DRINKS)
this.builder(ItemGroupEntryProviderTags.FOOD_AND_DRINKS)
.add(ItemGroupEntryProviderKeys.FOOD_AND_DRINKS);
this.getOrCreateTagBuilder(ItemGroupEntryProviderTags.INGREDIENTS)
this.builder(ItemGroupEntryProviderTags.INGREDIENTS)
.add(ItemGroupEntryProviderKeys.INGREDIENTS);
this.getOrCreateTagBuilder(ItemGroupEntryProviderTags.SPAWN_EGGS)
this.builder(ItemGroupEntryProviderTags.SPAWN_EGGS)
.add(ItemGroupEntryProviderKeys.SPAWN_EGGS);
this.getOrCreateTagBuilder(ItemGroupEntryProviderTags.OP_BLOCKS)
this.builder(ItemGroupEntryProviderTags.OP_BLOCKS)
.add(ItemGroupEntryProviderKeys.OP_BLOCKS);
}
}
Loading
Loading