Jump to content

Frepo

Vintarian
  • Posts

    68
  • Joined

  • Last visited

Everything posted by Frepo

  1. Ok, so this method, OnBlockInteractStart, is first run by the client, where the hunger behavior is not visible. Then the server runs it, where it is visible. There are several checks now to see if the player is allowed to sleep: Temporal storm Tiredness Exposed to rain Too cold Hunger (this one is the only one giving me trouble, the rest works fine) So the client will only check storm, tiredness, rain and coldness, and maybe say "everything's fine here, let the player sleep" (return true). But then the server checks with the inclusion of hunger and may say "no, it's not fine!" (return false). What happens then? Will the player go to bed, but the sleeping mechanics won't kick in? How do we sync this?
  2. I see... or... oh, I don know... I'm having a hard time wrapping my head around the client/server stuff. I mean, I understand that some code is only relevant for the client and vice versa. But I don't understand fully how to know when certain code is "visible" to one or the other (or both). So the entire BlockBed class is only ever read by the client? And that's why the hunger is not "visible" there? This is tricky, usually the IDE tells me when something is out of scope or not visible due to protection levels and such. So I guess what I need to do (from the client here) is tell the server "hey, I want you to give the saturation level of this player that's sleeping in this bed here". But how is that accomplished? I'm gonna search for some keywords here and investigate each place where the hunger is referenced/used/accessed, maybe things will clear up a bit. Thanks for the hint thou, Dark!
  3. I'm just.... baffled. Trying to make the player unable to sleep when starving. Replaced the vanilla BlockBed (patched it with a /replace op on the /class) with my own to include the extra checks. Just a couple of lines above, they get a behavior from the player to check tiredness. I'm trying to do the same to get the hunger behavior... but it turns up null somehow. The player should for sure have the behavior, since well... hunger is very much a thing for the player . It is this one from the RegisterDefaultEntityBehaviors. that the player entity is using, right? .. still the behavior doesn't seem to exist in the player entity. BlockFTBed Has someone else dealt with this behavior? Who could maybe give me a hint here?
  4. Oh, forgot to mention that this problem was solved (forgot to add the block behavior to the ore blocks... ooops)
  5. Yeah I started reading a little bit about harmony, the name came up when I was searching for a solution. Gonna look into that! Seems to be a very handy tool for modders. Thanks for the link. Man, modding is FUN!
  6. Exacly! That's why I suggest moving it to the waist slot, it makes more sense. Even the quiver model is there when equipped. It's already a container for arrows only (10 slots). Guess they removed it because noone will be walking around with 10 stacks of arrrows (at least u don't need it in PvE), and lowering the amount of slots makes it just worse than a backpack (that's where giving it a bonus to draw speed comes into the picture).
  7. I just noticed that OnBlockExploded in BlockBehavior takes in an ref EnumHandling, but OnBlockExploded in the BlockOre class doesn't. The behavior is pretty much empty. This must be the method I'm actually overriding. So I guess I can only add additional stuff, not really override the OnBlockExploded in BlockOre, that code is gonna run no matter what (thinking out loud here) Am I supposed to register my own myBlockOreBlastingBomb and disable the vanilla? Replacing the item entierly? Well, I guess it's the BlockOre I should replace really, but I don't think that would be a good thing to do (worldGen and all...). Or can the method (in BlockOre) be overridden in some other way? I just want to find the "cleanest" way to go about all this.
  8. I'm trying to lower the drop rate from explosions (from using the oreblastingbomb). Sadly I can't add a new value to EnumBlastType. So I though I'd just override the OnBlockExploded method and hardcode in a lower value there. Problem is that my behavior seems to not get called at all. I can't see why. ModCore ExplosionDropNerf behavior class Vanilla OnBlockExploded (BlockOre.cs)
  9. Thanks for the info, Fang! I had a look in the source code for the handbook text stuff. And yeah, it just ain't worth it, there's other stuff I rather spend my time on. "fishing totally breaks food balance" After our first in-game year, I now see what you're saying. There really isn't any balance to begin with. Well, I'm hell bent on changing that!
  10. I noticed there is a quiver in the game, but its not used. Such a shame! Maybe we should give it a proper use instead of just occupying a bag slot. We could "simulate" having quicker access to arrows (which is what a quiver actually does, on top of being a container) by decreasing bow charge time. I suggest increasing overall charge time for all bows with a value, say 50%. The quiver is instead equipped in the waist slot, and provides -50% charge time.
  11. The VS wiki doesn't mention this. Looking at the vanilla language file it looks like I should write something like this However, this does nothing at all. So I went into primitive survival's (which is a VERY nice mod, except for that fishing totally breaks food balance) lang-file to see how they did it. Discovered that it's written the same way there, and thus not working for PS either. How does one go about this?
  12. Aaaaah! I didn't understand you needed an index-position right after ("/variantgroups/n"). I actually never noticed that variantgroups was an array all along! Didn't see the "[ ]", I was focused on the path and the value lines, just took for granted that it was "{ }". Wow, that's a revelation! thank you thank you thank you! One more thing; I strangely messed up the gold and silver arrows arrowhead texture (notice: just the arrow head) when inserting the bone texture for my arrow. { "op": "replace", "side": "server", "path": "/texturesByType", "value": { "*-bone": {"material": { "base": "game:block/bonesrotten" }}, "*-flint": {"material": { "base": "game:block/stone/flint" }}, "*-crude": { }, "*": {"material": { "base": "game:block/metal/ingot/{material}" }} }, "file": "game:itemtypes/tool/arrow.json" }, First I tried with the "add" operation, but that messed all other texures up, except for my bone arrow. So I just replaced the entire section. Then everything looked good except for silver and gold. But I thought what ever, noone makes those arrows anyway, right?
  13. Hey! That worked! Thanks man! I didn't know adding your modId was a thing, I always thought it was supposed to be left empty when using own assets, and "game:" for using vanilla assets. Thanks again man.
  14. THE SOLUTION Turns out you need your own bucket to go with the liquid to explicitly specify your modid in creativeinventoryStacks.
  15. UPDATE ON RECENT EVENTS IN THIS MYSTERY Changed "game:woodbucket" to just "woodbucket". The game doesn't crash anymore, but gets stuck in an infinte loading screeen at end of server startup. This removed the critical error "send ServerAssets failed", but gave me instead [Warning] Failed resolving a blocks blockdrop or smeltedstack with code fregtech:woodbucket in Creative inventory stack of Item fregtech:adhesiveportion and [Error] System.NullReferenceException: The object reference has not been set to an instance of an object. makes sense in a way, cuz there is no fregtech woodbucket, just vanilla woodbucket.
  16. On to the next problem that's been bugging me for ages. Trying to add a new non-placeable liquid (just like eg. tannin). Copied the weaktanninportion.json, made my own texture, formatted the json to my adhesiveportion.json, and thought that would be just about it. But oh neeeeooow... the game crashes during server startup. Log files complaining about "can't create itemstack without a collectible!" and " send ServerAssets failed". Dunno what that's all about... yet. client-crash.txt
  17. THE SOLUTION { "op": "add", "side": "server", "path": "/variantgroups/-", "value": {"code": "material", "states": ["bone"]}, "file": "game:itemtypes/tool/arrow.json" }, I was a bit confused, to say the least, reading the patching "tutorial" at the VS modding page. At the "overwriting issue" part, there's a little demo-snippet of adding a behavior (which I thought would be pretty much the same as adding a new element to the variantgroup array). As you can see at the "value" line, the syntax differs from my (finally working) solution, the brackets "[ ]" are placed differently. I'm not adept enough yet to draw any conclusions about this. { "op": "add", "path": "/behaviors", "value": [{ "name": "SealPlacedCrock" }], "file": "game:itemtypes/resource/fat.json" } ------------------------------------ Is it possible to add additional types into a variantgroup through patching? And how would that patch look like? Can't find any examples online. Eg. variantgroups: [ { code: "material", states: ["crude", "flint" ] }, ], ...and add "bone" to the list variantgroups: [ { code: "material", states: ["crude", "flint", "bone" ] }, ], I've gotten all other forms of patching working so far. But trying this won't work no matter how I try to write it. So I've started to mod this wonderful masterpiece of a game! Haven't got into C# coding yet. But I think I've gotten the hang of changing recipes and patching stuff like nutrition in food and textures on vanilla items (noticed that lead and silver solderbars both used the tin texture, and fixed that). Then I made some custom items; Shroompowder (made mushrooms grindable in the quern) and a steel variant of the soldering iron. So far so good. THE PROBLEM So I ran into some serious trouble when attempting to add a new type of arrow (bone arrow). First I made the arrow head and the arrow itself in their own jsons (copied from vanilla). Just changed the texture of the arrow head, had it use the flint arrow shape and set it's own damage and breakchange values (so the arrow item/entity is still an instance of the ItemArrow and EntityProjectile classes). So I crafted a couple of arrows, threw them on the ground, picked them up again, took aim with my bow, bone arrow loaded, and let loose.... that's when the game crashed. The log mentions the ItemBow.cs class. Looked for ages in the itemtype, shape and entity jsons, but can't see what could cause the problem. I thought maybe the ItemBow class somehow must recognize the arrow, and it won't with custom arrows this way (I don't know, maybe all arrow types are instanciated at startup of VS before starting a server and loading the mods or something). I realize that this item is a little more complex since it involves projectile entities. So my next attempt was to instead just patch the jsons to include "bone" as a material, and thus as it's own type. The game doesn't crash anymore, but the arrow won't show up when I search for it. It simply doesn't exist. MY QUESTION What am I missing here? Is it even possible to add custom arrows without coding?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.