• Recently Browsing

    No registered users viewing this page.

  • Posts

    • This doesn't make sense. Either assign the field yourself or use @ObjectHolder, not both. If you do assign it yourself, do not do it in a static initializer.   You are already using DeferredRegister to register your entities...?   Also do not use @OnlyIn.
    • This could be possible as my entity is invisible 😅 Here is my entity class: @ObjectHolder(DeepAffection.modid) public class HeartEntity extends ProjectileItemEntity { @ObjectHolder("heart_entity") public static final EntityType<HeartEntity> HEART = RegistryHandler.HEART_ENTITY.get(); @OnlyIn(Dist.CLIENT) public HeartEntity(double x, double y, double z, World worldIn) { super(HeartEntity.HEART, x, y, z, worldIn); } protected HeartEntity(LivingEntity livingEntityIn, World worldIn) { super(HeartEntity.HEART, livingEntityIn, worldIn); } public HeartEntity(FMLPlayMessages.SpawnEntity packet, World world) { super(HeartEntity.HEART, world); } @Override public IPacket<?> createSpawnPacket() { return NetworkHooks.getEntitySpawningPacket(this); } @Override protected void onImpact(RayTraceResult result) { if (result instanceof EntityRayTraceResult) { EntityRayTraceResult entityRayTraceResult = (EntityRayTraceResult) result; if(entityRayTraceResult.getEntity() instanceof AnimalEntity) { MobEntity entity = (MobEntity) entityRayTraceResult.getEntity(); entity.addPotionEffect(new EffectInstance(Effects.REGENERATION,100,2)); this.remove(); } else if(entityRayTraceResult.getEntity() instanceof PlayerEntity) { PlayerEntity entity = (PlayerEntity) entityRayTraceResult.getEntity(); entity.addPotionEffect(new EffectInstance(Effects.REGENERATION,100,2)); this.remove(); }else if(entityRayTraceResult.getEntity() instanceof MonsterEntity) { MobEntity entity = (MobEntity) entityRayTraceResult.getEntity(); entity.addPotionEffect(new EffectInstance(Effects.SLOWNESS,100,10)); this.remove(); } } else if (result instanceof BlockRayTraceResult) { BlockRayTraceResult blockRayTraceResult = (BlockRayTraceResult) result; World world = this.world; Block block = world.getBlockState(blockRayTraceResult.getPos()).getBlock(); if(block == Blocks.GRASS_BLOCK) { world.setBlockState(blockRayTraceResult.getPos(), BlockList.pink_grass_block.getDefaultState()); Vec3d vec = blockRayTraceResult.getHitVec(); double x = vec.getX(); double y = vec.getY(); double z = vec.getZ(); this.setMotion(x,y,z); this.remove(); } Vec3d vec = blockRayTraceResult.getHitVec(); double x = vec.getX(); double y = vec.getY(); double z = vec.getZ(); this.setMotion(x,y,z); this.remove(); } } public void tick() { super.tick(); if(!this.world.isRemote) { Vec3d vec3d = this.getMotion(); double d0 = this.getPosX() + vec3d.x; double d1 = this.getPosY() + vec3d.y; double d2 = this.getPosZ() + vec3d.z; this.world.addParticle(ParticleTypes.HEART, d0 - vec3d.x * 0.25D, d1 - vec3d.y * 0.25D, d2 - vec3d.z * 0.25D, vec3d.x, vec3d.y, vec3d.z); } } @Override protected Item getDefaultItem() { return ItemList.heart; } }   And my registration code: public class RegistryHandler { public static final DeferredRegister<EntityType<?>> ENTITY_TYPES = new DeferredRegister<>(ForgeRegistries.ENTITIES, DeepAffection.modid); public static void init(){ ENTITY_TYPES.register(FMLJavaModLoadingContext.get().getModEventBus()); } public static final RegistryObject<EntityType<HeartEntity>> HEART_ENTITY = ENTITY_TYPES.register("heart_entity", () -> EntityType.Builder.<HeartEntity>create(EntityClassification.MISC).size(0.5F, 0.5F).build("heart_entity")); }   And this could also be relevant: @Mod("deepaffection") public class DeepAffection { public static DeepAffection instance; public static final String modid = "deepaffection"; private static final Logger Logger = LogManager.getLogger(modid); public static final ItemGroup group = new DeepAffectionItemGroup(); public DeepAffection() { instance = this; FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientRegistries); RegistryHandler.init(); MinecraftForge.EVENT_BUS.register(this); } private void clientRegistries(final FMLClientSetupEvent event) { DeepAffectionRenderRegistry.registryEntityRenders(); DeepAffectionItemRender.render(); Logger.info("clientRegistries method registred."); } ... @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD) public static class RegistryEvents{ ... @SubscribeEvent public void registerEntities(final RegistryEvent.Register<EntityType<?>> event) { event.getRegistry().registerAll ( HeartEntity.HEART ); Logger.info("Entities registred."); } }   And for completeness my renderer for the entity: @OnlyIn(Dist.CLIENT) public class DeepAffectionRenderRegistry { public static void registryEntityRenders() { final Logger logger = LogManager.getLogger(DeepAffection.modid); RenderingRegistry.registerEntityRenderingHandler(RegistryHandler.HEART_ENTITY.get(), renderManager -> new SpriteRenderer<HeartEntity>(renderManager, Minecraft.getInstance().getItemRenderer())); logger.info("Entity render registerd."); } }  
    • 1.12 is no longer supported on this forum. Please update to a modern version of Minecraft to receive support.
    • HarryTalks has no idea what he's talking about.   Your entity is most likely not spawned on the client because it is not registered correctly. Post your entire entity class and your registration code.
    • 1.12 is no longer supported on this forum. Please update to a modern version of Minecraft to receive support.
  • Topics

  • Who's Online (See full list)