fix arrows from skeletons dropping heads
This commit is contained in:
parent
7b653486fc
commit
ae333c90da
5 changed files with 29 additions and 2 deletions
|
@ -8,4 +8,4 @@ loader_version=0.16.14
|
|||
loom_version=1.11-SNAPSHOT
|
||||
fabric_version=0.129.0+1.21.7
|
||||
|
||||
mod_version=0.0.1
|
||||
mod_version=0.0.2
|
||||
|
|
|
@ -13,6 +13,8 @@ public class PlayerHeads implements ModInitializer {
|
|||
public static final String NAMESPACE = "playerheads";
|
||||
public static final Logger LOGGER = LoggerFactory.getLogger(NAMESPACE);
|
||||
|
||||
public static final String TAG_SHOT_FROM_DISPENSER = "__shot_from_dispenser__";
|
||||
|
||||
public static final LootFunctionType<CopyPlayerHeadLootFunction> COPY_PLAYER_HEAD = Registry.register(
|
||||
Registries.LOOT_FUNCTION_TYPE,
|
||||
newIdentifier("copy_player_head"),
|
||||
|
|
23
src/main/java/eu/e99/playerheads/mixin/ArrowItemMixin.java
Normal file
23
src/main/java/eu/e99/playerheads/mixin/ArrowItemMixin.java
Normal file
|
@ -0,0 +1,23 @@
|
|||
package eu.e99.playerheads.mixin;
|
||||
|
||||
import eu.e99.playerheads.PlayerHeads;
|
||||
import net.minecraft.entity.projectile.ProjectileEntity;
|
||||
import net.minecraft.item.ArrowItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Position;
|
||||
import net.minecraft.world.World;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(ArrowItem.class)
|
||||
public class ArrowItemMixin {
|
||||
|
||||
@Inject(method = "createEntity", at = @At("RETURN"))
|
||||
private void playerheads$createEntity(World world, Position pos, ItemStack stack, Direction direction, CallbackInfoReturnable<ProjectileEntity> cir) {
|
||||
ProjectileEntity entity = cir.getReturnValue();
|
||||
entity.addCommandTag(PlayerHeads.TAG_SHOT_FROM_DISPENSER);
|
||||
}
|
||||
}
|
|
@ -21,7 +21,8 @@
|
|||
"condition": "minecraft:damage_source_properties",
|
||||
"predicate": {
|
||||
"direct_entity": {
|
||||
"type": "#minecraft:arrows"
|
||||
"type": "#minecraft:arrows",
|
||||
"nbt": "{Tags:[\"__shot_from_dispenser__\"]}"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"package": "eu.e99.playerheads.mixin",
|
||||
"compatibilityLevel": "JAVA_21",
|
||||
"mixins": [
|
||||
"ArrowItemMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
|
Loading…
Add table
Reference in a new issue