• Recently Browsing

    No registered users viewing this page.

  • Posts

    • https://stackoverflow.com/questions/11247793/why-do-some-folks-use-classmethod-instead-of-class-method-in-correspondence
    • Yeah...I'm trying to understand the concept of two sides in Minecraft. As I see it, ServerChatEvent should fire when a player chat on server. The code below is event loader. public class EventLoader { public EventLoader() { MinecraftForge.EVENT_BUS.register(this); } ResourceLocation location = new ResourceLocation("mytestmod", "mytestmod.test"); SoundEvent se = new SoundEvent(location); @SubscribeEvent public void onPlayerChat(ServerChatEvent event) { event.getPlayer().sendMessage(new TextComponentString("fired!")); System.out.println("fired!"); event.getPlayer().world.playSound(null, event.getPlayer().getPosition(),se, SoundCategory.PLAYERS, 1.0F, 1.0F); } }   And I initiate it in the main class. public void preInit(FMLPreInitializationEvent event) { new EventLoader(); }   The result when I test it on my remote server was nothing happen.
    • I'm working on a capability that should allow me to create rpg-like skills, and I need to save the data from those skills to the player.   This is my CapabilitySkills class, in case the problem is actually in there: package com.lk1905.gielinorcraft.capability.skill; import com.lk1905.gielinorcraft.api.capability.ISkillContainer; import com.lk1905.gielinorcraft.api.utils.CapabilityUtils; import com.lk1905.gielinorcraft.capability.CommonCapabilityProvider; import net.minecraft.entity.Entity; import net.minecraft.entity.player.PlayerEntity; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.CapabilityInject; import net.minecraftforge.common.capabilities.CapabilityManager; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.event.AttachCapabilitiesEvent; import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @Mod.EventBusSubscriber public class CapabilitySkills { @CapabilityInject(ISkillContainer.class) private static Capability<ISkillContainer> skillContainerCapability; public static void register() { CapabilityManager.INSTANCE.register(ISkillContainer.class, new SkillStorage(), () -> new SkillContainer());//<---THIS LINE } @SubscribeEvent public static void attachCapability(AttachCapabilitiesEvent<Entity> e) { if(!(e.getObject() instanceof PlayerEntity)) { return; } SkillContainer newContainer = new SkillContainer(); e.addCapability(newContainer.getCapabilityID(), new CommonCapabilityProvider<>(skillContainerCapability, null, newContainer)); } @SubscribeEvent public static void onPlayerClone(final PlayerEvent.Clone e) { ISkillContainer oldCapability = (ISkillContainer) CapabilityUtils.getCapability(e.getOriginal(), skillContainerCapability); ISkillContainer newCapability = (ISkillContainer) CapabilityUtils.getCapability(e.getPlayer(), skillContainerCapability); newCapability.setAllSkills(oldCapability.getAllSkills()); } public static ISkillContainer getSkillContainer(ICapabilityProvider provider) { return (ISkillContainer) CapabilityUtils.getCapability(provider, skillContainerCapability); } public static Capability<ISkillContainer> getSkillCapability(){ return skillContainerCapability; } }  
    • Hello, I've been stuck on a problem that I don't know how to fix.   Crash report: Description: Saving entity NBT java.lang.NullPointerException: Saving entity NBT at com.lk1905.gielinorcraft.capability.CommonCapabilityProvider.serializeNBT(CommonCapabilityProvider.java:45) ~[?:?] {re:classloading} at net.minecraftforge.common.capabilities.CapabilityDispatcher.serializeNBT(CapabilityDispatcher.java:127) ~[?:?] {re:classloading} at net.minecraftforge.common.capabilities.CapabilityProvider.serializeCaps(CapabilityProvider.java:86) ~[?:?] {re:classloading} at net.minecraft.entity.Entity.writeWithoutTypeId(Entity.java:1523) ~[?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.integrated.IntegratedPlayerList.writePlayerData(IntegratedPlayerList.java:27) ~[?:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.server.management.PlayerList.saveAllPlayerData(PlayerList.java:631) ~[?:?] {re:classloading} at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:114) ~[?:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:659) [?:?] {re:classloading,pl:accesstransformer:B} at java.lang.Thread.run(Thread.java:745) [?:1.8.0_66] {} A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Server thread Stacktrace: at com.lk1905.gielinorcraft.capability.CommonCapabilityProvider.serializeNBT(CommonCapabilityProvider.java:45) at net.minecraftforge.common.capabilities.CapabilityDispatcher.serializeNBT(CapabilityDispatcher.java:127) at net.minecraftforge.common.capabilities.CapabilityProvider.serializeCaps(CapabilityProvider.java:86) -- Entity being saved -- Details: Entity Type: minecraft:player (net.minecraft.entity.player.ServerPlayerEntity) Entity ID: 435 Entity Name: Dev Entity's Exact location: -229.50, 64.00, -165.50 Entity's Block location: World: (-230,64,-166), Chunk: (at 10,4,10 in -15,-11; contains blocks -240,0,-176 to -225,255,-161), Region: (-1,-1; contains chunks -32,-32 to -1,-1, blocks -512,0,-512 to -1,255,-1) Entity's Momentum: 0.00, -0.08, 0.00 Entity's Passengers: [] Entity's Vehicle: ~~ERROR~~ NullPointerException: null Stacktrace: at net.minecraft.entity.Entity.writeWithoutTypeId(Entity.java:1523) at net.minecraft.server.integrated.IntegratedPlayerList.writePlayerData(IntegratedPlayerList.java:27) at net.minecraft.server.management.PlayerList.saveAllPlayerData(PlayerList.java:631) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:114) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:659) at java.lang.Thread.run(Thread.java:745) -- System Details -- Details: Minecraft Version: 1.15.2 Minecraft Version ID: 1.15.2 Operating System: Windows 10 (amd64) version 10.0 Java Version: 1.8.0_66, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 249239288 bytes (237 MB) / 651689984 bytes (621 MB) up to 820510720 bytes (782 MB) CPUs: 4 JVM Flags: 1 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump ModLauncher: 5.0.0-milestone.4+67+b1a340b ModLauncher launch target: fmluserdevclient ModLauncher naming: mcp ModLauncher services: /eventbus-2.0.0-milestone.1-service.jar eventbus PLUGINSERVICE /forge-1.15.2-31.1.0_mapped_snapshot_20190719-1.14.3-launcher.jar object_holder_definalize PLUGINSERVICE /forge-1.15.2-31.1.0_mapped_snapshot_20190719-1.14.3-launcher.jar runtime_enum_extender PLUGINSERVICE /accesstransformers-2.0.0-milestone.1-shadowed.jar accesstransformer PLUGINSERVICE /forge-1.15.2-31.1.0_mapped_snapshot_20190719-1.14.3-launcher.jar capability_inject_definalize PLUGINSERVICE /forge-1.15.2-31.1.0_mapped_snapshot_20190719-1.14.3-launcher.jar runtimedistcleaner PLUGINSERVICE /forge-1.15.2-31.1.0_mapped_snapshot_20190719-1.14.3-launcher.jar fml TRANSFORMATIONSERVICE FML: 31.1 Forge: net.minecraftforge:31.1.0 FML Language Providers: javafml@31.1 minecraft@1 Mod List: client-extra.jar Minecraft {minecraft@1.15.2 DONE} forge-1.15.2-31.1.0_mapped_snapshot_20190719-1.14.3-recomp.jar Forge {forge@31.1.0 DONE} main Gielinorcraft {gielinorcraft@0.0.0 DONE} Player Count: 1 / 8; [ServerPlayerEntity['Dev'/435, l='New World', x=-229.50, y=64.00, z=-165.50]] Data Packs: vanilla, mod:forge (incompatible), mod:gielinorcraft (incompatible) Type: Integrated Server (map_client.txt) Is Modded: Definitely; Client brand changed to 'forge'   CommonCapabilityProvider.java package com.lk1905.gielinorcraft.capability; import javax.annotation.Nullable; import net.minecraft.nbt.INBT; import net.minecraft.util.Direction; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ICapabilitySerializable; import net.minecraftforge.common.util.LazyOptional; public class CommonCapabilityProvider<HANDLER> implements ICapabilitySerializable<INBT>{ protected final Capability<HANDLER> capability; protected final Direction side; protected final HANDLER instance; protected final LazyOptional<HANDLER> lazyOptional; public CommonCapabilityProvider(final Capability<HANDLER> capability, @Nullable final Direction side, @Nullable final HANDLER instance) { this.capability = capability; this.side = side; this.instance = instance; if(this.instance != null) { lazyOptional = LazyOptional.of(() -> this.instance); }else { lazyOptional = LazyOptional.empty(); } } @Override public <T> LazyOptional<T> getCapability(final Capability<T> cap, @Nullable final Direction side) { return capability.orEmpty(cap, lazyOptional); } @Nullable @Override public INBT serializeNBT() { return capability.writeNBT(getInstance(), getFacing());//<-- THIS LINE } @Override public void deserializeNBT(INBT nbt) { capability.readNBT(getInstance(), getFacing(), nbt); } @Nullable public Direction getFacing() { return side; } @Nullable public HANDLER getInstance() { return instance; } }   Other code if you need to see it is here: https://github.com/LK1905/GielinorCraft    
  • Topics

  • Who's Online (See full list)