Jump to content

unassigned

Members
  • Posts

    103
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by unassigned

  1. You have everything correct, and when I cloned your project on my side on the same forge version it works. Are you actually getting to a point where onServerStarting should be called? Which seems to be just after the world is finished loading.
  2. By simple GUI you mean you just want to draw a string? You can just invoke the fontrenderer in the Minecraft class (make sure you are on the client): fontRenderer.drawString(String, x, y, color);
  3. You need to read up on sides. You can't directly access minecraft in your mod constructor like that, as the server has no idea what the client Minecraft class is.
  4. I went to look at the isRainingAt() method, and it does some other checks which is why its returning false. However, if you check what biome you are in and if it can rain in the first place, then you can get the expected result: world.getBiome(position).getPrecipitation() == Biome.RainType.RAIN && world.isRaining() This just checks the biome the positions in, and see if it can actually rain. If so, then check if its raining. If both are true, it must be raining at that position. If the biome doesn't allow to rain, and it is raining (as rain happens everywhere), then it'll return false (ex. in a desert).
  5. Yeah, I'll wait for the PR. Thanks for your help!
  6. Maybe? I'll give more of a descriptor: I have each ore in the vanilla game have 3 possible drops when mined by the TE: - a normal drop (the drop that already drops when the player mines it) - a silktouch drop (the drop you get from silk touching the block) - a smelt drop (the item you get from smelting said block) Currently, I have a custom class that stores each of these fields, and a map that stores the block and that storage class. If there is a way to create a loot table to do this, that'd be great, I just haven't messed around with loot tables at all, so I don't completely know the bounds.
  7. Hello, I have a block that only mines a certain block out of a hashmap, and the value of the map is the drops that drop depending on different variables. I want to add the ability to store this HashMap in either a json or config file, as I'd like the player to be able to modify it. I tried doing it through the config, but I see no spec that actually does this. I currently have a class that I'm calling in the setup that sets the values I'd like to store, but obviously this isn't editable by the player. Thanks!
  8. Ah gotcha. I did the following, which is quite hacky but seems to work: I added a parameter to the setVoidStored to send the packet or not, then send the packet when the entity joins the world. new readNBT within the cap: instance.setVoidStored(compound.getInt("VoidStored"), false); new event to send the packet after the player is done connecting: @SubscribeEvent public void onJoinWorld(EntityJoinWorldEvent event) { Entity e = event.getEntity(); if(e != null) { if(e instanceof PlayerEntity) { CapabilityPlayerVoid.getPlayerVoid((PlayerEntity)e).ifPresent(IPlayerVoid::onVoidChanged); } } } Let me know if there is a simpler way of doing it. Other than that thanks for your help!
  9. I believe I went through and changed what needed to be changed, but I still get the same error. I did quite the rewrite to get everything in order again, and just for optimization purposes. Here is the stacktrace again: Here are some direct links to the proper github files, as those will house the lines where everything is happening. CapabilityPlayerVoid PlayerVoid MessagePlayerVoid Thank you both for your help so far.
  10. As Draco said, not many changes in 1.13 vs 1.14. I'd check out McJty's tutorials, he covers a lot of basics and some other useful things such as data generators.
  11. Ok. I think I see what you are meaning, however I still don't exactly see where I'm doing anything wrong. I know when I get the capability to send the packet that the cap isn't ever null, so direct reference is fine in this case I believe.
  12. Yeah, I just needed some clarification on the new LazyOptional system, as I'm still not too sure what/when to use them. So doing something like this: e.getCapability(PlayerVoidProvider.CAPABILITY_PLAYER_VOID).ifPresent(pv -> pv.setVoidStored(message.playerVoid)); isn't correct? Or am I mistaking what you are meaning.
  13. Hello, I've recently started modding again so I'm still fairly new to the 1.13 changes. As capabilities have changed somewhat, I'm getting stuck trying to read/write the cap data when the player first joins: I get a NullPointer when I first login after the capability gets attached. Meaning, the first login works, but any following attempts fail will crash: net.minecraft.crash.ReportedException: Loading entity NBT at net.minecraft.network.NetworkSystem.tick(NetworkSystem.java:154) ~[?:?] {re:classloading} at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:882) ~[?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:800) ~[?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) ~[?:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:646) [?:?] {re:classloading,pl:accesstransformer:B} at java.lang.Thread.run(Thread.java:748) [?:1.8.0_231] {} Caused by: java.lang.NullPointerException at net.minecraftforge.fml.network.PacketDistributor.lambda$playerConsumer$1(PacketDistributor.java:216) ~[?:?] {re:classloading} at net.minecraftforge.fml.network.PacketDistributor$PacketTarget.send(PacketDistributor.java:178) ~[?:?] {re:classloading} at net.minecraftforge.fml.network.simple.SimpleChannel.send(SimpleChannel.java:118) ~[?:?] {re:classloading} at com.unassigned.voidmagic.common.capability.playervoid.impl.PlayerVoid.setVoidStored(PlayerVoid.java:61) ~[?:?] {re:classloading} at com.unassigned.voidmagic.common.capability.playervoid.PlayerVoidStorage.readNBT(PlayerVoidStorage.java:37) ~[?:?] {re:classloading} at com.unassigned.voidmagic.common.capability.playervoid.PlayerVoidStorage.readNBT(PlayerVoidStorage.java:10) ~[?:?] {re:classloading} at com.unassigned.voidmagic.common.capability.playervoid.PlayerVoidProvider.deserializeNBT(PlayerVoidProvider.java:39) ~[?:?] {re:classloading,pl:capability_inject_definalize:A} at com.unassigned.voidmagic.common.capability.playervoid.PlayerVoidProvider.deserializeNBT(PlayerVoidProvider.java:15) ~[?:?] {re:classloading,pl:capability_inject_definalize:A} at net.minecraftforge.common.capabilities.CapabilityDispatcher.deserializeNBT(CapabilityDispatcher.java:139) ~[?:?] {re:classloading} at net.minecraftforge.common.capabilities.CapabilityProvider.deserializeCaps(CapabilityProvider.java:96) ~[?:?] {re:classloading} at net.minecraft.entity.Entity.read(Entity.java:1656) ~[?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.management.PlayerList.readPlayerDataFromFile(PlayerList.java:269) ~[?:?] {re:classloading} at net.minecraft.server.management.PlayerList.initializeConnectionToPlayer(PlayerList.java:112) ~[?:?] {re:classloading} at net.minecraft.network.login.ServerLoginNetHandler.tryAcceptPlayer(ServerLoginNetHandler.java:119) ~[?:?] {re:classloading} at net.minecraft.network.login.ServerLoginNetHandler.tick(ServerLoginNetHandler.java:63) ~[?:?] {re:classloading} at net.minecraft.network.NetworkManager.tick(NetworkManager.java:241) ~[?:?] {re:classloading} at net.minecraft.network.NetworkSystem.tick(NetworkSystem.java:148) ~[?:?] {re:classloading} ... 5 more I should also add that it does not crash when I send the packet through other means. I do have some idea to what is causing this crash, however: the packet to update the server w/ the client is being sent while the client is not actually connected yet. I found this result through checking if the client is connected before syncing the data, however this leads to the values not being synced once the NBT is set. I just have no idea on how to fix this problem. Here is the code that is within the stacktrace, and here is my github if you need to see anything else. PlayerVoidStorage (Capability Storage Class): PlayerVoidProvider (Capability Provider Class): PlayerVoid (impl of IPlayerVoid):
  14. Hello, recently I've decided to pick modding back up again, however during my setup of my modding environment I've run into an issue with launching the game after the build and running genIntellijRuns. Everything works fine, the examplemod is there and all syntax seems to be in place. I have changed nothing, yet I get this error when trying to launch: [14:31:43] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher running: args [--gameDir, ., --launchTarget, fmluserdevclient, --fml.mcpVersion, 20190829.143755, --fml.mcVersion, 1.14.4, --fml.forgeGroup, net.minecraftforge, --fml.forgeVersion, 28.1.65, --version, MOD_DEV, --assetIndex, 1.14, --assetsDir, C:\Users\Blake\.gradle\caches\forge_gradle\assets, --username, Dev, --accessToken, ❄❄❄❄❄❄❄❄, --userProperties, {}] [14:31:43] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher 4.1.0+62+5bfa59b starting: java version 1.8.0_231 by Oracle Corporation [14:31:43] [main/DEBUG] [cp.mo.mo.LaunchServiceHandler/MODLAUNCHER]: Found launch services [minecraft,fmldevdata,fmldevclient,fmldevserver,fmluserdevserver,testharness,fmluserdevdata,fmlclient,fmluserdevclient,fmlserver] [14:31:43] [main/DEBUG] [cp.mo.mo.NameMappingServiceHandler/MODLAUNCHER]: Found naming services : [srgtomcp] [14:31:43] [main/DEBUG] [cp.mo.mo.LaunchPluginHandler/MODLAUNCHER]: Found launch plugins: [eventbus,object_holder_definalize,runtime_enum_extender,accesstransformer,capability_inject_definalize,runtimedistcleaner] [14:31:43] [main/DEBUG] [cp.mo.mo.TransformationServicesHandler/MODLAUNCHER]: Discovering transformation services Exception in thread "main" java.lang.NullPointerException at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:267) at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) at java.util.Iterator.forEachRemaining(Iterator.java:116) at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) at cpw.mods.modlauncher.TransformationServicesHandler.discoverServices(TransformationServicesHandler.java:137) at cpw.mods.modlauncher.Launcher.run(Launcher.java:74) at cpw.mods.modlauncher.Launcher.main(Launcher.java:65) at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:101) So far, in an effort to resolve the issue I have: - reinstalled and re-setup all java environments, including JRE and JDK. - reinstalled gradle and my IDE. - used less recent builds of forge
  15. Hello, I have a config class that I setup based on the official documentation, however, I need a map assigned to this value that can only be accessed after the initialization phase, as it accesses the OreDictionary and I'd like to write all the data that this outputs to the config. I'd like to make it so if the map is empty/null write the default oredict data. Thanks.
  16. Hello, I have a storage class attached to the chunks in the world, all values do work and sync correctly, except one boolean, which always for whatever reason seems to default to false, even when constructively set to true. I send a packet to sync all the data from the server to the client, however, as stated, this value always defaults to false. The client actually handles this value well (as in set to true when I want it too), but the way I'm accessing it must be done through the server side, so I need these values to be synced. I just cannot understand why the server is insisting on this value being false when there is no way for it to be set to false (other than the default value of a boolean). I've spent hours trying to debug and see where things are going wrong: during packet sending, in the event itself, etc. One possible pointer is when I call this function through both client and server, it does work, as the client value is what is true which executes the task I want. Here is where I'm setting this boolean: type.hasPossibleNaturalNode does properly set this variable, it can be replaced with true and the same issue still exists. [all of these classes are viewable in my github (see signature), as well as the gradlew scripts for decompilation] Here is the VoidStorage class, which is stored to the chunks [located in capability/voidchunk/VoidStorage] [interface can be found in api/capablity/voidchunk/IVoidChunk]: Here is the Capability Class [CapabilityVoidChunk located in capability/voidchunk/CapabilityVoidChunk]: And here is the event class [CommonEvents, located in events/CommonEvents]: Lastly the packet class [PacketVoidChunk located in network/packets/PacketVoidChunk]: Here are a few more pointers: - I know the issue is some kind of desync between the server and client during the creation of the Capability, I just can't figure out what. - When I go to send the packet, I'm often left with results that look like: Sending hasNaturalNodePacket, currently set before packet: true \ setting to(packet is carrying): false - Without sending the packet, I'm usually left with: Server Side Response: hasNaturalNode: false \ Client Side Response: hasNaturalNode: true - This value is used in VoidChunk#onChunkLoad, where I set a block at specific block coordinates, depending on hasNaturalNode. - As all values are being synced between the server TO the client (ex. the integer voidValue, or the integer voidTypeID), why would this one act like this need to be synced from the client TO the server? Thank you and sorry for the spew of text.
  17. Yeah, and I have attached it to a tile with the same code, and it works. I seriously think that the chunk's heightmap isn't loaded once onChunkLoad is called, so thus it just returns zero. And I have no other solutions to this problem. Edit - You know how I said that I was only calling this on the server? Yeah, I was lying. I did a quick isRemote check and now it works. Thank you.
  18. Yes. This is called directly from subscribing from the ChunkEvent.Load. if(this.hasNaturalNode && nodePos == null) { this.nodePos = new BlockPos( (this.chunk.x << 4) + 8, this.chunk.getHeightValue(8, 8), (this.chunk.z << 4) + 8 ); if(chunk.getWorld().getBlockState(nodePos) != ModBlocks.VOID_NODE.getDefaultState()) { chunk.getWorld().setBlockState(nodePos, ModBlocks.VOID_NODE.getDefaultState()); VoidUtils.logger.info("Spawned natural node at " + nodePos.getX() + " " + nodePos.getY() + " " + nodePos.getZ()); } }
  19. Now I am supplying with block coords, yet I still get an ArrayIndexOutOfBounds Exception. - Edit - I saw what you said about the blook coords, how they'd have to be 0-15. However, even with this, it still puts the Y at zero. int y = this.chunk.getHeightValue(8, 8);
  20. Okay, I used something like this: int y = chunk.getHeightValue(chunk.x & 15, chunk.z & 15); However, it still returns a value of 0. (This is being called in ChunkEvent.Load)
  21. Huh, using it this way throws an array out of bounds exception. java.lang.ArrayIndexOutOfBoundsException: -976 at net.minecraft.world.chunk.Chunk.getHeightValue(Chunk.java:166) ~[Chunk.class:?] at com.github.unassignedxd.voidutils.main.util.ModUtil.getCentralBlockPos(ModUtil.java:36) ~[ModUtil.class:?] at com.github.unassignedxd.voidutils.main.events.CommonEvents.onChunkLoad(CommonEvents.java:51) ~[CommonEvents.class:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_7_CommonEvents_onChunkLoad_Load.invoke(.dynamic) ~[?:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) ~[ASMEventHandler.class:?] at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182) ~[EventBus.class:?] at net.minecraft.world.chunk.Chunk.onLoad(Chunk.java:922) ~[Chunk.class:?] at net.minecraftforge.common.chunkio.ChunkIOProvider.syncCallback(ChunkIOProvider.java:109) ~[ChunkIOProvider.class:?] at net.minecraftforge.common.chunkio.ChunkIOExecutor.tick(ChunkIOExecutor.java:150) ~[ChunkIOExecutor.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:803) ~[MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:743) ~[MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192) ~[IntegratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:592) [MinecraftServer.class:?] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_191] public static BlockPos getCentralBlockPos(Chunk chunk) { int x = (chunk.x << 4) + 8; int y = chunk.getHeightValue(chunk.x, chunk.z); int z = (chunk.z << 4) + 8; return new BlockPos(x, y, z); }
  22. As in your not getting expected results? Step through your code and see what's happening, it might just be a logic error. To check for sync, you can compare values display in the gui vs values found in the TE.
  23. Hello, I want to access a chunk after it has loaded. Currently, I am using ChunkEvent.Load to do some calculations, however, as the chunk is not loaded, I cannot access the blocks that make up the chunk. More importantly, use World#getHeight to get the top block of the chunk loaded. Is there any event that can do this? Thanks.
  24. Huh, that has fixed it. Why would something like this cause an issue like that? I'd imagine it would just translate it twice. Now, how would I draw a sphere? Would I have to create a high count polygon? Or is there an easier way? As I see no glMode for the bufferbuilder that has anything to do with spherical objects. Also, I have no idea where to even start with drawing vertices for s
  25. You have to send packets to the client about the data on the TE.
×
×
  • Create New...

Important Information

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