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

So i've been updating my mod to 1.13.2, and i'm having some issues with either the Entity/EntityType registration process, or it's some other related issue.

I have some custom arrow entities, and this is how i create the EntityTypes:

 

public static final EntityType<EntitySittableBlock> SITTABLE_BLOCK;
	public static final EntityType<EntityExplodingArrow> EXPLODING_ARROW;
	public static final EntityType<EntityDiamondArrow> DIAMOND_ARROW;
	public static final EntityType<EntityEmeraldArrow> EMERALD_ARROW;
	public static final EntityType<EntityObsidianArrow> OBSIDIAN_ARROW;
	public static final EntityType<EntityGoldArrow> GOLD_ARROW;

	static
	{
		SITTABLE_BLOCK = createEntityType("sittable_block", EntitySittableBlock.class, EntitySittableBlock::new, 64, 1, false);
		EXPLODING_ARROW = createEntityType("exploding_arrow", EntityExplodingArrow.class, EntityExplodingArrow::new, 64, 1, true);
		DIAMOND_ARROW = createEntityType("diamond_arrow", EntityDiamondArrow.class, EntityDiamondArrow::new, 64, 1, true);
		EMERALD_ARROW = createEntityType("emerald_arrow", EntityEmeraldArrow.class, EntityEmeraldArrow::new, 64, 1, true);
		OBSIDIAN_ARROW = createEntityType("obsidian_arrow", EntityObsidianArrow.class, EntityObsidianArrow::new, 64, 1, true);
		GOLD_ARROW = createEntityType("gold_arrow", EntityGoldArrow.class, EntityGoldArrow::new, 64, 1, true);
	}

	private static <T extends Entity> EntityType<T> createEntityType(String id, Class<? extends T> entityClass, Function<? super World, ? extends T> factory, int range, int updateFrequency, boolean sendsVelocityUpdates)
	{
		EntityType<T> type = EntityType.Builder.create(entityClass, factory).tracker(range, updateFrequency, sendsVelocityUpdates).build(Constants.MODID + ":" + id);
		type.setRegistryName(new ResourceLocation(Constants.MODID, id));
		return type;
	}

	public static void register()
	{
		RegistryHandler.EntityTypes.add(SITTABLE_BLOCK);
		RegistryHandler.EntityTypes.add(EXPLODING_ARROW);
		RegistryHandler.EntityTypes.add(DIAMOND_ARROW);
		RegistryHandler.EntityTypes.add(EMERALD_ARROW);
		RegistryHandler.EntityTypes.add(OBSIDIAN_ARROW);
		RegistryHandler.EntityTypes.add(GOLD_ARROW);
	}

(The "register" method actually just inserts the types into a List in the RegistryHandler.EntityTypes class).

 

And then i use:

@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
	public static class EntityTypes
	{
		private static final List<EntityType<?>> ENTITY_TYPES = new LinkedList<>();

		public static <T extends Entity> void add(EntityType<T> type)
		{
			ENTITY_TYPES.add(type);
		}

		public static List<EntityType<?>> getEntityTypes()
		{
			return Collections.unmodifiableList(ENTITY_TYPES);
		}

		@SubscribeEvent
		public static void registerEntityTypes(final RegistryEvent.Register<EntityType<?>> event)
		{
			MEEntityTypes.register();
			ENTITY_TYPES.forEach(entityType -> event.getRegistry().register(entityType));
		}
	}

 

to actually register the types to the RegistryEvent.Register event.

 

However, whenever i try to fire one of the arrows, i get this error:

Spoiler

[05Mar2019 07:15:41.884] [Server thread/ERROR] [net.minecraft.entity.EntityTracker/]: "Silently" catching entity tracking error.
net.minecraft.crash.ReportedException: Adding entity to track
    at net.minecraft.entity.EntityTracker.track(EntityTracker.java:179) ~[?:?]
    at net.minecraft.entity.EntityTracker.track(EntityTracker.java:90) ~[?:?]
    at net.minecraft.world.ServerWorldEventHandler.onEntityAdded(SourceFile:42) ~[?:?]
    at net.minecraft.world.World.onEntityAdded(World.java:820) ~[?:?]
    at net.minecraft.world.WorldServer.onEntityAdded(WorldServer.java:780) ~[?:?]
    at net.minecraft.world.World.spawnEntity(World.java:813) ~[?:?]
    at net.minecraft.world.WorldServer.spawnEntity(WorldServer.java:740) ~[?:?]
    at com.nmg.me.item.MEItemBow.onPlayerStoppedUsing(MEItemBow.java:120) ~[?:?]
    at net.minecraft.item.ItemStack.onPlayerStoppedUsing(ItemStack.java:423) ~[?:?]
    at net.minecraft.entity.EntityLivingBase.stopActiveHand(EntityLivingBase.java:2320) ~[?:?]
    at net.minecraft.network.NetHandlerPlayServer.processPlayerDigging(NetHandlerPlayServer.java:794) ~[?:?]
    at net.minecraft.network.play.client.CPacketPlayerDigging.processPacket(SourceFile:40) ~[?:?]
    at net.minecraft.network.play.client.CPacketPlayerDigging.processPacket(SourceFile:10) ~[?:?]
    at net.minecraft.network.PacketThreadUtil.func_210405_a(SourceFile:10) ~[?:?]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_191]
    at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266) [?:1.8.0_191]
    at java.util.concurrent.FutureTask.run(FutureTask.java) [?:1.8.0_191]
    at net.minecraft.util.Util.runTask(SourceFile:199) [?:?]
    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:715) [?:?]
    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:669) [?:?]
    at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:115) [?:?]
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:565) [?:?]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_191]
Caused by: java.lang.IllegalArgumentException: Don't know how to add class com.nmg.me.entity.projectile.EntityObsidianArrow!
    at net.minecraft.entity.EntityTrackerEntry.createSpawnPacket(EntityTrackerEntry.java:508) ~[?:?]
    at net.minecraft.entity.EntityTrackerEntry.updatePlayerEntity(EntityTrackerEntry.java:318) ~[?:?]
    at net.minecraft.entity.EntityTrackerEntry.updatePlayers(EntityTrackerEntry.java:403) ~[?:?]
    at net.minecraft.entity.EntityTracker.track(EntityTracker.java:162) ~[?:?]
    ... 22 more

I've can't figure out how to fix this, since i don't even know what it means, so any help would be appreciated ?

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.