Skip to content

Commit

Permalink
- fixed: Respiration effect of Aquanaut Helmet was removed when getti…
Browse files Browse the repository at this point in the history
…ng underwater (all loaders)

- fixed: Mixin warning at startup (Fabric/Quilt)
  • Loading branch information
cech12 committed May 11, 2024
1 parent 0474145 commit 2d6efdf
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 11 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Forge Recommended Versioning](https://mcforge.readthedocs.io/en/latest/conventions/versioning/).

## [1.20.4-5.1.1.1] - 2024-05-11
### Fixed
- Respiration effect of Aquanaut Helmet was removed when getting underwater (all loaders)
- Mixin warning at startup (Fabric/Quilt)

## [1.20.4-5.1.1.0] - 2024-05-06
### Added
- added Trinkets 3.8.1 mod support (Fabric, Quilt)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,11 @@ public void inventoryTick(@Nonnull ItemStack stack, Level level, @Nonnull Entity

@Override
public void onUnequippedHatItem(LivingEntity entity, ItemStack oldStack) {
// disable effects when hat is removed from slot
this.removeEffect(entity, MobEffects.CONDUIT_POWER, this.getConduitPowerDuration(oldStack), 0);
if (!entity.level().isClientSide && entity instanceof Player player) {
if (Services.REGISTRY.getEquippedHatItemStacks(player).stream().anyMatch(stack -> stack.getItem() == this)) return;
// disable effects when hat is removed from slot
this.removeEffect(entity, MobEffects.CONDUIT_POWER, this.getConduitPowerDuration(oldStack), 0);
}
}

//to support other apis do not use this method
Expand Down
2 changes: 1 addition & 1 deletion common/src/main/resources/usefulhats.mixins.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"required": true,
"package": "${group}.mixin",
"package": "de.cech12.usefulhats.mixin",
"compatibilityLevel": "JAVA_17",
"refmap": "${mod_id}.refmap.json",
"mixins": [
Expand Down
5 changes: 3 additions & 2 deletions fabric/src/main/resources/usefulhats.fabric.mixins.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"required": true,
"package": "${group}.mixin",
"package": "de.cech12.usefulhats.mixin",
"compatibilityLevel": "JAVA_17",
"refmap": "${mod_id}.refmap.json",
"mixins": [
Expand All @@ -19,7 +19,8 @@
"GuiMixin"
],
"injectors": {
"defaultRequire": 1
"defaultRequire": 1,
"maxShiftBy": 2
},
"minVersion": "0.8"
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@Mixin(value = Item.class, remap = false)
public class ItemMixin {

@Inject(at = @At("RETURN"), method = "initializeClient", cancellable = true)
@Inject(at = @At("RETURN"), method = "initializeClient")
public void initializeClient(@Nonnull Consumer<IClientItemExtensions> consumer, CallbackInfo ci) {
if (this instanceof IUsefulHatModelOwner) {
consumer.accept(UsefulHatItemExtension.INSTANCE);
Expand Down
2 changes: 1 addition & 1 deletion forge/src/main/resources/usefulhats.forge.mixins.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"required": true,
"package": "${group}.mixin",
"package": "de.cech12.usefulhats.mixin",
"compatibilityLevel": "JAVA_17",
"refmap": "${mod_id}.refmap.json",
"mixins": [
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# Project
group=de.cech12.usefulhats
mod_version=5.1.1.0
mod_version=5.1.1.1
mod_id=usefulhats
mod_name=Useful Hats
mod_author=Cech12
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@Mixin(value = Item.class, remap = false)
public class ItemMixin {

@Inject(at = @At("RETURN"), method = "initializeClient", cancellable = true)
@Inject(at = @At("RETURN"), method = "initializeClient")
public void initializeClient(@Nonnull Consumer<IClientItemExtensions> consumer, CallbackInfo ci) {
if (this instanceof IUsefulHatModelOwner) {
consumer.accept(UsefulHatItemExtension.INSTANCE);
Expand Down
4 changes: 2 additions & 2 deletions neoforge/src/main/resources/usefulhats.neoforge.mixins.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"required": true,
"package": "${group}.mixin",
"package": "de.cech12.usefulhats.mixin",
"compatibilityLevel": "JAVA_17",
"refmap": "${mod_id}.refmap.json",
"refmap": "usefulhats.refmap.json",
"mixins": [
"ItemMixin"
],
Expand Down

0 comments on commit 2d6efdf

Please sign in to comment.