-
Posts
167 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Turtledove
-
Post your same class in 1.15, it'll be obvious if it's 1.12 or not based on the class names.
-
Setting Entity to spawn only once per world - 1.15
Turtledove replied to Turtledove's topic in Modder Support
An idea I've just had: When a player first spawns into a world (checked via a value set in player capabilities), set a radius in the XZ direction, and find an appropriate y level to spawn the entity in. Would this work? If an entity is spawned where chunks haven't been loaded yet, what happens? -
I've created some npc entities that I'd like to have spawn only once in the world. They can't die (unless you break bedrock and make them fall into the void) so they don't need to have any special respawn mechanics. How can I achieve this? Is there a way I can save whether an NPC has been spawned to the world?
-
It doesn't look like you know Java, go learn that before trying to make a mod.
-
So I was having a gander at the docs, and I see this: Is this inclusive or exclusive? I.e. Can I have something like this?
-
Bruh this isnt a forum for fabric, that's not forge related at all
-
I've been reading Jabelar's old guide on this topic (http://jabelarminecraft.blogspot.com/p/minecraft-modding-custom-dimension.html) and I was wondering, if I want to add a biome to the Overworld, do I still need to create a worldprovider and chunk generator? I just want to add a variant of the existing ocean biomes with different water color. Edit: Nope you do not. Just registering the biome is enough
-
So I've defined a custom entity behavior called EntityAIFaceOff, and it basically just has my entity find a path to the player and stop at a certain distance. These are the conditions for stopping the execution: It all works fine on solid ground, but when I lead the mob into water it'll stop chasing me because its path to me becomes null. It reverts to its wandering AI and floats around with the swimming AI and wandering AI. I took a look at the zombie's AIs and didn't see anything special it was doing there, I use all the same path finding methods. How exactly does Minecraft's pathfinding work when the mob is in water? Edit: I've sort of replicated the Vanilla one by manually setting the entity's motion to go towards the player if it's in water. Not sure if there's a better way I can do it tho.
-
If it's your first time making a mod this really isn't the best way to start, do some small projects to get a grasp on how forge works. This is non-trivial to do in a proper game engine and you need OpenGL know-how if someone wants to do it without one. But even then it's likely not possible to do in Minecraft the way you want to. To do this you need to look up terrain information block-by-block, write to a texture, and read from it the next frame (you can't read/write to a texture at the same time in OpenGL). On top of all that, you can't do this the same way you'd do it in a normal C/C++ project with Opengl because minecraft abstracts said OpenGL calls and changes the states as it does it own thing.
-
[1.15] Is there a way to prevent the Hit Animation of an Item?
Turtledove replied to 4AAAA4BBBB's topic in Modder Support
Cancel RenderSpecificHand event when the swing ratio is active and render your own hand or item. -
Hmm, would it work to just check for the item's registry name? Or would this not work in an obfuscated environment? I.e. check if the item's registry name has the word "cooked" in it.
-
Is there a way I can at least see what type of food an ItemFood object is though?
-
So I'm setting up a custom furnace with 4 slots, and I've already got a block registered, now I just need to create a tileentity and create the GUI. I'm familiar with setting up a gui with IItemhandler so that's not really anything new, but in the TileEntity, how exactly should I go about checking what kind of food an item is? In order to cook it I mean, and whether it's uncooked or not.
-
[1.15.2] Questions regarding dynamically-generated GUIs
Turtledove replied to Blazer Nitrox's topic in Modder Support
What stops you from knowing a node's position at runtime? Try to separate the concept of a node to anything related to your skill tree. If you can calculate/determine what skills a player knows at any time from player capabilities, access it from the GUI. Determine a pre-determined layout of the tree, like where a node will go (the physical node, not the skills attached to it) and where to draw arrows pointing to it. For example, if you have 40 skills in the tree, you could set up a lookup array of size 40 to determine if a node representing a particular skill should be drawn or not. This is the background layer. And in the foreground, overlay your skill name, description, etc over their respective positions. Then within the various mouse action methods, access this array whether it should detect player hovers/clicks there or not. This is something similar I've done, if a player doesn't want to have the third row for example, the node and the arrows pointing to it aren't drawn. Notice that some concessions needed to be made, like the length of the names (I've formatted the string so it's inside the node, but anything longer will make the text go over the boundary). But if I wanted to, I could even vary the size of each node and have a lookup table that tells me how large a certain node needs to be for a certain skill name. Edit: All a node should be is a quad with a texture, nothing more. You shouldn't need to register anything as David said -
Yup, fixing that got it to work. I really need to manage capability data initialization and read/writes better. Is there any tips for managing multiple systems on a player capability? My capability class controls mana, accuracy, defense, passive skills, etc. If this were one of my Unreal or OpenGL projects I wouldn't have to centralize all this data onto a single class.
-
Ah you're right, if I print the data parameters every tick server-side, none of them are initialized until I send my packet from the client after editing the grid in the inventory. I'll get back to you on that and see what happens if I fix it. Unfortunately having both is kind of necessary, it makes some of the referencing I need to do 100x times cleaner, for example it's used to determine which attack the player should do on a certain number of clicks:
-
Alright my player capability class is pretty big, but here's all the relevant parts. The parts removed for clearer reading just affect stuff like bow accuracy, player combat, etc. Anyhow, the 3x3 container (implemented here as a 1-d array) has initial values when the player first joins the world, and they can manipulate values within it from my custom player inventory. All of this works perfectly fine, I send a packet from client to server when the GUI is closed, plus for testing purposes I manually sync both client and server every 1200 ticks. But yeah the problem is that it does not save, when printArtes() is called, it prints what it was initially set to in the constructor: https://pastebin.com/y8R0Up3L
-
It's got nothing to do with how I'm writing/reading nbt data within the data provider class, I'm 100% certain of that, plus it implements ICapabilitySerializable and doesn't rely on strings as tags. I guess I'm confused about what exactly happens when readnbt is called when used on a player capability. I.e, how does it determine which member variables to populate? It does so just fine for other member variables of my player capability class, but does not for my array variable.
-
I'm attempting to write and read members of my player capability class, and for things like my stamina, accuracy, fuel variables, when I exit the game and return, it 100% works and saves just fine. However, I also have a 3x3 grid of user bound indices that I've represented as a one dimensional array of integers, which I then created 9 integer data parameters of, registering and setting it like the others. When I go to print these values within my serializenbt method, the correct values are printed, i.e. 2,4,1,0,... However, when I print them after the readNBT call within the deserialize method after exiting the game and reloading, it just prints the default values for them, 0,0,0,0,... Note that this is immediately after calling readnbt in the same deserializeNBT method. Both these methods are called on the logical server, and the client/server side for these variables are synced, so I don't believe it could be a server/client side issue. There's nothing weird with how I'm calling the two methods, since it works for all my other variables. The only time I set these variables to 0 is in the default/nondefault constructor as well. Anyone know what it could be? Does it just not work well with arrays?
-
Hey I have no clue what I'm doing. Why doesn't this work?
Turtledove replied to Jambaloo's topic in Modder Support
Learn Java before modding, copy/pasting stuff without understanding how or why it does what it does isn't going to work. -
I've written a player capability class which keeps track of some statistics kept and incremented on the server. Most of the information isn't expected to be updated very often so it's only synchronized with the client when it meets a certain flag. However, some of the information (stamina, fuel, etc) is updated every tick, and directly affects client-side rendering. For example, the player cannot left click (the hand's swing render event doesn't even trigger) if stamina does not meet a certain threshold. Sending packets back and forth between client/server every tick is obviously a terrible idea, how should I approach something like this? Is it possible to keep two counts running synchronously between client/server? And then sync the two every once in a while.
-
[unsolved] Can't hit player from entity AI w/ attackEntityFrom
Turtledove replied to Turtledove's topic in Modder Support
It appears that the damage source is the issue, when I set my custom entity as the damage source it causes attackEntityFrom to return false most of the time. But when I instead set the source as a generic type, it works 100%. Strange. Looking through the multiplayer class's attackEntityFrom (or its parent class) there's nothing there to indicate there'd be a problem. -
[unsolved] Can't hit player from entity AI w/ attackEntityFrom
Turtledove replied to Turtledove's topic in Modder Support
attackEntityFrom keeps returning false. When I reload the world it sometimes works, but most times it doesn't. -
[unsolved] Can't hit player from entity AI w/ attackEntityFrom
Turtledove replied to Turtledove's topic in Modder Support
Never mind, it's not working again. Why on earth is this happening?