Posted November 20, 20222 yr I'm trying to create an entity that extends Entity class. I can collide with it, but can't hit or interact with RMB. What is the problem? public class ReliquaryEntity extends Entity { public ReliquaryEntity(PlayMessages.SpawnEntity message, Level level) { this(LumecoreMod.Entities.RELIQUARY.get(), level); } public ReliquaryEntity(EntityType<?> type, Level level) { super(type, level); this.blocksBuilding = true; } @Override public @NotNull Packet<?> getAddEntityPacket() { return NetworkHooks.getEntitySpawningPacket(this); } @Override public void defineSynchedData() { } @Override public void readAdditionalSaveData(@NotNull CompoundTag data) { } @Override public void addAdditionalSaveData(@NotNull CompoundTag data) { } @Override public boolean canBeCollidedWith() { return true; } @Override public boolean isPushable() { return true; } @Override public @NotNull InteractionResult interact(Player player, InteractionHand hand) { System.out.println(1); this.kill(); return InteractionResult.SUCCESS; } } public static class Entities { public static final DeferredRegister<EntityType<?>> ENTITY_TYPES = DeferredRegister.create(ForgeRegistries.ENTITY_TYPES, MODID); public static final RegistryObject<EntityType<ReliquaryEntity>> RELIQUARY = register("reliquary", EntityType.Builder.<ReliquaryEntity>of(ReliquaryEntity::new, MobCategory.MISC).setShouldReceiveVelocityUpdates(true) .setTrackingRange(64).setUpdateInterval(3).fireImmune().sized(0.6f, 1.8f)); private static <T extends Entity> RegistryObject<EntityType<T>> register(String name, EntityType.Builder<T> entityTypeBuilder) { return ENTITY_TYPES.register(name, () -> entityTypeBuilder.build(name)); } } Edited November 20, 20222 yr by FoxBox
November 20, 20222 yr Entity.isPickable() controls whether a ray trace can target your entity. Boilerplate: If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one. If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install Large files should be posted to a file sharing site like https://gist.github.com You should also read the support forum sticky post.
November 20, 20222 yr Author 9 hours ago, warjort said: Entity.isPickable() controls whether a ray trace can target your entity. Thanks! Also, is everything okay with my registration code? What confuses me is that I have to specify the mob category for a non-living entity. I didn't find any other way to register, only EntityType.Builder
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.