Jump to content

SpectralGerbil

Members
  • Posts

    29
  • Joined

  • Last visited

Everything posted by SpectralGerbil

  1. It's not your problem, the download page is currently down. You'll have to wait, sadly.
  2. Not the answer you want, but we have no idea. Just wait and see. You can still build your mod (as long as you don't need any new dependencies) by running Gradle in offline mode: https://www.baeldung.com/gradle-offline-mode
  3. Send us your entire code file, not just that small portion you posted. You are most likely telling the game to break a block on an event that only happens on the client side.
  4. Look at the vanilla game's code under your project's dependencies, it'll be under something like: minecraft.item.
  5. Yup, right as I go to download new dependencies... x) Hopefully gets fixed soon
  6. I've already been using the bot, but thank you for the link! Had no idea of this functionality!
  7. Hiya, to make a long story start I am altering the Phantom AI and part of this involved using reflection to fetch various private parts of the AI system (like the various goal objects in Forge). Problem I'm having is, after I run all these calculations, I need to put them back into the AI goal - but I can't quite do this. See, the field I'm trying to edit is "attackTargeting", within the Phantom.PhantomAttackPlayerTargetGoal subclass. Problem is, this subclass is not public. Attempting to use reflection to get the value of the field simply throws me an error that the field and subclass are not visible. I'm experienced in Java but have absolutely no idea how to get around accessing a non-visible field without being able to edit said field (which I can't, because it's vanilla code). What can I do here?
  8. Got it working - thanks for the brilliant help!! Will post here how I did it in case others need the same information: //In main class: static List<TagKey<Biome>> biomes = null; static Registry<Biome> biomeregistry = null; @SubscribeEvent public void listBiomes(TagsUpdatedEvent event) { biomeregistry = event.getRegistryAccess().registryOrThrow(Registry.BIOME_REGISTRY); biomes = biomeregistry.getTagNames().toList(); } //In retrieving class: if (Main.biomes != null) { Main.biomes.forEach(t -> { if (world.getBiomeManager().getBiome(pos).is(t)) { if (primaryTagMap.containsKey(t.location()) ) { biomereturn = t.location(); secondaryreturn = false; } if (secondaryTagMap.containsKey(t.location()) ) { biomereturn = t.location(); secondaryreturn = true; } }}); }
  9. So something like this should work for getting the biome tags, saving them, and then checking them against a biome and map? //In main class: //(Just to be sure, does ServerStartingEvent fire on the client or do I need something else? - this mod is client only) static List<TagKey<Biome>> biomes = null; static Registry<Biome> biomeregistry = null; @SubscribeEvent public static void listBiomes(ServerStartingEvent event) { biomeregistry = event.getServer().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY); biomes = biomeregistry.getTagNames().toList(); } //And then retrieve in another class: Main.biomes.forEach(t -> { if (world.getBiomeManager().getBiome(pos).is(t)) { if (primaryTagMap.containsKey(t.location()) ) { biomereturn = t.location(); secondaryreturn = false; } if (secondaryTagMap.containsKey(t.location()) ) { biomereturn = t.location(); secondaryreturn = true; } }});
  10. Ok, so to elaborate - I'm currently on 1.19.2, not 1.19.4 - so "Registries" doesn't exist - going backwards off the link you sent, it seems BuiltInRegistries should work, but that doesn't work with RegistryorThrow or any similar methods I'm aware of within registry access. That's also why the old Forge registry still existed. Any idea how to do this for 1.19.2?
  11. Ohh, thank you! I wasn't fully aware that they needed to be fetched at startup - thanks for the help!
  12. Try installing Atmospheric, it should only be an optional dependency but Peculiars is trying to access it's code for whatever reason. https://www.curseforge.com/minecraft/mc-mods/atmospheric
  13. Hello - I'm having some issues with retrieving and operating on data in a Stream of biome tags and not sure if my issue is with my dated knowledge of Java or my usage of Forge code - so I would appreciate some help. I'm running this method - the stuff inside doesn't really matter here, because nothing inside this method is ever run. I've added print statements to debug and they are never executed. .getTagNames() should return a stream of biome keys which are then operated on. AmbienceMod.biomekeys.getTagNames().forEach(t -> { if (world.getBiomeManager().getBiome(pos).is(t)) { if (primaryTagMap.containsKey(t.location()) ) { biomereturn = t.location(); secondaryreturn = false; } if (secondaryTagMap.containsKey(t.location()) ) { biomereturn = t.location(); secondaryreturn = true; } }}); } And this is my definition of "biomekeys": static @Nullable ITagManager<Biome> biomekeys; <irrelevant code here> biomekeys = ForgeRegistries.BIOMES.tags(); This could be something really trivial I've missed but it's had me scratching my head for a while now.
  14. Thanks for the info - that method you sent is just what I needed and I'll put some measures in place to prevent things from going as you said they might
  15. I'm concerned the answer might be painfully simple, since I've been slightly off base today - but I'm trying to get an Array of all of the "TagKey<Biome>" fields defined in Tags.Biomes (I'll be iterating through them to check for biome tags, and using the keys instead of raw text tags is better for language compatibility). The ones such as "IS_HOT", "IS_LUSH", "IS_MOUNTAIN", etc.. I cannot for the life of me figure out how and where to pull a list of all these from. I would just copy them in manually but that presents potential compatibility issues if another mod chooses to add new tags. Any help?
  16. Ah, that's frustrating but understandable. In that case to find a dungeon I'd be best off searching the map for zombie, skeleton or spider spawners. Can you recommend an efficient way to do this - I imagine scanning thousands and thousands of blocks to search for a monster spawner would significantly hurt performance.
  17. Hello again - I've been looking around and I'm unsure of how to get the location of a PlacedFeature. Say I wanted the location of an ore, a tree, or in my case a monster spawner. I have found the monster spawner by searching the feature lists of nearby biomes but I'm unsure how to get it's coordinates. The PlacedFeature only seems to store generation data - not the actual location it was placed, but there has to be some way to get the location of the spawner from this, right? Any ideas?
  18. Thanks so much warjort! I was just investigating and figuring this out and your comment confirmed my suspicions. I needed to get the holder directly from the registry for this to work. For anyone who finds this thread in the future, my solution was to change this line: HolderSet<Structure> holderset = HolderSet.direct(Structures.JUNGLE_TEMPLE); With this: Registry<Structure> reg = level.registryAccess().registryOrThrow(Registry.STRUCTURE_REGISTRY); Holder<Structure> holder = reg.getHolder((Structures.JUNGLE_TEMPLE.unwrapKey().get())).get(); HolderSet<Structure> holderset = HolderSet.direct(holder); And voila: Thanks for the help!
  19. Hey there, I'll keep this short and sweet. I'm trying to fix this and wondered if anyone can help. I'm running code using findNearestMapStructure to find the nearest Jungle Temple and send the coordinates to the executing player. However, said method is returning null every single time. Any ideas why? if (entity instanceof Player player && !player.getLevel().isClientSide()) {] ServerLevel level = (ServerLevel) player.getLevel(); HolderSet<Structure> holderset = HolderSet.direct(Structures.JUNGLE_TEMPLE); BlockPos pos = new BlockPos(x, y, z); Pair<BlockPos, Holder<Structure>> pair = level.getChunkSource().getGenerator().findNearestMapStructure(level, holderset, pos, 100, false); // This always returns null BlockPos structurepos = pair.getFirst(); int strx = structurepos.getX(); int stry = structurepos.getY(); int strz = structurepos.getZ(); player.displayClientMessage(Component.literal("The compass twinkles, and you sense a jungle temple at " + Integer.toString(strx) + ", " + Integer.toString(stry) + ", " + Integer.toString(strz) + "!"), (false)); }
  20. You have client side mods on the server - which they shouldn't be. The one I noticed is Just Enough Items - but you should check through your full modlist.
  21. Hello there, I'm an intermediate Java programmer making a Minecraft mod that does various things. Currently I'm trying to make an item that replicates the /locate command - in this particular case, I want the item to tell the player the coordinates of the nearest jungle temple. However, I've ran into some confusion whilst doing the code for this. I looked at the code for the /locate command and my head is spinning a bit with some of these complications. The method I'm using to find the structure (findNearestMapStructure) requires a HolderSet argument. I've been browsing the javadocs for a good while now and I'm very confused as to how to create one of these - the vanilla code for /locate seems to pull information from a resource map to make one, but I don't need to use a resource map since I'm not accepting a structure as an argument like the command, correct? In that case how would I create a HolderSet for this purpose? Is there simply a way to construct one from a ResourceKey or something similar, so that the code points to a jungle temple structure? Thanks for the help.
  22. Just took a look at them, seems perfect! Thanks for the quick response and the help! Problem solved.
  23. Hiya. I have quite a Java-y question for you today that I'm hoping I can recieve some help with although I still feel it is related enough to Minecraft Forge to warrant posting here. I do apologise for the unclear title. I'm somewhat experienced in Java; no expert, but I have a lot of time with it under my belt. I know a lot about it but still also have a lot to learn. Essentially, I'm writing a new gameplay mechanic/system, and as part of this I pass an ItemStack to a custom function. I then need to return different values, based on what ItemStack it is. The immediate thought on how to do this is with multiple if branches. However, I worry this may have a performance impact. Since the function may well be called every single tick, or at least several times a second, I don't want to force the program to run through 100 if branches each tick, which I imagine would cause slowdown. An example of what I would do is below. This is pseudocode, so ignore any errors. It's just to give an idea of the concept of what the code should do. if (itemType == Items.LEATHER_HELMET) { defense += 4 agility += 4 } if (itemType == Items.IRON_HELMET) { defense += 7 } if (itemType == Items.GOLD_HELMET) { defense += 3 wisdom += 6 } Unlike the above example however, I would likely have this iterating over anywhere from 50-200 items. Is there a more efficient mechanism within Java (or Minecraft Forge) that would achieve the same result, without requiring so many iterations over if statements?
  24. Oh! Simple enough. Thanks, things are working now! I've just got a few bits of tidying up to do with my code, to make everything work perfectly, but I've removed the tooltips I wanted. Massive props for the help!
  25. It does! Thank you! I've figured out what I'm supposed to do now with the components. I just have one more question on how to finish up. After running all my checks, how can I modify the resulting tooltip to apply my changes? I can't see an event.setTooltip method or anything of that nature. I have the finished, edited tooltip that I need, but how do I apply it over the one the event gives me?
×
×
  • Create New...

Important Information

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