Jump to content

Recommended Posts

Posted

I am trying to create a throwable object just like the snowball and was successfull with creating an item and the projectile entity as well as throwing it, referencing to the snowball. But I can not get my flying entity to be rendered.

The minecraft snowball seems to be rendered with a SpriteRenderer that seems to be made for things like the ProjectileItemEntity.

 

Here is my code to register the EntityType, renderer the render itself and the Entity class
As far as I can see I did everything like the snowball does except for the extra constructor in the renderer which is needed for registration.

In addition I figured out that no method of the renderer except for the constructor is ever called, but I can summon the entity and it flies and hits things but is just invisibile.

Has anyone an Idea what I am missing?

 

	public static final DeferredRegister<EntityType<?>> ENTITYTYPES = new DeferredRegister<>(ForgeRegistries.ENTITIES,
			MODID);
	
	public static final RegistryObject<EntityType<MelonShardEntity>> MELONSHARD_ENTITY = ENTITYTYPES
			.register("melonshardentity",
					() -> EntityType.Builder
							.<MelonShardEntity>create(MelonShardEntity::new, EntityClassification.MISC)
							.size(0.25f, 0.25f).build(new ResourceLocation(MODID + ":melonshardentity").toString()));

 

public void doClientSetup(final FMLClientSetupEvent event) {
		
		RenderingRegistry.registerEntityRenderingHandler(MelonShardEntity.class, MelonshardRenderer::new);
		
}

 

public class MelonShardEntity extends ProjectileItemEntity {

	public static final int DAMAGE = 1000;

	public MelonShardEntity(EntityType<? extends MelonShardEntity> p_i50159_1_, World p_i50159_2_) {
		super(p_i50159_1_, p_i50159_2_);
	}

	public MelonShardEntity(World worldIn, LivingEntity throwerIn) {
		super(learnMod.MELONSHARD_ENTITY.get(), throwerIn, worldIn);
	}

	public MelonShardEntity(World worldIn, double x, double y, double z) {
		super(learnMod.MELONSHARD_ENTITY.get(), x, y, z, worldIn);
	}

	@Override
	protected Item func_213885_i() {

		return learnMod.MELON_SHARD;
	}
	
	@Override
	protected void onImpact(RayTraceResult result) {

		if (result.getType() == RayTraceResult.Type.ENTITY) {

			Entity entity = ((EntityRayTraceResult) result).getEntity();

			entity.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), (float) DAMAGE);
		}

		if (!this.world.isRemote) {
			this.world.setEntityState(this, (byte) 3);
			this.remove();
		}
	}
}

 

@OnlyIn(Dist.CLIENT)
public class MelonshardRenderer extends SpriteRenderer<MelonShardEntity> {

	public MelonshardRenderer(EntityRendererManager p_i50957_1) {
		super(p_i50957_1,Minecraft.getInstance().getItemRenderer());
	}

	public MelonshardRenderer(EntityRendererManager p_i50957_1_, ItemRenderer p_i50957_2_) {
		super(p_i50957_1_,p_i50957_2_);

	}
}

 

Posted

Wow ok 1 day of search. Thank you very much, but is this requirement new or relativly new? Was just asking because in every turorial I watched no one did that and it worked just fine.

Since the readthedocs documentation does not cover entitys as a whole thing I had to rely on those videos. 

Posted

Hm ok this is pretty interesting since I watched what felt like  thousands of videos of the same thing to make sure not one of them just missed something and this was never mentioned or written. And one last thing I was not able to find a error logentry is there non (would be very helpful for others like me :) ) or did I just missed it?

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Thanks, I've now installed a slightly newer version and the server is at least starting up now.
    • i have the same issue. Found 1 Create mod class dependency(ies) in createdeco-1.3.3-1.19.2.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Found 11 Create mod class dependency(ies) in createaddition-fabric+1.19.2-20230723a.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Detailed walkthrough of mods which rely on missing Create mod classes: Mod: createaddition-fabric+1.19.2-20230723a.jar Missing classes of create: com/simibubi/create/compat/jei/category/sequencedAssembly/JeiSequencedAssemblySubCategory com/simibubi/create/compat/recipeViewerCommon/SequencedAssemblySubCategoryType com/simibubi/create/compat/rei/CreateREI com/simibubi/create/compat/rei/EmptyBackground com/simibubi/create/compat/rei/ItemIcon com/simibubi/create/compat/rei/category/CreateRecipeCategory com/simibubi/create/compat/rei/category/WidgetUtil com/simibubi/create/compat/rei/category/animations/AnimatedBlazeBurner com/simibubi/create/compat/rei/category/animations/AnimatedKinetics com/simibubi/create/compat/rei/category/sequencedAssembly/ReiSequencedAssemblySubCategory com/simibubi/create/compat/rei/display/CreateDisplay Mod: createdeco-1.3.3-1.19.2.jar Missing classes of create: com/simibubi/create/content/kinetics/fan/SplashingRecipe
    • The crash points to moonlight lib - try other builds or make a test without this mod and the mods requiring it
    • Do you have shaders enabled? There is an issue with the mod simpleclouds - remove this mod or disable shaders, if enabled  
    • Maybe you need to create file in assets/<modid>/items/<itemname>.json with content like this:   { "model": { "type": "minecraft:model", "model": "modname:item/itemname" } }  
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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