Jump to content

Gr3atsaga

Members
  • Posts

    18
  • Joined

  • Last visited

Everything posted by Gr3atsaga

  1. I would like to figure out a solution to essentially disable all loaded redstone blocks/entities from "ticking" - but unsure if this is possible or what criteria/objects can be used to accomplish this. The blockEntityList on the ServerWorld object has all of the loaded entities, but redstone blocks are not considered "tickable" and are not found in the tickableTileEntities list and also do not seem to have any unique criteria to filter. I.E. to find all tickableTileEntities in blockEntityList, I can search it for any objects that are an instance of ITickableTileEntity -- but the same cannot be done for redstone blocks. I have code that simulates disabling tile entity ticks by removing the objects from the tickableTileEntity list and then restoring them later from the blockEntityList. I'd like to do something similar with redstone blocks if possible, but so far I cannot find any solutions. Sample code for tile entities below minecraftServer.overworld().tickableBlockEntities.clear(); minecraftServer.overworld().tickableBlockEntities.addAll(minecraftServer.overworld().blockEntityList.stream().filter(x -> x instanceof ITickableTileEntity).collect(Collectors.toSet()));
  2. As a simple example, would it be possible to store a complex object in the config such as a pair of Player UUID and Name? Example: { UUID: "d934c206-0128-4cde-9aa1-41f9a83b6aae", Name: "Gr3atsaga" }
  3. I've been able to get it working, so thank you. However, I still don't quite understand how to use the discord bot to find the SRG name of the field GameRules.RuleType.callback. I managed to find it with !moj callback, but how would I have searched for callback on GameRules.RuleType specifically? I also don't understand the different between !moj and !mcp
  4. This is probably impossible, but figured I'd check just in case. I am working on a mod which automatically changes the values of some game rules, or more specifically "disables" specific rules if certain conditions are met. However, if someone changes the value of a game rule, say doDaylightCycle from false to true after my mod disables it then when my mod's status is triggered to update it thinks the rule is currently disabled. I mean obviously setting doDaylightCycle back to true won't change anything since the user already changed it to true, but this is different for a game rule like randomTickSpeed where the value is non-binary. With randomTickSpeed, however, when I say "disabled" that means set to 0. When I disable it, I store the current value so I can restore it later. However, the user can update the randomTickSpeed to something else. That's okay because I can check the current value when my mod goes to update and make sure I store the new value if it has changed. But, the user could explicitly update the game rule value of randomTickSpeed to 0 and expect that when my mod re-enables randomTickSpeed that the value remains 0. There is no way for me to know they specifically set it to 0. Not sure if there is anything in Forge that allows me to subscribe to changes in the game rules or something like that. Otherwise I guess that workflow just can't work with my mod. I guess a way I could do it is to have my own commands which set the "enabled" values for the game rules, but I would prefer an automatic behind the scenes solution.
  5. Where would I find the SRG name? I understand that it is a mapping of names, but where do I find it?
  6. Do you have experience in creating a fake command context? I tried to follow the steps to do so, but it requires that I create a ParsedArgument and I'm not too sure about the construction of that object. I did get the deserialize method through reflection and it was working just fine in my dev environment. But as soon as I tested my mod in a non-dev env I am getting a no such method exception... why would I not be able to find it in a non-dev setup?
  7. I found the method tryDeserialize which takes a string and tries to parse an int from it. However it, as well as the setFrom method are marked as ClientOnly. I need to set this game rule in a server context.
  8. Just trying to set the value of random tick speed in code with an int value, but cannot seem to figure out how. With a boolean game rule it is extremely easy with the set method... but random tick speed requires a GameRules.IntegerValue object, and the constructor of that object needs a GameRules.RuleType<GameRules.IntegerValue> object.
  9. I'm curious if there is a difference in the two lists on the World object. Specifically, are all the entities in blockEntityList tickable? If not, how do I determine their tickable status? And will these two lists be identical, unless acted upon by something else? I.E. if I were to clear the list of tickableBlockEntities, can I trust that I can restore the list at a later time from blockEntityList? I ask as I am trying to determine how to stop all tile entities on a server from ticking. I have been successful at doing this at spawn in a new world by clearing the tickableBlockEntities list, however maybe there is a better/easier way to do it.
  10. That's fair. I still would like to know how to get the loaded chunks, just in case I ever need to.
  11. I hardly think the reason I want them is relevant, but if you really must know I want to know if I can force unload all chunks when all players go offline on a server. This would included chunks being chunk loaded by a chunk loader. Though, I'm not even sure that it would work since I am not familiar with how chunk loaders work. If they stop the unload event from happening, then I guess it's just not possible to do.
  12. Is there a different way to get the loaded chunks in 1.16.5? When I run the below line, it does not find the method. ChunkManager.class.getDeclaredMethod("getLoadedChunksIterable");
×
×
  • Create New...

Important Information

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