Reputation: 41
The following snippet of code is one that I have used from a tutorial I found online:
package com.jktech.minend.common.events;
import net.minecraft.entity.ItemEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
@Mixin(ItemEntity.class)
public abstract class itemevents extends ItemEntity {
public itemevents(World world, double x, double y, double z, ItemStack stack, doublevelocityX, double velocityY, double velocityZ) {
super(world, x, y, z, stack, velocityX, velocityY, velocityZ);
}
}
Although the code compiles, it still shows errors on runtime, yet the game doesn't crash. However, my functions don't execute and nothing happens (as if they weren't applied in the first place).
[14:16:45] [main/ERROR] (mixin) minend.mixins.json:itemevents: Super class 'net.minecraft.entity.ItemEntity' of itemevents was not found in the hierarchy of target class 'net/minecraft/entity/ItemEntity'
org.spongepowered.asm.mixin.transformer.throwables.InvalidMixinException: Super class 'net.minecraft.entity.ItemEntity' of itemevents was not found in the hierarchy of target class 'net/minecraft/entity/ItemEntity'
Upvotes: 0
Views: 2390
Reputation: 4908
There is multiple ways to do it:
You can fix it by extends Entity
instead of ItemEntity
.
For example, AnimalEntity
can solve your issue.
Finally, if for example you need to get entity's stack, you can thos like that:
public ItemStack getStack(){
return ((ItemEntity) this).getStack();
}
Upvotes: 1