question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[1.11] /minetweaker entities - doesn't list entities from mods.

See original GitHub issue

Issue Description:

I installed a few mods. Tinkers Construct, for example, Forestry, e.t.c. I’m trying to get all entities that are exist in the game. I type “/minetweaker entities”.

What happens:

In the minetweaker.log file I see only an entities from vanilla.

What you expected to happen:

I expected to see all entities from vanilla and mods, because this command refers to an “EntityList” which contains all entities, including mod’s entities. I didn’t delve in the source code too much, so maybe I’m mistaken. I just need to know, is this bug or that works like it was intended to.

Actually I don’t understand is there even support for an entities from other mods? In the ZenScript I write <entity:cow> And I get cow, that’s fine. But how to get an entity from other mod?

Script used

I used chat, not script.

Minetweaker.log file

https://pastebin.com/kWiXn5QJ


Affected Versions (Do not use “latest”):

  • Minecraft: 1.11.2
  • Forge: 1.11.2-13.20.1.2386
  • Crafttweaker: 1.11.2-3.0.26

Your most recent log file where the issue was present:

Already gave Minetweaker.log file.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:18 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
bookerthegeekcommented, Jul 20, 2017

@jaredlll08, Found the issue. It is MTLib. Tested with:

  • MTLib-2.0.3
  • CraftTweaker-1.11.2-3.0.26
  • CodeChickenLib-1.11.2-3.0.0.284-universal
  • CoFHCore-1.11.2-4.2.7.15-universal
  • ThermalExpansion-1.11.2-5.2.6.21-universal
  • ThermalFoundation-1.11.2-2.2.5.16-universal

If you have MTLib, you only get Vanilla entities. Without MTLib you also get modded entities. Hope that helps.


@rinart73 As a temp work around remove MTlib to get the entity list.

0reactions
rinart73commented, Jul 21, 2017

@jaredlll08 ok, I found the source of the problem on the MTLib’s side. This line

I think it’s because MTLib loads earlier than the most of the mods. And as I see it’s a good practice to add Blocks/Entities/Recipes in the preInit() method. So, MTLib forces CraftTweaker to reload before any other mod adds anything.

In the MineTweakerImplementationAPI.reload() we can see a MineTweakerAPI.game.getEntities() call. And since MCGame.ENTITY_DEFINITIONS is empty at that moment, it takes all entities from ForgeRegistries.ENTITIES and ‘caches’ them.

So, when everything is loaded MCGame.ENTITY_DEFINITIONS contains only vanilla Entities. And there is only one way to reload it (besides using a workaround - ReflectionHelper to get ENTITY_DEFINITIONS list and clear it). Is to call MCGame.getEntity() with the name of an entity from the mod. Because it refreshes ENTITY_DEFINITIONS. But it’s not really a good way.

So there is three (four?) ways I can suggest to fix this:

  1. Change the behavior of MCGame.getEntities() method to always get entities from ForgeRegistry. Or at least make a simple check. If the sizes of lists are different, refresh ENTITY_DEFINITIONS. As I understand mods just adding Entities, not removing them, so there should not be any problems with this code then.
  2. Add a method to refresh MCGame.ENTITY_DEFINITIONS (And tell every person who makes addons for CraftTweaker to use it).
  3. Remove preInit() stuff from MTLib.
  4. Use ReflectionHelper to get ENTITY_DEFINITIONS and clear it. (And tell every person who makes addons for CraftTweaker to use it)
Read more comments on GitHub >

github_iconTop Results From Across the Web

External Tweaker - Mods - Minecraft - CurseForge
The program works with 1.7.10, 1.10.2, 1.11.2, and 1.12 though! ... Dynamically get a list of all recipe functions from the mods loaded!...
Read more >
[1.11] Get a list of all tile entities registered - Modder Support
I have two questions that I am stuck on. Question one: How do I get a list of all the tile entities that...
Read more >
Mod Conflict Item ID help? - Java Edition Support
Entity ID conflict. You'll need to go into your mod's config files, and change the conflicting entity ID (23) to a different id....
Read more >
List of Minecraft 1.11.2 Mods - 9minecraft.net
Born in a Barn Mod 1.12.2, 1.11.2 (Village Doors Doesn't Keep Chunks Loaded More) ... 1.11.2 adds Tesla support to all RF and...
Read more >
Changelog - Botania
If a vine ball entity can't place any vines where it hits, ... handler can now be registered (InfinityRaider); Revert logo in mod...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found