Skip to content

Commit c6dd3fe

Browse files
committed
Fur pops off head when wet
Resolves #99
1 parent e87107d commit c6dd3fe

File tree

5 files changed

+41
-1
lines changed

5 files changed

+41
-1
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package io.github.openbagtwo.lighterend.mixin;
2+
3+
import io.github.openbagtwo.lighterend.registries.LighterEndSounds;
4+
import io.github.openbagtwo.lighterend.registries.LighterEndTags;
5+
import net.minecraft.entity.EquipmentSlot;
6+
import net.minecraft.entity.LivingEntity;
7+
import net.minecraft.item.ItemStack;
8+
import net.minecraft.registry.tag.FluidTags;
9+
import org.spongepowered.asm.mixin.Mixin;
10+
import org.spongepowered.asm.mixin.injection.At;
11+
import org.spongepowered.asm.mixin.injection.Inject;
12+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
13+
14+
@Mixin(LivingEntity.class)
15+
public abstract class WetFurMixin {
16+
17+
@Inject(method = "baseTick", at = @At("TAIL"))
18+
public void checkForWetFur(CallbackInfo ci) {
19+
LivingEntity thisEntity = (LivingEntity) (Object) this;
20+
ItemStack maybeFur = thisEntity.getEquippedStack(EquipmentSlot.HEAD);
21+
if (
22+
thisEntity.isSubmergedIn(FluidTags.WATER)
23+
&& maybeFur.isIn(LighterEndTags.FUR_ITEMS)
24+
) {
25+
thisEntity.dropItem(maybeFur, true, true);
26+
thisEntity.equipStack(EquipmentSlot.HEAD, ItemStack.EMPTY);
27+
thisEntity.playSound(LighterEndSounds.WET_FUR);
28+
}
29+
}
30+
31+
}

src/main/java/io/github/openbagtwo/lighterend/registries/LighterEndSounds.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public class LighterEndSounds {
3434
public static final SoundEvent TOTEM_TELEPORT = register("item.totem_of_teleportation.teleport");
3535
public static final SoundEvent TP_TOTEM_TARGET_SET = register("item.totem_of_teleportation.set");
3636
public static final SoundEvent MATCH_STRIKE = register("item.matchstick.use");
37+
public static final SoundEvent WET_FUR = register("item.armor.wet_fur");
3738

3839
public static final RegistryEntry<SoundEvent> EQUIP_SILK = registerReference(
3940
"item.armor.equip_silk");

src/main/resources/assets/lighterend/lang/en_us.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,7 @@
696696
"subtitles.lighterend.entity.silk_moth.hurt": "Silk Moth hurts",
697697
"subtitles.lighterend.item.armor.equip_fur": "Donned a silly hat",
698698
"subtitles.lighterend.item.armor.equip_silk": "Silk armor slides on",
699+
"subtitles.lighterend.item.armor.wet_fur": "Fur came loose",
699700
"subtitles.lighterend.item.matchstick.use": "Struck Matchstick",
700701
"subtitles.lighterend.item.shadow_berry_jam.drink": "Gulping",
701702
"subtitles.lighterend.item.totem_of_teleportation.set": "Totem tethered to Obelisk",

src/main/resources/assets/lighterend/sounds.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1535,6 +1535,12 @@
15351535
],
15361536
"subtitle": "subtitles.lighterend.item.armor.equip_silk"
15371537
},
1538+
"item.armor.wet_fur": {
1539+
"sounds": [
1540+
"random/pop"
1541+
],
1542+
"subtitle": "subtitles.lighterend.item.armor.wet_fur"
1543+
},
15381544
"item.matchstick.use": {
15391545
"sounds": [
15401546
{

src/main/resources/lighterend.mixins.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"SurfaceGenMixin",
2323
"TeleportFromVoidMixin",
2424
"TooltipMixin",
25-
"UnderwaterBonemealMixin"
25+
"UnderwaterBonemealMixin",
26+
"WetFurMixin"
2627
],
2728
"package": "io.github.openbagtwo.lighterend.mixin",
2829
"required": true

0 commit comments

Comments
 (0)