Jump to content

Keheck

Members
  • Posts

    62
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Keheck's Achievements

Stone Miner

Stone Miner (3/8)

0

Reputation

  1. And if I want to also have a breath mechanic, so that oxygenized air becomes my deoxygenized one whenever something happens?
  2. At first I wanted to solve it with a TileEntity, but that would probably make Minecraft shit itself from vast amount of TileEntities in each chunk, so I'm thinking about some kind of "binary" blockstate that just says "here be oxygen" or "here be no oxygen", and depending on wheter you're in oxygenized air you either stay alive or slowly suffocate (like drowning in water). I can try to adjust for realism later, but just as a proof of concept
  3. I already know how I override other vanilla blocks (same registry name as the block to replace and then register the block on my mod's turn). But it doesn't work the same way for the air block, since it is a default value for the block registry, which can't be overridden once registered. Why do I want to do that? Because I want to build a mod that adds a Oxygen mechanic to the air block. Is there some other workaround that is friendly for intermediate modders?
  4. I am currently experimenting with capabilities and don't know if getting my capability this way: // PARTY_CAP is my Capability<T> object. player.getCapability(PartyProvider.PARTY_CAP).orElse(PartyProvider.PARTY_CAP.getDefaultInstance()); is correct, or if it's not intended to be get that way.
  5. When would it be better to use that instead of a SimpleChannel? Like, what are some example cases you could name?
  6. So if I understood correctly, the first byte of a packet payload is always(?) the id of the message in the specific channel. It is to correctly identify the message that the payload needs to be decoded into, since there is no (more efficient) way to store the message type itself into the payload, correct?
  7. I am currently setting up some networking to synchronize data between Clients and Servers, and I've been running into a problem where I got an invalid discriminator byte on my channel. I've fixed that by "shifting" the data written to the PacketBuffer in my encoding method by one byte. To know what exactly what I'm talking about, you can take a look at this and that class, they contain the important stuff (Mod's main class and the Message class, respectively). The packet is sent off here . (An Item class' onItemRightClick method) Or you can open the spoiler: It seems like the discriminator is somehow tied to the id of the Message registered on the channel but I would like some confirmation/correction on that theory. What is the discriminator actually used for?
  8. I am currently trying to make my mod server compatible, and Forge conveniently sets up with a "runServer" and "runClient" configuration. However, it seems like I'm not able to join the server created by "runServer" with the client from "runClient". I'm assuming it's because the "runClient" client is not a valid Minecraft account, since using my normal one works just fine. It would be nice if it was possible to let the "runClient" client join the server, since I only have one valid Minecraft account atm. Does that work somehow? Edit: The type of error I get is Failed to log in: Invalid session (Try restarting your game and the launcher). Neither restarting the game nor the IDE (just to be sure) helped. When looking at the Console output of the server I get the following message: [Server thread/INFO] [minecraft/ServerLoginNetHandler]: com.mojang.authlib.GameProfile@4c3f1902[id=<null>,name=Dev,properties={},legacy=false] (/127.0.0.1:52506) lost connection: Disconnected, while joining via my legal Account gives me [User Authenticator #1/INFO] [minecraft/ServerLoginNetHandler]: UUID of player Keheck is 65831990-3d68-4646-95c9-2b75429faf43
  9. I was looking for uses of that distribution side, but no class uses that annotation together with this distribution side... (aside from net.minecraftforge.fml.common.Mod.EventBusSubscriber) The javadoc in net.minecraftforge.api.distmarker.Dist class says the following: But that didn't help clarify on what should only be processed on the Dedicated Server side, and does that distribution side also exist on singleplayer worlds? I know that Dist.CLIENT is used for stuff like rendering, but when is it appropriate to use Dist.DEDICATED_SERVER?
  10. I want for my mod to have a gui that can display blocks in a way that it looks like a platform like the one in the image below (the actual appearance may vary though). For that I wrap the blocks to render into an ItemStack and have the ItemRenderer render that stack. Now it seems that Minecraft switches into an orthographic view when rendering GUIs, which makes sense of course, but I'd rather like to have a "correct" perspective onto the gui. Is there a way I can render my GUI not orthographic?
  11. First of, in analogy to how the registration of Entities are handled, I have two classes: the class io.github.keheck.mobfighters.registry.entries.FighterEntry, which is the equivalent of the EntityEntry class: it is a "pattern" class for individual instanced of a Fighter. Then there is the io.github.keheck.mobfighters.fight.fighters.Fighter class, which is the equivalent of Entity class: It is created via a method inside FighterEntry. The constructor of FighterEntry looks like this: public FighterEntry(IFighterFactory factory, EntityType<? extends LivingEntity> entityType) { this.factory = factory; this.entityType = entityType; //also, read your fighter-data here. } IFighterFactory: This is a functional interface. It is used to create an instance of a new fighter whenever it is needed. EntityType<...>: This is used so that when a fight is currently going, my mod has information on what the fighter should look like (I want to do a 3D rendered GUI, but that can wait). Why restrict it to instances of LivingEntity? Because only living entities can do stuff, and it made the most sense to me... As for the registry name of the FighterEntry class: I annotated the setRegistryName(ResourceLocation) with @Deprecated, because the getRegistryName method returns the registry name of it's EntityEntry (see constructor). Now to what I am trying to say: I have, in my FighterEntry class, three other fields: two arrays of io.github.keheck.mobfighters.fight.moves.Move instances and one of io.github.keheck.mobfighters.fight.traits.Trait instances. In the constructor (of the FighterEntry class) I want to read a .json file at a specific location, using the registry name of the entityType field. That way, when a FighterEntry gets added to the registry, it automatically retrieves it's information on what moves it can learn and perform. Why do I want to do it that way? two reasons: I want the arrays to be as immutable from the outside as possible. The first step to do that is to make them private (which they are). The second is to make them not change inside any method of the FighterEntry class. By their nature Moves are very numerous, and Fighters can learn a big number of them (at least, that's what I'm trying to achieve). I don't want modders to waste their time by adding instances of each and every Move they want to add to thier own fighter. Besides that, the code could get *really* long if they add a number of Fighters. If you want to read the code in it's entierety, here's the github repo.
  12. I want to read the data of a FighterEntry while it's being initialized (so during a registry event, in it's constructor), so I can encapsulate the data with no way (except with reflection maybe) to change that data from the outside. I now realize that I don't really need a list of mod domains, since I can just read it's registry name and get the path from there (although maybe I could use the knowledge of getting that list in another I might make) Is there a way to override this property? I only want to use the data/asset system because of this:
  13. Yea yea I already know that, the problem is though that I want to read the data during the mod's setup. Unless I can still use the ReloadListener system?
×
×
  • Create New...

Important Information

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