blob: cc8023bde601e687494608c95db3a0cc665f1254 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
package re.jag.parquet.mixin;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.At;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.FireworkItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.world.World;
import net.minecraft.stat.Stats;
@Mixin(FireworkItem.class)
public class FireWorkItemMixin extends Item{
public FireWorkItemMixin(Settings settings) {
super(settings);
}
/*
* minecraft.used:minecraft.firework_rocket only counts rockets fired on ground, not the ones used during flight.
* GG Mojang!
*/
@Inject(method="use", at=@At(value = "INVOKE", target = "Lnet/minecraft/world/World;spawnEntity(Lnet/minecraft/entity/Entity;)Z"))
protected void onUse(World world, PlayerEntity user, Hand hand, CallbackInfoReturnable<TypedActionResult<ItemStack>> ci) {
user.incrementStat(Stats.USED.getOrCreateStat(this));
}
}
|