Jump to content

cinsiian

Members
  • Posts

    110
  • Joined

  • Last visited

Everything posted by cinsiian

  1. Ok, I did it but now I get another crash: [11set2019 23:15:16.716] [modloading-worker-2/ERROR] [net.minecraftforge.fml.javafmlmod.FMLModContainer/]: Exception caught during firing event: null Index: 1 Listeners: 0: NORMAL 1: net.minecraftforge.eventbus.EventBus$$Lambda$2061/559879182@34f88844 java.lang.ExceptionInInitializerError at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at net.minecraftforge.common.capabilities.CapabilityManager.lambda$attachCapabilityToMethod$5(CapabilityManager.java:145) at net.minecraftforge.common.capabilities.CapabilityManager.lambda$register$0(CapabilityManager.java:79) at java.util.ArrayList.forEach(Unknown Source) at net.minecraftforge.common.capabilities.CapabilityManager.register(CapabilityManager.java:79) at cinsiian.urtima.Urtima.setup(Urtima.java:44) at net.minecraftforge.eventbus.EventBus.doCastFilter(EventBus.java:212) at net.minecraftforge.eventbus.EventBus.lambda$addListener$11(EventBus.java:204) at net.minecraftforge.eventbus.EventBus.post(EventBus.java:258) at net.minecraftforge.fml.javafmlmod.FMLModContainer.fireEvent(FMLModContainer.java:106) at java.util.function.Consumer.lambda$andThen$0(Unknown Source) at java.util.function.Consumer.lambda$andThen$0(Unknown Source) at net.minecraftforge.fml.ModContainer.transitionState(ModContainer.java:112) at net.minecraftforge.fml.ModList.lambda$null$10(ModList.java:133) at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Unknown Source) at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source) at java.util.stream.AbstractPipeline.copyInto(Unknown Source) at java.util.stream.ForEachOps$ForEachTask.compute(Unknown Source) at java.util.concurrent.CountedCompleter.exec(Unknown Source) at java.util.concurrent.ForkJoinTask.doExec(Unknown Source) at java.util.concurrent.ForkJoinTask.doInvoke(Unknown Source) at java.util.concurrent.ForkJoinTask.invoke(Unknown Source) at java.util.stream.ForEachOps$ForEachOp.evaluateParallel(Unknown Source) at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateParallel(Unknown Source) at java.util.stream.AbstractPipeline.evaluate(Unknown Source) at java.util.stream.ReferencePipeline.forEach(Unknown Source) at java.util.stream.ReferencePipeline$Head.forEach(Unknown Source) at net.minecraftforge.fml.ModList.lambda$dispatchParallelEvent$11(ModList.java:133) at java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(Unknown Source) at java.util.concurrent.ForkJoinTask.doExec(Unknown Source) at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(Unknown Source) at java.util.concurrent.ForkJoinPool.runWorker(Unknown Source) at java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source) Caused by: java.lang.NullPointerException at cinsiian.urtima.common.capability.mana.ManaProvider.<clinit>(ManaProvider.java:14) ... 34 more Tell me if you need github for this. ManaProvider.java:14 -- public static IMana INSTANCE = MANA.getDefaultInstance(); Urtima.java:44 -- CapabilityManager.INSTANCE.register(IMana.class, new ManaNBTStorage(), new ManaNBTStorage.Factory());
  2. IMana mana = player.getCapability(ManaProvider.MANA, null).orElse(null); Can that work?
  3. Should I use LazyOptional.cast(); ? I need it.
  4. I do get an error when I try to get the Capability of the mana: [11set2019 21:20:03.439] [Server thread/ERROR] [net.minecraftforge.eventbus.EventBus/EVENTBUS]: Exception caught during firing event: cinsiian.urtima.common.capability.mana.PlayerMana cannot be cast to net.minecraftforge.common.util.LazyOptional Index: 2 Listeners: 0: NORMAL 1: net.minecraftforge.eventbus.EventBus$$Lambda$2050/614462502@67307e64 2: ASM: cinsiian.urtima.common.CommonHandler@4023efd4 onPlayerLogsIn(Lnet/minecraftforge/event/entity/player/PlayerEvent$PlayerLoggedInEvent;)V java.lang.ClassCastException: cinsiian.urtima.common.capability.mana.PlayerMana cannot be cast to net.minecraftforge.common.util.LazyOptional at cinsiian.urtima.common.capability.mana.ManaProvider.getCapability(ManaProvider.java:20) at net.minecraftforge.common.capabilities.CapabilityDispatcher.getCapability(CapabilityDispatcher.java:102) at net.minecraftforge.common.capabilities.CapabilityProvider.getCapability(CapabilityProvider.java:118) at net.minecraft.entity.LivingEntity.getCapability(LivingEntity.java:3110) at net.minecraft.entity.player.PlayerEntity.getCapability(PlayerEntity.java:2277) at cinsiian.urtima.common.CommonHandler.onPlayerLogsIn(CommonHandler.java:89) at net.minecraftforge.eventbus.ASMEventHandler_7_CommonHandler_onPlayerLogsIn_PlayerLoggedInEvent.invoke(.dynamic) at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:80) at net.minecraftforge.eventbus.EventBus.post(EventBus.java:258) at net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerLoggedIn(BasicEventHooks.java:43) at net.minecraft.server.management.PlayerList.initializeConnectionToPlayer(PlayerList.java:203) at net.minecraft.network.login.ServerLoginNetHandler.tryAcceptPlayer(ServerLoginNetHandler.java:119) at net.minecraft.network.login.ServerLoginNetHandler.tick(ServerLoginNetHandler.java:63) at net.minecraft.network.NetworkManager.tick(NetworkManager.java:241) at net.minecraft.network.NetworkSystem.tick(NetworkSystem.java:148) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:882) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:800) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:646) at java.lang.Thread.run(Unknown Source) IMana mana = (IMana) player.getCapability(ManaProvider.MANA, null);
  5. My problem right now is the capability, I've wrote the majoriti of the classes/interfaces needed. I dont know if they will work, hopefully. Right now I have some issues related to the capability factory. Are there any references/examples of capabilities? Thank you.
  6. Hello everyone, how can i implement a mana mechanic in the game? I understood that I need capabilities to make the mana mechanic itself, I tried but seems that the current capabilities documentation is outdated, some voids, classes dont event exist in my directory. I also need to make a "HUD" like the hearts with a custom texture. I managed to learn that I can do that in the event RenderGameOverlayEvent. I tried but i cannot understand how to print the texture in the overlay. I've seen many tutorials but unfortunately, they are all outdated. Thanks for reading. - cinsiian
  7. Do I still need the annotation @EventBusSubscriber(bus=Bus.MOD) ?
  8. @EventBusSubscriber(bus=Bus.MOD) public class NoPunchWood { @SubscribeEvent public static void block_break(final BlockEvent.BreakEvent event) { Block blockIn = event.getState().getBlock(); Item itemInHand = event.getPlayer().getHeldItem(event.getPlayer().getActiveHand()).getItem(); if(blockIn instanceof LogBlock && !(itemInHand instanceof AxeItem)) { event.getPlayer().attackEntityFrom(DamageSource.GENERIC, 2); event.setCanceled(true); } } } Recently I tried this event to execute my code. Nothing happens when I break a block, I think its well registered. At this point is BreakEvent the old BlockBreakEvent?
  9. Hello everyone, I'm attempting to place a block(set a blockstate in the world) only if the player has a certain item in his hand(main/second). @SubscribeEvent public static void onRightClickBlock(final PlayerInteractEvent.RightClickBlock e) { if (e.getWorld().isRemote() || e.getPlayer() == null || e.getFace() == null) { return; } if (!e.getPlayer().isSneaking()) { return; } ItemStack itemStack = e.getPlayer().getHeldItem(e.getHand()); if(itemStack.getItem() == null) { return; } if(itemStack.getItem() == Items.FLINT) { BlockPos p = new BlockPos(e.getPos().getX(), e.getPos().getY() + 1, e.getPos().getY()); if(!e.isCanceled()) { e.getWorld().setBlockState(p, Features.flint.getDefaultState()); if(!e.getPlayer().isCreative()) { itemStack.shrink(1); } } } } Its basically the same action when you place a block. Features.flint is just a block. It has no itemblocks assigned. Thanks for the help.
  10. so i can just check if Blockstate.getBlock() is an instanceof BlockFluid? Oh and also in 1.12.2 BlockFluid class doesn't exists.
  11. How can I check if a blockstate is a fluid source or a flowing fluid? Thank you.
  12. Well, I removed the boolean and added the function. Keeps not working. https://github.com/cinsiian/MiningFeelings/blob/master/src/main/java/com/cinsiian/miningFeelings/block/tileEntity/LanternLightTileEntity.java
  13. I am kinda doing that with my code, if a player is not moving, the game will not replace the block but i have some issues with my tile entity that i cant figure out.
  14. Ok I tried creating a tile entity with a timer in it. When the timer is 0 the block should disappear but it doesn work. Maybe i have not coded correctly the tile entity? https://github.com/cinsiian/MiningFeelings/blob/master/src/main/java/com/cinsiian/miningFeelings/block/tileEntity/LanternLightTileEntity.java https://github.com/cinsiian/MiningFeelings/blob/master/src/main/java/com/cinsiian/miningFeelings/block/BlockLanternLight.java
  15. how can i check if the player's position is changed?
  16. Hello. Basically I maded an item that basically is lantern. I wanna ask if you know a way to make a dynamic light, a light that follows the player only if the lantern is in the main or in the second hand. How can I do that without using the api from Dynamic Lights? Thank you
  17. Hello everyone, I created a block setting the light value of the block to 14 like the torch(https://minecraft-it.gamepedia.com/Torch). I have done that doing in the block's constructor setLightLevel(14); but the block doesn't emits any light. I have seen BlockTorch, BlockGlowstone from vanilla code and they do not use this method. How they do that? Am I doing something wrong?
  18. Thank you, but how can i change the color of the translation. Is possible to use § codes?
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.