- 106
- 3
- 7
Привет, делаю моба с текстурой из конструктора, но в игре отображается почему то только текстура заданная в поле texture
Код из энтити: поле, конструктор и метод получения текстуры
Код из рендера:
Запись в нбт:
Вот что получается если вывести в консоль название текстуры, 0002 это из поля, 0007 требуемая. Получается нужная текстура есть только на сервере, а в главном потоке ее почему то нет:
Код спавна:
Как синхронить сервер с главным потоком?
Код из энтити: поле, конструктор и метод получения текстуры
Код:
protected ResourceLocation texture = new ResourceLocation("dm:textures/entity/skins/skin0002.png");
public EntityCorpse(World worldIn, BlockPos pos, String texture) {
super(worldIn);
this.setPosition(pos.getX(), pos.getY(), pos.getZ());
this.texture = new ResourceLocation(Reference.MODID, "dm:textures/entity/skins/"+ texture + ".png");
}
public ResourceLocation getSkinTexture() {
return texture;
}
Код из рендера:
Код:
@Nonnull
protected ResourceLocation getEntityTexture(@Nonnull EntityCorpse corpse) {
return corpse.getSkinTexture();
}
Запись в нбт:
Код:
@Override
public void writeEntityToNBT(NBTTagCompound compound) {
super.writeEntityToNBT(compound);
compound.setString("skinVariant", texture.getResourcePath());
}
@Override
public void readEntityFromNBT(NBTTagCompound compound) {
super.readEntityFromNBT(compound);
this.texture = new ResourceLocation(Reference.MODID, compound.getString("skinVariant"));
}
Вот что получается если вывести в консоль название текстуры, 0002 это из поля, 0007 требуемая. Получается нужная текстура есть только на сервере, а в главном потоке ее почему то нет:
Код:
[14:36:57] [main/INFO] [STDOUT]: [com.dretha.drethamod.entity.human.EntityCorpse:processInteract:44]: textures/entity/skins/skin0002.png
[14:36:57] [main/INFO] [STDOUT]: [com.dretha.drethamod.entity.human.EntityCorpse:processInteract:44]: textures/entity/skins/skin0002.png
[14:36:57] [Server thread/INFO] [STDOUT]: [com.dretha.drethamod.entity.human.EntityCorpse:processInteract:44]: dm:textures/entity/skins/skin0007.png
[14:36:57] [Server thread/INFO] [STDOUT]: [com.dretha.drethamod.entity.human.EntityCorpse:processInteract:44]: dm:textures/entity/skins/skin0007.png
Код спавна:
Код:
EntityCorpse corpse = new EntityCorpse(world, this.getPosition(), skin_variant);
if (!world.isRemote)
world.spawnEntity(corpse);
Как синхронить сервер с главным потоком?