Posted November 26, 20186 yr so i have a dragon gui inventroy where you can open the dragon and put the banner on it, it will render on the body, the problem is that it disappears after i quit the world and i need to reopen the inventory again, i use ItemRenderer.renderItem https://pastebin.com/AEcjLJsd Edited November 26, 20186 yr by TheRPGAdventurer
November 26, 20186 yr You need to sync the inventory when the entity is spawned on the client About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)
November 26, 20186 yr 2 hours ago, TheRPGAdventurer said: how? Packets or the DataManager thing for entities. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
January 3, 20196 yr Author On 11/26/2018 at 11:56 PM, Animefan8888 said: Packets or the DataManager thing for entities. elaborate please?
January 3, 20196 yr 28 minutes ago, TheRPGAdventurer said: elaborate please? DataManager is the standard (vanilla) way for entities to sync server-side data to the client-side entity. Modded entities can use it too, and it's not too difficult. As an example of an entity that sync's an ItemStack, see the vanilla EntityItemFrame and its ITEM field. In summary: Declare a static final DataParameter<T> field in your entity (T would be ItemStack in this case) Override entityInit() to register that field with getDataManager().register(field, defaultValue) To sync the data, use getDataManager.set(field, value). It will automatically sync to the client on the next tick On the client side, use getDataManager.get(field). You can optionally also override notifyDataManagerChange(DataParameter<?>), which is called both client- and server-side (so check world.isRemote) when any data parameter is changed. This could be used to cache values, for example, or carry out some computation you wouldn't want to do every tick. Edited January 3, 20196 yr by desht
January 4, 20196 yr Author should i write and read it on the nbt aswell? or straight up make a setter or getter, i registered it in entityInit private static final DataParameter<ItemStack> BANNER1 = EntityDataManager .<ItemStack>createKey(EntityTameableDragon.class, DataSerializers.ITEM_STACK); private static final DataParameter<ItemStack> BANNER2 = EntityDataManager .<ItemStack>createKey(EntityTameableDragon.class, DataSerializers.ITEM_STACK); private static final DataParameter<ItemStack> BANNER3 = EntityDataManager .<ItemStack>createKey(EntityTameableDragon.class, DataSerializers.ITEM_STACK); private static final DataParameter<ItemStack> BANNER4 = EntityDataManager .<ItemStack>createKey(EntityTameableDragon.class, DataSerializers.ITEM_STACK);
January 4, 20196 yr Reading/writing NBT is a separate concern from sync'ing data to the client. If your banner items need to persist across world/server restarts, then yes - you need to serialize them to NBT. But that has nothing to do with sync'ing the banner items so the client can see them. As for getters/setters, it's valid to have such accessors simply forward to getDataManager.get() or .set(). That also has nothing to do with NBT serialization, though.
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.