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.
Hello! So i have been trying to make a mod that adds plant fiber to minecraft 1.16.5 (i believe there are mods that add plant fiber but not for 1.16.5) but the problem is that i want to modify the loot table of grass to always drop plant fiber but also keep the vanilla drops. Most common answer i have seen is GlobalLootModifiers. But my tiny brain cant understand any tutorials. So any help is appreciated.
Found the solution! Instead of using PlayerEvent.Clone to sync capabilities with a client use EntityJoinWorldEvent! That's how CapabilitySync class should look like:
public class CapabilitySync {
@SubscribeEvent
public void EntityJoinWorldEvent(EntityJoinWorldEvent event) {
Entity entity = event.getEntity();
if (entity.world.isRemote || !(entity instanceof EntityPlayerMP)) return;
EntityPlayer player = (EntityPlayer) entity;
NetworkHandler.channel.sendTo(new ServerToClient(player), (EntityPlayerMP) player);
}
@SubscribeEvent
public void onPlayerClone(PlayerEvent.Clone event)
{
EntityPlayer player = event.getEntityPlayer();
IFolder folder = player.getCapability(FolderProvider.FOLDER_CAP, null);
IFolder oldfolder = event.getOriginal().getCapability(FolderProvider.FOLDER_CAP, null);
folder.setFolders(oldfolder.getFolders());
}
}
Here is a full code if you need one!
https://github.com/R4L34/capabilitynetworking
Recommended Posts
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.