I'm trying to make a musket, but while working on the loading logic I ran into some trouble - the item gets used in a loop, making onPlayerStoppedUsing get called with a bad time left in the use. Since I based my code on the Crossbow, I tried to subclass the Crossbow directly to see if I was doing something wrong. But I can't subclass a crossbow and still get the same loading behaviour as a crossbow - here's my code for the subclassed crossbow:
package ca.zootron.totalwar.common.item;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.CrossbowItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.world.World;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class MyCrossbow extends CrossbowItem {
private static final Logger LOGGER = LogManager.getLogger();
public MyCrossbow(Properties propertiesIn) {
super(propertiesIn);
}
@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) {
LOGGER.debug("MyCrossbow#onItemRightClick");
return super.onItemRightClick(worldIn, playerIn, handIn);
}
}
Why does this not have the same behaviour as a normal crossbow?