Posted September 28, 20195 yr Hello guys, I usually try to fix things by myself using sources but here I am stuck. I don't know why since I saw many examples here and in github but nothing seems to work... I try to implement an easy capability that just store one data to begin with, then I try to attached this one on a tile entity but when I use getCapability, nothing is attached. Even worst, the "onAttachCapability" function in the follow code doesn't seems to be called : @Mod(MyMod.MOD_ID) @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD, modid = MyMod.MOD_ID) public class MyMod { public static final String MOD_ID = "mymod"; public static final String MOD_NAME = "My Mod"; public static final String MOD_VERSION = "0.0.1 "; public static final ResourceLocation PACKET_CAPABILITY_LOCATION = new ResourceLocation(MyMod.MOD_ID, "packet_capability"); public MyMod() { Debugger.debug("Start My Mod"); MinecraftForge.EVENT_BUS.register(this); } ...Stuff @SubscribeEvent public static void onCapabilityRegistry(FMLCommonSetupEvent event) { Debugger.debug("Register Capabilities"); CapabilityManager.INSTANCE.register(IPacket.class, new PacketStorage(), Packet::new); } @SubscribeEvent public static void onAttachCapability(AttachCapabilitiesEvent<TileEntity> event) { Debugger.debug("Attach Capabilities"); TileEntity te = event.getObject(); if (te instanceof IDataReceiver) { event.addCapability(PACKET_CAPABILITY_LOCATION, new PacketProvider()); } } } I really have no idea, everything else is exactly the same code as this one : https://gist.github.com/FireController1847/c7a50144f45806a996d13efcff468d1b. Edited September 28, 20195 yr by dylandmrl solved
September 28, 20195 yr 1 hour ago, dylandmrl said: bus=Mod.EventBusSubscriber.Bus.MOD AttachCapabilityEvent doesn't fire on the Mod Event Bus. It fires on the Forge Event Bus. 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.
September 28, 20195 yr Author I didn't know the existence of another bus, thank you very much and for those who need more information about both buses here is a link : https://suppergerrie2.com/minecraft-1-14-modding-with-forge-3-how-to-use-events/.
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.