diff --git a/CHANGELOG.md b/CHANGELOG.md index 8522167d8..593589df0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [3.0.1] - 2021-03-16 +### Fixed +- Crash on dedicated server + ## [3.0.0] - 2021-03-16 ### Added - Vampiric Glove artifact @@ -136,7 +140,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Initial release -[Unreleased]: https://github.com/florensie/artifacts-fabric/compare/v3.0.0...HEAD +[Unreleased]: https://github.com/florensie/artifacts-fabric/compare/v3.0.1...HEAD +[3.0.0]: https://github.com/florensie/artifacts-fabric/compare/v3.0.0...v3.0.1 [3.0.0]: https://github.com/florensie/artifacts-fabric/compare/v2.3.0...v3.0.0 [2.3.0]: https://github.com/florensie/artifacts-fabric/compare/v2.2.1...v2.3.0 [2.2.1]: https://github.com/florensie/artifacts-fabric/compare/v2.2.0...v2.2.1 diff --git a/gradle.properties b/gradle.properties index ba390e0bd..81c517d81 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,7 +10,7 @@ yarn_mappings=1.16.5+build.5 loader_version=0.11.2 # Mod Properties -mod_version=3.0.0+fabric +mod_version=3.0.1+fabric maven_group=artifacts archives_base_name=artifacts diff --git a/src/main/java/artifacts/item/UmbrellaItem.java b/src/main/java/artifacts/item/UmbrellaItem.java index 17bbf3b70..25b8976a9 100644 --- a/src/main/java/artifacts/item/UmbrellaItem.java +++ b/src/main/java/artifacts/item/UmbrellaItem.java @@ -1,26 +1,18 @@ package artifacts.item; -import artifacts.Artifacts; import artifacts.init.Items; import net.minecraft.block.DispenserBlock; -import net.minecraft.client.util.ModelIdentifier; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ArmorItem; import net.minecraft.item.ItemStack; import net.minecraft.util.Hand; -import net.minecraft.util.Identifier; import net.minecraft.util.TypedActionResult; import net.minecraft.util.UseAction; import net.minecraft.world.World; public class UmbrellaItem extends ArtifactItem { - public static final ModelIdentifier UMBRELLA_HELD_MODEL = new ModelIdentifier( - new Identifier(Artifacts.MODID, "umbrella_in_hand"), "inventory"); - public static final ModelIdentifier UMBRELLA_ICON_MODEL = new ModelIdentifier( - new Identifier(Artifacts.MODID, "umbrella"), "inventory"); - public UmbrellaItem() { DispenserBlock.registerBehavior(this, ArmorItem.DISPENSER_BEHAVIOR); } diff --git a/src/main/java/artifacts/mixin/mixins/item/umbrella/client/ItemRendererMixin.java b/src/main/java/artifacts/mixin/mixins/item/umbrella/client/ItemRendererMixin.java index 3bf02fab1..1a15c5486 100644 --- a/src/main/java/artifacts/mixin/mixins/item/umbrella/client/ItemRendererMixin.java +++ b/src/main/java/artifacts/mixin/mixins/item/umbrella/client/ItemRendererMixin.java @@ -1,15 +1,21 @@ package artifacts.mixin.mixins.item.umbrella.client; +import artifacts.Artifacts; import artifacts.init.Items; import artifacts.item.UmbrellaItem; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; import net.minecraft.client.render.item.ItemModels; import net.minecraft.client.render.item.ItemRenderer; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.json.ModelTransformation; +import net.minecraft.client.util.ModelIdentifier; import net.minecraft.item.ItemStack; +import net.minecraft.util.Identifier; 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.ModifyVariable; @@ -17,10 +23,16 @@ public abstract class ItemRendererMixin { @Shadow @Final private ItemModels models; + @Unique + private static final ModelIdentifier UMBRELLA_HELD_MODEL = new ModelIdentifier( + new Identifier(Artifacts.MODID, "umbrella_in_hand"), "inventory"); + @Unique + private static final ModelIdentifier UMBRELLA_ICON_MODEL = new ModelIdentifier( + new Identifier(Artifacts.MODID, "umbrella"), "inventory"); @ModifyVariable(method = "getHeldItemModel", at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/client/render/item/ItemModels;getModel(Lnet/minecraft/item/ItemStack;)Lnet/minecraft/client/render/model/BakedModel;")) private BakedModel setUmbrellaHeldModel(BakedModel model, ItemStack stack) { - return stack.getItem() == Items.UMBRELLA ? this.models.getModelManager().getModel(UmbrellaItem.UMBRELLA_HELD_MODEL) : model; + return stack.getItem() == Items.UMBRELLA ? this.models.getModelManager().getModel(UMBRELLA_HELD_MODEL) : model; } @ModifyVariable(method = "renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/render/model/json/ModelTransformation$Mode;ZLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;IILnet/minecraft/client/render/model/BakedModel;)V", @@ -31,6 +43,6 @@ private BakedModel setUmbrellaIconModel(BakedModel model, ItemStack stack, Model renderMode == ModelTransformation.Mode.FIXED; return stack.getItem() == Items.UMBRELLA && shouldUseIcon - ? this.models.getModelManager().getModel(UmbrellaItem.UMBRELLA_ICON_MODEL) : model; + ? this.models.getModelManager().getModel(UMBRELLA_ICON_MODEL) : model; } } diff --git a/src/main/java/artifacts/mixin/mixins/item/umbrella/client/ModelLoaderMixin.java b/src/main/java/artifacts/mixin/mixins/item/umbrella/client/ModelLoaderMixin.java index 930987d34..2c6cdd0f7 100644 --- a/src/main/java/artifacts/mixin/mixins/item/umbrella/client/ModelLoaderMixin.java +++ b/src/main/java/artifacts/mixin/mixins/item/umbrella/client/ModelLoaderMixin.java @@ -1,10 +1,13 @@ package artifacts.mixin.mixins.item.umbrella.client; +import artifacts.Artifacts; import artifacts.item.UmbrellaItem; import net.minecraft.client.render.model.ModelLoader; import net.minecraft.client.util.ModelIdentifier; +import net.minecraft.util.Identifier; 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.callback.CallbackInfo; @@ -13,9 +16,12 @@ public abstract class ModelLoaderMixin { @Shadow protected abstract void addModel(ModelIdentifier modelId); + @Unique + private static final ModelIdentifier UMBRELLA_HELD_MODEL = new ModelIdentifier( + new Identifier(Artifacts.MODID, "umbrella_in_hand"), "inventory"); @Inject(method = "", at = @At(value = "INVOKE_STRING", shift = At.Shift.AFTER, target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", args = {"ldc=special"})) private void addUmbrellaHeldModel(CallbackInfo info) { - this.addModel(UmbrellaItem.UMBRELLA_HELD_MODEL); + this.addModel(UMBRELLA_HELD_MODEL); } }