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.

FeedokTV

Members
  • Joined

  • Last visited

  1. So, im trying to make updating system with id, first of all I wanted to see this id, but This is my handle code and error message @Override public void handle(UpdateCapPacket message, Supplier<NetworkEvent.Context> ctx) { if (ctx.get().getDirection().getReceptionSide() == LogicalSide.CLIENT) { ctx.get().enqueueWork(() -> { InfCust.LOGGER.error("[UPDATING CAP PACKET]"); InfCust.LOGGER.error(ctx.get().getSender().getId()); }); ctx.get().setPacketHandled(true); } } [23:12:09] [Render thread/FATAL] [minecraft/ThreadTaskExecutor]: Error executing task on Client java.lang.NullPointerException: null at net.minecraftforge.fml.LogicalSidedProvider.lambda$static$3(LogicalSidedProvider.java:33) ~[forge-1.16.5-36.2.29_mapped_official_1.16.5-recomp.jar:?] {re:classloading} at net.minecraftforge.fml.LogicalSidedProvider.get(LogicalSidedProvider.java:60) ~[forge-1.16.5-36.2.29_mapped_official_1.16.5-recomp.jar:?] {re:classloading} at net.minecraftforge.fml.network.PacketDistributor.getServer(PacketDistributor.java:264) ~[forge-1.16.5-36.2.29_mapped_official_1.16.5-recomp.jar:?] {re:classloading} at net.minecraftforge.fml.network.PacketDistributor.lambda$playerListAll$3(PacketDistributor.java:224) ~[forge-1.16.5-36.2.29_mapped_official_1.16.5-recomp.jar:?] {re:classloading} at net.minecraftforge.fml.network.PacketDistributor$PacketTarget.send(PacketDistributor.java:179) ~[forge-1.16.5-36.2.29_mapped_official_1.16.5-recomp.jar:?] {re:classloading} at net.minecraftforge.fml.network.simple.SimpleChannel.send(SimpleChannel.java:124) ~[forge-1.16.5-36.2.29_mapped_official_1.16.5-recomp.jar:?] {re:classloading} at com.feedoktv.infcust.common.core.networking.PacketDispatcher.sendToAll(PacketDispatcher.java:66) ~[main/:?] {re:classloading} at com.feedoktv.infcust.client.handlers.EventHandlerClient.OpenCustMenu(EventHandlerClient.java:82) ~[main/:?] {re:classloading} at com.feedoktv.infcust.common.core.networking.packets.OpenMainMenuPacket.lambda$handle$0(OpenMainMenuPacket.java:26) ~[main/:?] {re:classloading} at net.minecraftforge.fml.network.NetworkEvent$Context.enqueueWork(NetworkEvent.java:215) ~[forge-1.16.5-36.2.29_mapped_official_1.16.5-recomp.jar:?] {re:classloading} at com.feedoktv.infcust.common.core.networking.packets.OpenMainMenuPacket.handle(OpenMainMenuPacket.java:23) ~[main/:?] {re:classloading} at com.feedoktv.infcust.common.core.networking.packets.OpenMainMenuPacket.handle(OpenMainMenuPacket.java:10) ~[main/:?] {re:classloading} at net.minecraftforge.fml.network.simple.IndexedMessageCodec.lambda$tryDecode$3(IndexedMessageCodec.java:128) ~[forge-1.16.5-36.2.29_mapped_official_1.16.5-recomp.jar:?] {re:classloading} at java.util.Optional.ifPresent(Optional.java:159) ~[?:1.8.0_311] {} at net.minecraftforge.fml.network.simple.IndexedMessageCodec.tryDecode(IndexedMessageCodec.java:128) ~[forge-1.16.5-36.2.29_mapped_official_1.16.5-recomp.jar:?] {re:classloading} at net.minecraftforge.fml.network.simple.IndexedMessageCodec.consume(IndexedMessageCodec.java:162) ~[forge-1.16.5-36.2.29_mapped_official_1.16.5-recomp.jar:?] {re:classloading} at net.minecraftforge.fml.network.simple.SimpleChannel.networkEventListener(SimpleChannel.java:80) ~[forge-1.16.5-36.2.29_mapped_official_1.16.5-recomp.jar:?] {re:classloading} at net.minecraftforge.eventbus.EventBus.doCastFilter(EventBus.java:247) ~[eventbus-4.0.0.jar:?] {} at net.minecraftforge.eventbus.EventBus.lambda$addListener$11(EventBus.java:239) ~[eventbus-4.0.0.jar:?] {} at net.minecraftforge.eventbus.EventBus.post(EventBus.java:302) ~[eventbus-4.0.0.jar:?] {} at net.minecraftforge.eventbus.EventBus.post(EventBus.java:283) ~[eventbus-4.0.0.jar:?] {} at net.minecraftforge.fml.network.NetworkInstance.dispatch(NetworkInstance.java:86) ~[forge-1.16.5-36.2.29_mapped_official_1.16.5-recomp.jar:?] {re:classloading} at net.minecraftforge.fml.network.NetworkHooks.lambda$onCustomPayload$1(NetworkHooks.java:91) ~[forge-1.16.5-36.2.29_mapped_official_1.16.5-recomp.jar:?] {re:classloading} at java.util.Optional.map(Optional.java:215) ~[?:1.8.0_311] {} at net.minecraftforge.fml.network.NetworkHooks.onCustomPayload(NetworkHooks.java:91) ~[forge-1.16.5-36.2.29_mapped_official_1.16.5-recomp.jar:?] {re:classloading} at net.minecraft.client.network.play.ClientPlayNetHandler.handleCustomPayload(ClientPlayNetHandler.java:1904) ~[forge-1.16.5-36.2.29_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.network.play.server.SCustomPayloadPlayPacket.handle(SCustomPayloadPlayPacket.java:59) ~[forge-1.16.5-36.2.29_mapped_official_1.16.5-recomp.jar:?] {re:classloading} at net.minecraft.network.play.server.SCustomPayloadPlayPacket.handle(SCustomPayloadPlayPacket.java:11) ~[forge-1.16.5-36.2.29_mapped_official_1.16.5-recomp.jar:?] {re:classloading} at net.minecraft.network.PacketThreadUtil.lambda$ensureRunningOnSameThread$0(PacketThreadUtil.java:19) ~[forge-1.16.5-36.2.29_mapped_official_1.16.5-recomp.jar:?] {re:classloading} at net.minecraft.util.concurrent.ThreadTaskExecutor.doRunTask(ThreadTaskExecutor.java:136) ~[forge-1.16.5-36.2.29_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.util.concurrent.RecursiveEventLoop.doRunTask(RecursiveEventLoop.java:22) ~[forge-1.16.5-36.2.29_mapped_official_1.16.5-recomp.jar:?] {re:classloading} at net.minecraft.util.concurrent.ThreadTaskExecutor.pollTask(ThreadTaskExecutor.java:109) ~[forge-1.16.5-36.2.29_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.util.concurrent.ThreadTaskExecutor.runAllTasks(ThreadTaskExecutor.java:97) ~[forge-1.16.5-36.2.29_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.client.Minecraft.runTick(Minecraft.java:948) ~[forge-1.16.5-36.2.29_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.run(Minecraft.java:607) ~[forge-1.16.5-36.2.29_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.main(Main.java:184) ~[forge-1.16.5-36.2.29_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_311] {} at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_311] {} at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_311] {} at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_311] {} at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:52) ~[forge-1.16.5-36.2.29_mapped_official_1.16.5-recomp.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.1.3.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.1.3.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.1.3.jar:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.1.3.jar:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.1.3.jar:?] {} at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:108) [forge-1.16.5-36.2.29_mapped_official_1.16.5-recomp.jar:?] {}
  2. Huh, why does ctx.get().getSender().getId() returns null, If I send my packet to all
  3. Huh, understand. I think I can get by ctx.get().getSender().getId(); But, how correctly I have to work with this id? If it's not difficult for you, could you show or tell how exactly I should contact the player by his id in my packet?
  4. CapabilityUtil public void updateCapabilityHatId(int id) { ClientPlayerEntity player = Minecraft.getInstance().player; player.getCapability(HatCapability.PLAYER_HAT_ID).ifPresent((Data) -> Data.setValue(id)); } public int getCapabilityHatId() { ClientPlayerEntity player = Minecraft.getInstance().player; if (player != null) { int id = player.getCapability(HatCapability.PLAYER_HAT_ID) .map(capa -> capa.getValue()) .orElse(0); return id; } else return -1; } Something like a helper to me. So how can I make this packet correctly. Sorry for the question, I'm just starting to understand this whole topic and don't understand how exactly to make this packet
  5. Sup! I'm so sorry for asking questuions so often. Now Im stydying how to work with capabilities and netwrok. I have a cap which contains some int id. It changes in custom menu. I want to synchronize it with other players, but so far it hasn't worked. Could someone who knows me give me an idea or tell me how to implement it. public class UpdateCapPacket extends AbstractMessage<UpdateCapPacket> { private int hatId; public UpdateCapPacket() { } public UpdateCapPacket(int id) { this.hatId = id; } @Override public void encode(UpdateCapPacket message, PacketBuffer buffer) { buffer.writeInt(message.hatId); } @Override public UpdateCapPacket decode(PacketBuffer buffer) { int id = buffer.readInt(); return new UpdateCapPacket(hatId); } @Override public void handle(UpdateCapPacket message, Supplier<NetworkEvent.Context> ctx) { if (ctx.get().getDirection().getReceptionSide() == LogicalSide.CLIENT) ctx.get().enqueueWork(() -> { InfCust.LOGGER.error("[UPDATING CAP PACKET]"); final Optional<World> optionalWorld = LogicalSidedProvider.CLIENTWORLD.get(ctx.get().getDirection().getReceptionSide()); final LivingEntity livingEntity = ctx.get().getSender(); if (livingEntity != null) { // Living entity is always null, whats wrong InfCust.LOGGER.error("[CHANGING CAP]"); optionalWorld.ifPresent(world -> InfCust.capabilityUtil.updateCapabilityHatId(message.hatId)); } InfCust.LOGGER.error(InfCust.capabilityUtil.getCapabilityHatId()); }); ctx.get().setPacketHandled(true); } } public void OpenCustMenu() { // For example Minecraft.getInstance().setScreen(new CustomizationScreen()); PacketDispatcher.sendToAll(new UpdateCapPacket(-1)); }
  6. Thanks, Luis! Im already unerstand this, but I just don't know how to tell my renderer that for individual players it is necessary to set the model of the corresponding capability. But diesieben07 says that renderer is one global for all
  7. Well, huh But, dont you know how to make what I want? Maybe any idea...
  8. Hello I have a mod which wearing some model to player. I have capability and renderer for it, but idk how to connect it to each other. Each player must have his own model (which he chooses in the GUI, but it doesn't matter). I have created with the id of the model that will be rendered on the player, however I don't quite understand how to set up the RenderLayer for each player individually Renderer public void render(MatrixStack mstack, IRenderTypeBuffer p_225628_2_, int p_225628_3_, T p_225628_4_, float p_225628_5_, float p_225628_6_, float p_225628_7_, float p_225628_8_, float p_225628_9_, float p_225628_10_) { int itemId = InfCust.capabilityUtil.getCapabilityHatId(); CustItem item = null; if (itemId != -1) { item = InfCust.itemsHandler.getItemByIndex(itemId); } ItemStack itemstack = p_225628_4_.getItemBySlot(EquipmentSlotType.HEAD); float f = MathHelper.lerp(p_225628_7_, p_225628_4_.yRotO, p_225628_4_.yRot) - MathHelper.lerp(p_225628_7_, p_225628_4_.yBodyRotO, p_225628_4_.yBodyRot); float f1 = MathHelper.lerp(p_225628_7_, p_225628_4_.xRotO, p_225628_4_.xRot); mstack.pushPose(); mstack.mulPose(Vector3f.YP.rotationDegrees(f)); mstack.mulPose(Vector3f.XP.rotationDegrees(f1)); mstack.translate(0.0D, 0.5D, 0.0D); mstack.scale(1F, 1F, 1F); if(item != null) { IVertexBuilder ivertexbuilder = ItemRenderer.getArmorFoilBuffer(p_225628_2_, RenderType.armorCutoutNoCull(item.getModelTexture()), false, itemstack.hasFoil()); item.getModel().renderToBuffer(mstack, ivertexbuilder, p_225628_3_, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F); } mstack.mulPose(Vector3f.XP.rotationDegrees(-f1)); mstack.mulPose(Vector3f.YP.rotationDegrees(-f)); mstack.popPose(); } Capability util (handling to capability faster) public void updateCapabilityHatId(int id) { ClientPlayerEntity player = Minecraft.getInstance().player; player.getCapability(HatCapability.PLAYER_HAT_ID).ifPresent((Data) -> Data.setValue(id)); } public int getCapabilityHatId() { ClientPlayerEntity player = Minecraft.getInstance().player; int id = player.getCapability(HatCapability.PLAYER_HAT_ID) .map(capa -> capa.getValue()) .orElse(0); return id; } Sorry for shit code I know that I have to use packet system, but Im actually dont know what my renderer have to do
  9. Well I figured out the capability and now I have a cap that stores the id of some model that will be rendered. Have I edit the render method correctly now? int itemId = InfCust.capabilityUtil.getCapabilityHatId(); CustItem item = InfCust.itemsHandler.getItemByIndex(itemId); ItemStack itemstack = p_225628_4_.getItemBySlot(EquipmentSlotType.HEAD); float f = MathHelper.lerp(p_225628_7_, p_225628_4_.yRotO, p_225628_4_.yRot) - MathHelper.lerp(p_225628_7_, p_225628_4_.yBodyRotO, p_225628_4_.yBodyRot); float f1 = MathHelper.lerp(p_225628_7_, p_225628_4_.xRotO, p_225628_4_.xRot); mstack.pushPose(); mstack.mulPose(Vector3f.YP.rotationDegrees(f)); mstack.mulPose(Vector3f.XP.rotationDegrees(f1)); mstack.translate(0.0D, 0.5D, 0.0D); mstack.scale(1F, 1F, 1F); //this.getParentModel().copyPropertiesTo(this.elytraModel); //this.elytraModel.setupAnim(p_225628_4_, p_225628_5_, p_225628_6_, p_225628_8_, p_225628_9_, p_225628_10_); if(item != null) { IVertexBuilder ivertexbuilder = ItemRenderer.getArmorFoilBuffer(p_225628_2_, RenderType.armorCutoutNoCull(item.getModelTexture()), false, itemstack.hasFoil()); item.getModel().renderToBuffer(mstack, ivertexbuilder, p_225628_3_, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F); //hh.renderToBuffer(mstack, ivertexbuilder, p_225628_3_, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F); } mstack.mulPose(Vector3f.XP.rotationDegrees(-f1)); mstack.mulPose(Vector3f.YP.rotationDegrees(-f)); mstack.popPose(); getCapabilityHatId method public int getCapabilityHatId() { int id = Minecraft.getInstance().player.getCapability(HatCapability.PLAYER_HAT_ID) .map(capa -> capa.getValue()) .orElse(0); return id; }
  10. Oh, I never heard about that. Thanks!
  11. So there is my render layer @Override public void render(MatrixStack mstack, IRenderTypeBuffer p_225628_2_, int p_225628_3_, T p_225628_4_, float p_225628_5_, float p_225628_6_, float p_225628_7_, float p_225628_8_, float p_225628_9_, float p_225628_10_) { CustItem item = InfCust.itemsHandler.getCurrentItem(); ItemStack itemstack = p_225628_4_.getItemBySlot(EquipmentSlotType.HEAD); float f = MathHelper.lerp(p_225628_7_, p_225628_4_.yRotO, p_225628_4_.yRot) - MathHelper.lerp(p_225628_7_, p_225628_4_.yBodyRotO, p_225628_4_.yBodyRot); float f1 = MathHelper.lerp(p_225628_7_, p_225628_4_.xRotO, p_225628_4_.xRot); mstack.pushPose(); mstack.mulPose(Vector3f.YP.rotationDegrees(f)); mstack.mulPose(Vector3f.XP.rotationDegrees(f1)); mstack.translate(0.0D, 0.5D, 0.0D); mstack.scale(1F, 1F, 1F); if(item != null) { IVertexBuilder ivertexbuilder = ItemRenderer.getArmorFoilBuffer(p_225628_2_, RenderType.armorCutoutNoCull(item.getModelTexture()), false, itemstack.hasFoil()); item.getModel().renderToBuffer(mstack, ivertexbuilder, p_225628_3_, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F); } mstack.mulPose(Vector3f.XP.rotationDegrees(-f1)); mstack.mulPose(Vector3f.YP.rotationDegrees(-f)); mstack.popPose(); } And GUI Item and CustItem its class which have information about my model (need for gui and etc). It has model, texture path and something like this. Every frame Im updating current model which will render on my player. If I want to change it I have to use gui and special button in it, which updating model that requested getCurrrentItem() method
  12. Im so sorry for that stupid question, Im new in forge modding, thank you for your understanding and restraint
  13. Greetings! I have my custom layer render class which changes something with player by using gui. However, if you use it on the server, then if one player changes what they have, then everyone will have it, although in theory everything should be individual for each. In addition, it only manifests itself in the person who has changed. I believe that it is necessary here with packets, but something is not clear what is sent to the server for me
  14. Thanks for information!
  15. I mean, I can change it in a game process. I want original diamond sword, woops and change it. Want for example "Flaming" skin with some effects, and change it. If it's not difficult, could you tell me in which direction to look and search for information. What part of the forge is this?

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.