Jump to content

JHPrime

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by JHPrime

  1. Thanks, that worked! For future askers: The signature to override is public boolean isCrossbow(ItemStack stack) This needs to be overridden because Minecraft's Item class checks if an itemStack is a crossbow by asking if the stack's Item is the Crossbow.
  2. 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?
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.