Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

robert135

Members
  • Joined

  • Last visited

  1. ok i got it working now. thanks for the help!
  2. i changed some stuff and now its a pig. if anyone has experienced the same thing pls help
  3. public class StickOfDynamiteEntity extends ProjectileItemEntity{ public StickOfDynamiteEntity(EntityType<? extends ProjectileItemEntity> stickOfDynamiteEntity, World worldIn) { super(stickOfDynamiteEntity, worldIn); } public StickOfDynamiteEntity(EntityType<? extends ProjectileItemEntity> type, double x, double y, double z, World worldIn) { super(type, x, y, z, worldIn); // TODO Auto-generated constructor stub } public StickOfDynamiteEntity(EntityType<? extends ProjectileItemEntity> type, LivingEntity throwerIn, World worldIn) { super(type, throwerIn, worldIn); } public StickOfDynamiteEntity(LivingEntity throwerIn, World worldIn) { super(ModEntityTypes.STICK_OF_DYNAMITE.get(), throwerIn, worldIn); } @Override protected Item getDefaultItem() { // TODO Auto-generated method stub return ItemInit.STICK_OF_DYNAMITE; } @OnlyIn(Dist.CLIENT) public ItemStack getItem() { ItemStack itemstack = this.func_213882_k(); return itemstack.isEmpty() ? new ItemStack(this.getDefaultItem()) : itemstack; } @Override protected void onImpact(RayTraceResult result) { // TODO Auto-generated method stub double x = result.getHitVec().getX(); double y = result.getHitVec().getY(); double z = result.getHitVec().getZ(); this.getEntityWorld().createExplosion(this, DamageSource.GENERIC, x, y, z, 1.5F, false, Explosion.Mode.BREAK); this.remove(); } } Im making a throwable item and it is working, all except for the fact that it is not appearing visually when thrown. I have already looked through how snowballls work and i have based my code off of that. I have determined that when i change ModEntityTypes.STICK_OF_DYNAMITE.get() to EntityType.SNOWBALL it goes from being invisible to being a snowball (the snow ball still explodes on impact like i want it to, but it looks like a snowball). can someone please help me to determine how to get it to appear as my custom texture? heres the item class: public class StickOfDynamiteItem extends Item { public StickOfDynamiteItem(Properties properties) { super(properties); } public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) { ItemStack itemstack = playerIn.getHeldItem(handIn); worldIn.playSound((PlayerEntity)null, playerIn.getPosX(), playerIn.getPosY(), playerIn.getPosZ(), SoundEvents.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (random.nextFloat() * 0.4F + 0.8F)); if (!worldIn.isRemote) { StickOfDynamiteEntity dynamiteEntity = new StickOfDynamiteEntity(playerIn, worldIn); dynamiteEntity.setItem(itemstack); dynamiteEntity.setInvisible(false); dynamiteEntity.shoot(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 1.5F, 1.0F); worldIn.addEntity(dynamiteEntity); } if (!playerIn.abilities.isCreativeMode) { itemstack.shrink(1); } return ActionResult.resultSuccess(itemstack); } } and heres the ModEntityTypes class where i made the registry object for the entity: public class ModEntityTypes { public static final DeferredRegister<EntityType<?>> ENTITY_TYPES = new DeferredRegister<>(ForgeRegistries.ENTITIES, Battle.MOD_ID); public static final RegistryObject<EntityType<StickOfDynamiteEntity>> STICK_OF_DYNAMITE = ENTITY_TYPES.register("stick_of_dynamite", () -> EntityType.Builder.<StickOfDynamiteEntity>create(StickOfDynamiteEntity::new, EntityClassification.MISC).size(.25F, .25F).build(new ResourceLocation(Battle.MOD_ID, "stick_of_dynamite").toString())); }
  4. robert135 joined the community
  5. im working on a similar thing. if you do super(ModEntityType.SHURIKEN_ENTITY.get(), throwerIn, worldIn); instead of super(ModEntityType.SHURIKEN_ENTITY, throwerIn, worldIn); it should work

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.