This site works best with JavaScript enabled. Please enable JavaScript to get the best experience from this site.
im trying to make ranged weapons and have a few problems:
1: im getting an error in my entity registry saying that the second DeferredRegister has private access:
public static final DeferredRegister<EntityType<?>> ENTITIES = new DeferredRegister(ForgeRegistries.ENTITIES, MOD_ID); 2. how do i add sound to a projectile when fired? 3. how would i add an ammo counter or "clip" to a weapon? you know like only 6 shots then reload kind of thing
fixed the first one needed to remove new and add .create to deferred register
For it to make a sound then in the item class you would add:
{ public ActionResult<ItemStack> onItemRightClick(World itemStackIn, EntityPlayer worldIn, EnumHand playerIn) { ItemStack itemstack = worldIn.getHeldItem(playerIn); if (!worldIn.capabilities.isCreativeMode) { itemstack.shrink(1); } itemStackIn.playSound((EntityPlayer)null, worldIn.posX, worldIn.posY, worldIn.posZ, SoundEvents.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.4F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
This is for 1.12.2 though.
You can add this on your item where it is registered to change the maximum size for the stack in each individual slot:
.setMaxStackSize(64)
How did you get the first thing to work where you registered the entity with the deferred register? I haven't been able to solve this though.
im trying to make ranged weapons and have a few problems:
1: im getting an error in my entity registry saying that the second DeferredRegister has private access:
fixed the first one needed to remove new and add .create to deferred register
For it to make a sound then in the item class you would add:
This is for 1.12.2 though.
You can add this on your item where it is registered to change the maximum size for the stack in each individual slot:
How did you get the first thing to work where you registered the entity with the deferred register? I haven't been able to solve this though.