Skip to content

Commit c8a86b4

Browse files
Play metal pipe sound when a long rod item falls (#3829)
1 parent ce749c7 commit c8a86b4

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package com.gregtechceu.gtceu.core.mixins.client;
2+
3+
import com.gregtechceu.gtceu.api.GTValues;
4+
import com.gregtechceu.gtceu.api.data.chemical.ChemicalHelper;
5+
import com.gregtechceu.gtceu.api.data.tag.TagPrefix;
6+
import com.gregtechceu.gtceu.common.data.GTSoundEntries;
7+
8+
import net.minecraft.world.entity.Entity;
9+
import net.minecraft.world.entity.item.ItemEntity;
10+
11+
import org.spongepowered.asm.mixin.Mixin;
12+
import org.spongepowered.asm.mixin.Unique;
13+
import org.spongepowered.asm.mixin.injection.At;
14+
import org.spongepowered.asm.mixin.injection.Inject;
15+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
16+
17+
@Mixin(ItemEntity.class)
18+
public class ItemEntityMixin {
19+
20+
@Unique
21+
private boolean gtceu$wasOnGround = ((Entity) (Object) this).onGround();
22+
23+
@Inject(method = "tick", at = @At(value = "HEAD"))
24+
public void beforeTick(CallbackInfo ci) {
25+
ItemEntity entity = (ItemEntity) (Object) this;
26+
if (GTValues.FOOLS.getAsBoolean() && !gtceu$wasOnGround && entity.onGround() &&
27+
ChemicalHelper.getPrefix(entity.getItem().getItem()) == TagPrefix.rodLong) {
28+
GTSoundEntries.METAL_PIPE.playFrom(entity, 10, 1);
29+
}
30+
gtceu$wasOnGround = entity.onGround();
31+
}
32+
}

src/main/resources/gtceu.mixins.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
"TagLoaderMixin",
5959
"TagManagerMixin",
6060
"TagValueAccessor",
61+
"client.ItemEntityMixin",
6162
"emi.EmiRecipeFillerMixin",
6263
"emi.FillRecipePacketMixin",
6364
"emi.FluidEmiStackMixin",

0 commit comments

Comments
 (0)