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.

Featured Replies

Posted

I am making a custom fireball projectile entity.  Everything seems to be working except I don't see the projectile in flight - it is not being rendered.  It seems to be following the correct flight path and the explosion occurs at the correct time and place, but I don't see the projectile.

 

@EventBusSubscriber(modid = GearProgression.MOD_ID, bus = EventBusSubscriber.Bus.MOD)
public class ClientModEventSubscriber {
    // Directly reference a log4j logger.
    private static final Logger LOGGER = LogManager.getLogger();

    @SubscribeEvent
    public static void onFMLClientSetupEvent(final FMLClientSetupEvent event) {
    	RenderingRegistry.registerEntityRenderingHandler(RubyFireballEntity.class,
    			new IRenderFactory<RubyFireballEntity>()
    			{
    			  @Override
    			  public EntityRenderer<? super RubyFireballEntity> createRenderFor(EntityRendererManager manager)
    			  {
    			  	return new SpriteRenderer<RubyFireballEntity>(manager, Minecraft.getInstance().getItemRenderer());
    			  }
    			});

    	LOGGER.debug("Registered Renderers");
    }
}

 

public class GearEntityTypes {
	public static final DeferredRegister<EntityType<?>> ENTITIES = new DeferredRegister<>(ForgeRegistries.ENTITIES, GearProgression.MOD_ID);

	public static final RegistryObject<EntityType<RubyFireballEntity>> RUBY_FIREBALL = ENTITIES.register("ruby_fireball", () -> EntityType.Builder.create(RubyFireballEntity::new, EntityClassification.MISC).size(0.6F, 0.6F).build("ruby_fireball"));
}

 

public class RubyFireballEntity extends AbstractFireballEntity {
	
	public RubyFireballEntity(EntityType<? extends RubyFireballEntity> type, World worldIn) {
		super(type, worldIn);
	}

	public void shoot(LivingEntity shooter, double accelX, double accelY, double accelZ) {
		this.shootingEntity = shooter;
		this.setLocationAndAngles(shooter.posX, shooter.posY, shooter.posZ, shooter.rotationYaw, shooter.rotationPitch);
		this.setPosition(this.posX, this.posY, this.posZ);
		this.setMotion(Vec3d.ZERO);
		double d0 = (double)MathHelper.sqrt(accelX * accelX + accelY * accelY + accelZ * accelZ);
		this.accelerationX = accelX / d0 * 0.1D;
		this.accelerationY = accelY / d0 * 0.1D;
		this.accelerationZ = accelZ / d0 * 0.1D;
	}

	protected void onImpact(RayTraceResult result) {
		if (!this.world.isRemote) {
			if (result.getType() == RayTraceResult.Type.ENTITY) {
				Entity entity = ((EntityRayTraceResult)result).getEntity();
				if (!entity.isImmuneToFire()) {
					int i = entity.func_223314_ad();
					entity.setFire(5);
					boolean flag = entity.attackEntityFrom(DamageSource.causeFireballDamage(this, this.shootingEntity), 6.0F);
					if (flag) {
						this.applyEnchantments(this.shootingEntity, entity);
					} else {
						entity.func_223308_g(i);
					}
				}
			}
			this.world.createExplosion((Entity)null, this.posX, this.posY, this.posZ, 1.0F, false, Explosion.Mode.NONE);
			this.remove();
		}
	}

	public boolean canBeCollidedWith() {
		return false;
	}

	public boolean attackEntityFrom(DamageSource source, float amount) {
		return false;
	}
}

 

9 hours ago, rcrosbyti said:

RenderingRegistry.registerEntityRenderingHandler(RubyFireballEntity.class, new IRenderFactory<RubyFireballEntity>() { @Override public EntityRenderer<? super RubyFireballEntity> createRenderFor(EntityRendererManager manager) { return new SpriteRenderer<RubyFireballEntity>(manager, Minecraft.getInstance().getItemRenderer()); } });

You can use a lambda for this


Also, use @Override

https://stackoverflow.com/questions/94361/when-do-you-use-javas-override-annotation-and-why

 

Your subscription looks right, place a breakpoint to make sure it gets called though. 

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

  • rcrosbyti changed the title to [SOLVED][1.14.4] Projectile entity not being rendered

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

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.