[1.11] /minetweaker entities - doesn't list entities from mods.
See original GitHub issueIssue 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
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:
- Created 6 years ago
- Comments:18 (7 by maintainers)
Top GitHub Comments
@jaredlll08, Found the issue. It is MTLib. Tested with:
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.
@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 aMineTweakerAPI.game.getEntities()
call. And sinceMCGame.ENTITY_DEFINITIONS
is empty at that moment, it takes all entities fromForgeRegistries.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 getENTITY_DEFINITIONS
list and clear it). Is to callMCGame.getEntity()
with the name of an entity from the mod. Because it refreshesENTITY_DEFINITIONS
. But it’s not really a good way.So there is three (four?) ways I can suggest to fix this:
MCGame.getEntities()
method to always get entities fromForgeRegistry
. Or at least make a simple check. If the sizes of lists are different, refreshENTITY_DEFINITIONS
. As I understand mods just adding Entities, not removing them, so there should not be any problems with this code then.MCGame.ENTITY_DEFINITIONS
(And tell every person who makes addons for CraftTweaker to use it).preInit()
stuff from MTLib.ReflectionHelper
to getENTITY_DEFINITIONS
and clear it. (And tell every person who makes addons for CraftTweaker to use it)