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

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

runDir "run"
source sourceSets.gametest
}
}
accessWidenerPath = file("src/main/resources/itematic.accesswidener")
accessWidenerPath = file("src/main/resources/itematic.classtweaker")
}

java {
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.20.6
yarn_mappings=1.20.6+build.3
loader_version=0.17.3
minecraft_version=1.21.1
yarn_mappings=1.21.1+build.3
loader_version=0.18.4

# Mod Properties
mod_version = 0.3.0
mod_version = 0.4.0+1.21.1
maven_group = net.errorcraft
archives_base_name = itematic

# Dependencies
fabric_version=0.100.8+1.20.6
fabric_version=0.116.7+1.21.1
Original file line number Diff line number Diff line change
Expand Up @@ -18,40 +18,40 @@ public static void bootstrap(BiConsumer<Identifier, ItemBarStyle> provider) {
ProgressProvider.DAMAGE,
new HueShiftColorProvider(120, 0),
List.of(
new Identifier("item_bar/progress/13"),
new Identifier("item_bar/progress/12"),
new Identifier("item_bar/progress/11"),
new Identifier("item_bar/progress/10"),
new Identifier("item_bar/progress/9"),
new Identifier("item_bar/progress/8"),
new Identifier("item_bar/progress/7"),
new Identifier("item_bar/progress/6"),
new Identifier("item_bar/progress/5"),
new Identifier("item_bar/progress/4"),
new Identifier("item_bar/progress/3"),
new Identifier("item_bar/progress/2"),
new Identifier("item_bar/progress/1"),
new Identifier("item_bar/progress/0")
Identifier.ofVanilla("item_bar/progress/13"),
Identifier.ofVanilla("item_bar/progress/12"),
Identifier.ofVanilla("item_bar/progress/11"),
Identifier.ofVanilla("item_bar/progress/10"),
Identifier.ofVanilla("item_bar/progress/9"),
Identifier.ofVanilla("item_bar/progress/8"),
Identifier.ofVanilla("item_bar/progress/7"),
Identifier.ofVanilla("item_bar/progress/6"),
Identifier.ofVanilla("item_bar/progress/5"),
Identifier.ofVanilla("item_bar/progress/4"),
Identifier.ofVanilla("item_bar/progress/3"),
Identifier.ofVanilla("item_bar/progress/2"),
Identifier.ofVanilla("item_bar/progress/1"),
Identifier.ofVanilla("item_bar/progress/0")
)
));
provider.accept(ItemBarStyleKeys.BUNDLE, new ItemBarStyle(
ProgressProvider.ITEM_HOLDER_OCCUPANCY,
new ConstantColorProvider(BundleItemAccessor.itemBarColor()),
List.of(
new Identifier("item_bar/progress/0"),
new Identifier("item_bar/progress/0"),
new Identifier("item_bar/progress/1"),
new Identifier("item_bar/progress/2"),
new Identifier("item_bar/progress/3"),
new Identifier("item_bar/progress/4"),
new Identifier("item_bar/progress/5"),
new Identifier("item_bar/progress/6"),
new Identifier("item_bar/progress/7"),
new Identifier("item_bar/progress/8"),
new Identifier("item_bar/progress/9"),
new Identifier("item_bar/progress/10"),
new Identifier("item_bar/progress/11"),
new Identifier("item_bar/progress/12")
Identifier.ofVanilla("item_bar/progress/0"),
Identifier.ofVanilla("item_bar/progress/0"),
Identifier.ofVanilla("item_bar/progress/1"),
Identifier.ofVanilla("item_bar/progress/2"),
Identifier.ofVanilla("item_bar/progress/3"),
Identifier.ofVanilla("item_bar/progress/4"),
Identifier.ofVanilla("item_bar/progress/5"),
Identifier.ofVanilla("item_bar/progress/6"),
Identifier.ofVanilla("item_bar/progress/7"),
Identifier.ofVanilla("item_bar/progress/8"),
Identifier.ofVanilla("item_bar/progress/9"),
Identifier.ofVanilla("item_bar/progress/10"),
Identifier.ofVanilla("item_bar/progress/11"),
Identifier.ofVanilla("item_bar/progress/12")
)
));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ public class ColorProviderTypeKeys {
private ColorProviderTypeKeys() {}

private static Identifier of(String id) {
return new Identifier(id);
return Identifier.ofVanilla(id);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ public class ProgressProviderKeys {
private ProgressProviderKeys() {}

private static Identifier of(String id) {
return new Identifier(id);
return Identifier.ofVanilla(id);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import java.util.function.BiConsumer;

public class ItematicTexturedRenderLayers {
public static final Identifier ARMOR_MATERIALS_ID = new Identifier("armor_materials");
public static final Identifier ARMOR_MATERIALS_ATLAS_TEXTURE = new Identifier("textures/atlas/armor_materials.png");
public static final Identifier ARMOR_MATERIALS_ID = Identifier.ofVanilla("armor_materials");
public static final Identifier ARMOR_MATERIALS_ATLAS_TEXTURE = Identifier.ofVanilla("textures/atlas/armor_materials.png");
public static final RenderLayer ARMOR_MATERIAL_RENDER_LAYER = RenderLayer.getArmorCutoutNoCull(ARMOR_MATERIALS_ATLAS_TEXTURE);

private ItematicTexturedRenderLayers() {}
Expand All @@ -21,8 +21,8 @@ public static void bootstrap(BiConsumer<Identifier, List<AtlasSource>> provider)
provider.accept(ARMOR_MATERIALS_ID, List.of(
new DirectoryAtlasSource("models/armor", "models/armor/"),
new DirectoryAtlasSource("entity/horse/armor", "entity/horse/armor/"),
new SingleAtlasSource(new Identifier("entity/wolf/wolf_armor"), Optional.empty()),
new SingleAtlasSource(new Identifier("entity/wolf/wolf_armor_overlay"), Optional.empty())
new SingleAtlasSource(Identifier.ofVanilla("entity/wolf/wolf_armor"), Optional.empty()),
new SingleAtlasSource(Identifier.ofVanilla("entity/wolf/wolf_armor_overlay"), Optional.empty())
));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,13 @@
import net.errorcraft.itematic.client.item.bar.ItemBarStyleLoader;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.RunArgs;
import net.minecraft.client.gui.screen.recipebook.RecipeResultCollection;
import net.minecraft.item.ItemStack;
import net.minecraft.recipe.RecipeEntry;
import net.minecraft.registry.DefaultedRegistry;
import net.minecraft.registry.DynamicRegistryManager;
import net.minecraft.resource.ReloadableResourceManagerImpl;
import net.minecraft.util.Identifier;
import org.jetbrains.annotations.NotNull;
import org.spongepowered.asm.mixin.*;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
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;

@Mixin(MinecraftClient.class)
Expand All @@ -38,28 +33,6 @@ private void addCustomLoaders(RunArgs args, CallbackInfo info) {
this.resourceManager.registerReloader(this.itemBarStyles);
}

@Redirect(
method = "method_1502",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/registry/DefaultedRegistry;getId(Ljava/lang/Object;)Lnet/minecraft/util/Identifier;"
)
)
@NotNull
private static <T> Identifier initializeItemTooltipSearchProviderUseRegistryEntry(DefaultedRegistry<T> instance, T t, ItemStack stack) {
return stack.itematic$key().getValue();
}

/**
* @author ErrorCraft
* @reason Uses a registry entry for data-driven items.
*/
@Overwrite
private static Identifier method_53861(RecipeResultCollection resultCollection, RecipeEntry<?> entry) {
DynamicRegistryManager registryManager = resultCollection.getRegistryManager();
return entry.value().getResult(registryManager).itematic$key().getValue();
}

@Override
public ItemBarStyleLoader itematic$itemBarStyles() {
return this.itemBarStyles;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import java.util.function.Function;

@Mixin(SmithingScreen.class)
@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
public abstract class SmithingScreenExtender extends ForgingScreen<SmithingScreenHandler> {
public SmithingScreenExtender(SmithingScreenHandler handler, PlayerInventory playerInventory, Text title, Identifier texture) {
super(handler, playerInventory, title, texture);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class RecipeBookWidgetExtender implements RecipeBookWidgetAccess {
method = "initialize",
at = @At("TAIL")
)
private void initializeAllowRecipeSpecificInitialization(int parentWidth, int parentHeight, MinecraftClient client, boolean narrow, AbstractRecipeScreenHandler<?> craftingScreenHandler, CallbackInfo info) {
private void initializeAllowRecipeSpecificInitialization(int parentWidth, int parentHeight, MinecraftClient client, boolean narrow, AbstractRecipeScreenHandler<?, ?> craftingScreenHandler, CallbackInfo info) {
this.itematic$initializeRecipeSpecific(client.world);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
import net.errorcraft.itematic.access.client.gui.tooltip.BundleTooltipComponentAccess;
import net.minecraft.client.gui.tooltip.BundleTooltipComponent;
import net.minecraft.client.gui.tooltip.TooltipComponent;
import net.minecraft.client.item.BundleTooltipData;
import net.minecraft.item.tooltip.BundleTooltipData;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

@Mixin(TooltipComponent.class)
public interface TooltipComponentExtender {
@ModifyExpressionValue(
method = "of(Lnet/minecraft/client/item/TooltipData;)Lnet/minecraft/client/gui/tooltip/TooltipComponent;",
method = "of(Lnet/minecraft/item/tooltip/TooltipData;)Lnet/minecraft/client/gui/tooltip/TooltipComponent;",
at = @At(
value = "NEW",
target = "(Lnet/minecraft/component/type/BundleContentsComponent;)Lnet/minecraft/client/gui/tooltip/BundleTooltipComponent;"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ private static ItemStack newItemStackForTotemOfUndyingUseCreateStack(ItemConvert
@Override
@SuppressWarnings("DataFlowIssue")
public void itematic$onTwirl(TwirlS2CPacket packet) {
TwirlPlayerAction.execute(packet.riptideLevel(), this.client.player, this.world);
TwirlPlayerAction.execute(packet.spinAttackStrength(), this.client.player, this.world, this.client.player.getActiveItem());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
@Mixin(ClientTagLoader.class)
public class ClientTagLoaderExtender {
@Inject(
method = "onDynamicTagsLoaded",
at = @At("HEAD")
method = "load(Lnet/minecraft/registry/DynamicRegistryManager;Z)V",
at = @At("RETURN")
)
private static void resetItemGroupDisplayContext(CallbackInfo info) {
ItemGroupsAccessor.setDisplayContext(null);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,39 +1,22 @@
package net.errorcraft.itematic.mixin.client.render;

import net.errorcraft.itematic.item.ItemKeys;
import net.errorcraft.itematic.item.component.ItemComponentTypes;
import net.errorcraft.itematic.item.component.components.RecordItemComponent;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.WorldRenderer;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.item.Item;
import net.minecraft.item.ItemConvertible;
import net.minecraft.item.ItemStack;
import net.minecraft.item.MusicDiscItem;
import net.minecraft.sound.SoundEvent;
import net.minecraft.util.math.BlockPos;
import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.*;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import java.util.Optional;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.Slice;

@Mixin(WorldRenderer.class)
public class WorldRendererExtender {
@Shadow
private ClientWorld world;

@Shadow
@Final
private MinecraftClient client;

@Unique
private RecordItemComponent recordItemComponent;

@Redirect(
method = "processWorldEvent",
at = @At(
Expand All @@ -52,56 +35,6 @@ private ItemStack newItemStackForSplashPotionUseCreateStack(ItemConvertible item
return this.world.itematic$createStack(ItemKeys.SPLASH_POTION);
}

@Redirect(
method = "processWorldEvent",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/item/Item;byRawId(I)Lnet/minecraft/item/Item;"
)
)
private Item byRawIdUseDynamicRegistry(int id) {
return this.world.itematic$getItemAccess().get(id);
}

@ModifyConstant(
method = "processWorldEvent",
constant = @Constant(
classValue = MusicDiscItem.class,
ordinal = 0
)
)
private boolean instanceOfMusicDiscItemUseItemComponentCheck(Object reference, Class<MusicDiscItem> clazz) {
Optional<RecordItemComponent> optionalComponent = ((Item) reference).itematic$getComponent(ItemComponentTypes.RECORD);
optionalComponent.ifPresent(component -> this.recordItemComponent = component);
return optionalComponent.isPresent();
}

@ModifyVariable(
method = "processWorldEvent",
at = @At("LOAD"),
slice = @Slice(
from = @At(
value = "INVOKE",
target = "Lnet/minecraft/item/Item;byRawId(I)Lnet/minecraft/item/Item;"
)
),
ordinal = 0
)
private Item castToMusicDiscItemUseNull(Item instance) {
return null;
}

@Redirect(
method = "processWorldEvent",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/item/MusicDiscItem;getSound()Lnet/minecraft/sound/SoundEvent;"
)
)
private SoundEvent getSoundUseItemComponent(MusicDiscItem instance) {
return this.recordItemComponent.soundEvent().value();
}

@Redirect(
method = "processWorldEvent",
at = @At(
Expand All @@ -121,29 +54,4 @@ private SoundEvent getSoundUseItemComponent(MusicDiscItem instance) {
private ItemStack newItemStackForEnderEyeUseCreateStack(ItemConvertible item) {
return this.world.itematic$createStack(ItemKeys.ENDER_EYE);
}

@Redirect(
method = "playSong",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/item/MusicDiscItem;bySound(Lnet/minecraft/sound/SoundEvent;)Lnet/minecraft/item/MusicDiscItem;"
)
)
private MusicDiscItem bySoundReturnNull(SoundEvent sound) {
return null;
}

@Inject(
method = "playSong",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/sound/PositionedSoundInstance;record(Lnet/minecraft/sound/SoundEvent;Lnet/minecraft/util/math/Vec3d;)Lnet/minecraft/client/sound/PositionedSoundInstance;"
)
)
private void setRecordPlayingOverlay(SoundEvent song, BlockPos songPosition, CallbackInfo info) {
if (this.recordItemComponent != null) {
this.client.inGameHud.setRecordPlayingOverlay(this.recordItemComponent.getDescription());
this.recordItemComponent = null;
}
}
}
Loading