Everything posted by marinz
-
1.16.5 First time join event help
even a 4yo child would get it by now... I told u before that I don't understand it so why continue to say to read that. Nevermind I find the way but pay attention to what you write and what others write.
-
1.16.5 First time join event help
How do I register it
-
1.16.5 First time join event help
what?
-
1.16.5 First time join event help
I tryed but I don't understand it
-
1.16.5 First time join event help
I am trying to find the way but I just can't find it
-
1.16.5 First time join event help
Still don't understand what you want to say
-
1.16.5 First time join event help
package com.tzs.asm.capability; import java.util.concurrent.Callable; import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.INBT; import net.minecraft.util.Direction; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.Capability.IStorage; import net.minecraftforge.common.capabilities.CapabilityInject; import net.minecraftforge.common.capabilities.ICapabilitySerializable; import net.minecraftforge.common.util.LazyOptional; public class PlayerCapability { @CapabilityInject(IPlayerCapability.class) public static Capability<IPlayerCapability> PLAYER_CAPABILITY = null; public static class Storage implements IStorage<IPlayerCapability> { @Override public INBT writeNBT(Capability<IPlayerCapability> capability, IPlayerCapability instance, Direction side) { CompoundNBT props = new CompoundNBT(); props.putBoolean("hasGotSword", instance.hasGotSword()); return (INBT)props; } @Override public void readNBT(Capability<IPlayerCapability> capability, IPlayerCapability instance, Direction side, INBT nbt) { CompoundNBT props = (CompoundNBT)nbt; instance.getSword(props.getBoolean("hasGotSword")); } } public static class PlayerCapabilityFactory implements Callable<IPlayerCapability> { @Override public IPlayerCapability call() throws Exception { return null; } } public static class PlayerCapabilityProvider implements ICapabilitySerializable<CompoundNBT> { private PlayerCapabilityBase playerCapabilityBase = new PlayerCapabilityBase(); private LazyOptional<PlayerCapabilityBase> playerCapabilityOptional = LazyOptional.of(() -> playerCapabilityBase); @SuppressWarnings("unchecked") @Override public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) { return cap == PLAYER_CAPABILITY ? (LazyOptional<T>) playerCapabilityOptional : LazyOptional.empty(); } @Override public CompoundNBT serializeNBT() { return this.serializeNBT(); } @Override public void deserializeNBT(CompoundNBT nbt) { this.deserializeNBT(nbt); } } } package com.tzs.asm; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import com.tzs.asm.capability.IPlayerCapability; import com.tzs.asm.capability.PlayerCapability; import com.tzs.asm.config.asmConfig; import com.tzs.asm.init.ItemInit; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.capabilities.CapabilityManager; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.config.ModConfig.Type; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; @Mod("asm") public class asmMain { public static String MODID = "asm"; public static final Logger LOGGER = LogManager.getLogger(); public asmMain() { IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus(); ItemInit.ITEMS.register(bus); ModLoadingContext.get().registerConfig(Type.COMMON, asmConfig.SPEC, "asmConfig.toml"); MinecraftForge.EVENT_BUS.register(this); } public static void FMLCommonSetupEvent() { CapabilityManager.INSTANCE.register(IPlayerCapability.class, new PlayerCapability.Storage(), new PlayerCapability.PlayerCapabilityFactory()); } }
-
1.16.5 First time join event help
It crashes when I try to join world now.
-
1.16.5 First time join event help
package com.tzs.asm.capability; import java.util.concurrent.Callable; import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.INBT; import net.minecraft.util.Direction; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.Capability.IStorage; import net.minecraftforge.common.capabilities.CapabilityInject; import net.minecraftforge.common.capabilities.ICapabilitySerializable; import net.minecraftforge.common.util.LazyOptional; public class PlayerCapability { @CapabilityInject(IPlayerCapability.class) public static Capability<IPlayerCapability> PLAYER_CAPABILITY; public static class Storage implements IStorage<IPlayerCapability> { @Override public INBT writeNBT(Capability<IPlayerCapability> capability, IPlayerCapability instance, Direction side) { CompoundNBT props = new CompoundNBT(); props.putBoolean("hasGotSword", instance.hasGotSword()); return (INBT)props; } @Override public void readNBT(Capability<IPlayerCapability> capability, IPlayerCapability instance, Direction side, INBT nbt) { CompoundNBT props = (CompoundNBT)nbt; instance.getSword(props.getBoolean("hasGotSword")); } } public static class PlayerCapabilityFactory implements Callable<IPlayerCapability> { @Override public IPlayerCapability call() throws Exception { return null; } } public static class PlayerCapabilityProvider implements ICapabilitySerializable<CompoundNBT> { private PlayerCapabilityBase playerCapabilityBase = new PlayerCapabilityBase(); private LazyOptional<PlayerCapabilityBase> playerCapabilityOptional = LazyOptional.of(() -> playerCapabilityBase); @SuppressWarnings("unchecked") @Override public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) { return cap == PLAYER_CAPABILITY ? (LazyOptional<T>) playerCapabilityOptional : LazyOptional.empty(); } @Override public CompoundNBT serializeNBT() { return this.serializeNBT(); } @Override public void deserializeNBT(CompoundNBT nbt) { this.deserializeNBT(nbt); } } }
-
1.16.5 First time join event help
public static class PlayerCapabilityFactory implements Callable<IPlayerCapability> { @Override public IPlayerCapability call() throws Exception { return null; } }
-
1.16.5 First time join event help
- 1.16.5 First time join event help
Still crashes but now can't join minecraft. package com.tzs.asm; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import com.tzs.asm.capability.IPlayerCapability; import com.tzs.asm.capability.PlayerCapability; import com.tzs.asm.config.asmConfig; import com.tzs.asm.init.ItemInit; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.capabilities.CapabilityManager; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.config.ModConfig.Type; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; @Mod("asm") public class asmMain { public static final Logger LOGGER = LogManager.getLogger(); public asmMain() { IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus(); ItemInit.ITEMS.register(bus); ModLoadingContext.get().registerConfig(Type.COMMON, asmConfig.SPEC, "asmConfig.toml"); MinecraftForge.EVENT_BUS.register(this); CapabilityManager.INSTANCE.register(IPlayerCapability.class, new PlayerCapability.Storage(), new PlayerCapability.PlayerCapabilityFactory()); } }- 1.16.5 First time join event help
Here it is. The setup method is never used @Mod("asm") public class asmMain { public static String MOD_ID = "asm"; public static final Logger LOGGER = LogManager.getLogger(); public asmMain() { IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus(); ItemInit.ITEMS.register(bus); ModLoadingContext.get().registerConfig(Type.COMMON, asmConfig.SPEC, "asmConfig.toml"); MinecraftForge.EVENT_BUS.register(this); } private void setup(FMLCommonSetupEvent event) { CapabilityManager.INSTANCE.register(IPlayerCapability.class, new PlayerCapability.Storage(), new PlayerCapability.PlayerCapabilityFactory()); } }- 1.16.5 First time join event help
- 1.16.5 First time join event help
minecraft crashes after trying to join the world here is the log.- 1.16.5 First time join event help
I did this but I still don't know how to attach capability here are some screenshots of what I've done. I've looked on forge doc and forge community wiki and still don't understand how that would be done.- 1.16.5 First time join event help
and how should I do that. I am sorry I don't really understand how to put that together- 1.16.5 First time join event help
That still means it will give it to any player that doesn't have that item- 1.16.5 First time join event help
I am not sure is that this. I want it to give a sword to player that joined for the first time on server/singleplayer world.- 1.16.5 First time join event help
wouldn't this just give player that item if he doesn't have it?- 1.16.5 First time join event help
Thank you for that I will definitly check that out, but can you tell me how to fix this for now.- 1.16.5 First time join event help
Not really I read all of that but how do I use that, where to put it how to put it I don't understand that. By the way is there any good website or something where I can learn more because I didn't find that much of explaining in yt videos and some website.- 1.16.5 First time join event help
I don't know what this part means and thats almost everything- 1.16.5 First time join event help
I removed almost everything I will just do the first time join to get the sword Screenscot shows code for giving it if you don't have it in inventory but I would like it appear when player joins for the first time- 1.16.5 First time join event help
Can anyone help? - 1.16.5 First time join event help
IPS spam blocked by CleanTalk.
Important Information
By using this site, you agree to our Terms of Use.