A mod idea...

  • FTB will be shutting down this forum by the end of July. To participate in our community discussions, please join our Discord! https://ftb.team/discord

Davidobot

New Member
Jul 29, 2019
99
0
0
I wouldn't say I have *NO* real programming experience, just that I don't speak 'Java'. I've done coding in FORTRAN, COBOL, and was just starting to dabble in C++ when I got out of the field, BASIC and Pascal I picked up in high school. I'm familiar with the logic of programming, and the various conceptual processes, I'm just not familiar with the precise syntax required.

Perhaps I should go pull out a Java tutorial or three and maybe tackle a couple of easier mods first before trying this?
That would be a wise decision.
 

arkangyl

New Member
Jul 29, 2019
295
0
0
Sure thing. This mod will require base class edits. Have fun.
Unless you were to create a whole new set of Villager classes, leave the originals unmodified, and then set the originals to never spawn, but... then you have an entirely different set of issues with getting other mods to recognize your Villagers as Villagers. Or wait until the vaporware modding API hits, at which point a change like this should be relatively trivial.
 

ShneekeyTheLost

Too Much Free Time
Dec 8, 2012
3,728
3,004
333
Lost as always
Unless you were to create a whole new set of Villager classes, leave the originals unmodified, and then set the originals to never spawn, but... then you have an entirely different set of issues with getting other mods to recognize your Villagers as Villagers. Or wait until the vaporware modding API hits, at which point a change like this should be relatively trivial.
In theory, this methodology would likely make it much easier, as I would also be able to just disable village spawning entirely and replace it with my own code, which means I could set up more intelligent village spawning instructions, and a more intelligent village layout design in the process.

Then the whole code could be wrapped up with IWorldGenerator.generate with my new spawning instructions, and the only base class edits would be 'ignore anything to do with villages or villagers'.

Granted, this would just make it incredibly similar to Millenaire, but it should be a lot easier to pull off...
 

arkangyl

New Member
Jul 29, 2019
295
0
0
In theory, this methodology would likely make it much easier, as I would also be able to just disable village spawning entirely and replace it with my own code, which means I could set up more intelligent village spawning instructions, and a more intelligent village layout design in the process.

Then the whole code could be wrapped up with IWorldGenerator.generate with my new spawning instructions, and the only base class edits would be 'ignore anything to do with villages or villagers'.

Granted, this would just make it incredibly similar to Millenaire, but it should be a lot easier to pull off...
Hmm. I just have a sneaking feeling that while this tactic is doable, I think there's probably going to be issues with it, namely, the rewriting of all the Villager/Village code. I'm guessing you could inherit the Villager/Village classes to avoid that, and the "other mods recognizing my Villagers" issue, but I'm not 100% sure on the details of that code's structure. I haven't modded anything since 1.2.5, and I never touched Villagers or even Mobs. I have half a mind to grab the latest MCP and look into this.
 

ShneekeyTheLost

Too Much Free Time
Dec 8, 2012
3,728
3,004
333
Lost as always
Hmm. I just have a sneaking feeling that while this tactic is doable, I think there's probably going to be issues with it, namely, the rewriting of all the Villager/Village code. I'm guessing you could inherit the Villager/Village classes to avoid that, and the "other mods recognizing my Villagers" issue, but I'm not 100% sure on the details of that code's structure. I haven't modded anything since 1.2.5, and I never touched Villagers or even Mobs. I have half a mind to grab the latest MCP and look into this.
Yea, I just thought of the trouble with cross-mod compatibility as well. If it could inherit villager/village classes, that would help avoid that, but if it can't, the only way I can think of, other than making villager hooks and requesting other mod authors edit THEIR code to be compatible (always a BAD idea, IMO) would be to have some way of detecting other mods looking up the relevant classes and redirect them.

It *might* be possible for the village/villager classes to simply be a re-direct to your own, but I don't know how viable that would be in Java. That would be incredibly kludgy, though... it would feel like using GOTO...
 

GreenWolf13

New Member
Jul 29, 2019
188
0
0
goto.png
 

arkangyl

New Member
Jul 29, 2019
295
0
0
Yea, I just thought of the trouble with cross-mod compatibility as well. If it could inherit villager/village classes, that would help avoid that, but if it can't, the only way I can think of, other than making villager hooks and requesting other mod authors edit THEIR code to be compatible (always a BAD idea, IMO) would be to have some way of detecting other mods looking up the relevant classes and redirect them.

It *might* be possible for the village/villager classes to simply be a re-direct to your own, but I don't know how viable that would be in Java. That would be incredibly kludgy, though... it would feel like using GOTO...
Ok. I've taken a look. Someone (probably Mojang) has restructured/reorganized their code a lot since last I modded. It looks like it'd be totally doable to inherit/add to the Villager class. A cursory look at the Village code seems doable, too.

I'm strongly considering refreshing myself on modding with the goal of taking a crack at this. It's a mod idea I'm fully behind. Villages are one of the most half-baked Minecraft ideas that really have no satisfactory mod improvements made to them without going a little "off the deep end" like Tales of the Kingdom(?) and Millenaire. If you're interested, feel free to message me. I'm hardly a professional modder, having not released any mods, but I am a decent Java coder, and modding is hardly a foreign concept to me.
 

Chocorate

New Member
Jul 29, 2019
1,257
0
0
This really should be in vanilla, along with better villages. Fix village generation and roads, and make it so I don't get 6 villagers who want to trade 9 diamonds for 1 emerald. -_-
 

Hydra

New Member
Jul 29, 2019
1,869
0
0
This really should be in vanilla, along with better villages. Fix village generation and roads, and make it so I don't get 6 villagers who want to trade 9 diamonds for 1 emerald. -_-

Everything is possible, it just requires time. And it's not like hiring 10 programmers all of a sudden makes progress 10 times as fast. If that would be the case there would not be so many failing IT projects ;)
 

ShneekeyTheLost

Too Much Free Time
Dec 8, 2012
3,728
3,004
333
Lost as always
This really should be in vanilla, along with better villages. Fix village generation and roads, and make it so I don't get 6 villagers who want to trade 9 diamonds for 1 emerald. -_-
The trade system will get a complete overhaul, and we've already decided we're moving off the 'emerald standard'. Right now, we're leaning towards our own currency system, and I had an idea that the village doesn't sell anything back to the player that the player sold them to avoid turning it into a huge inventory. I also had an idea that the village also won't sell anything to the player which it doesn't actually possess. Thus it won't be able to sell diamonds to the player because they don't have a way of obtaining them.

At the moment, we're just at the earliest stages of the development: seeing if this is even *possible*, so anything stated at the moment is up in the air and may be changed without notice, depending on coding viability.

Right now, we've determined that it is *theoretically possible* do do different village spawning, however the problem is that there's a good chance it'll break compatibility with other mods, depending on how they 'hook' into villages for their own spawns. I'm standing back and letting Arkangyl look at that. I'm just providing ideas and building design concepts at this point.
 

Hydra

New Member
Jul 29, 2019
1,869
0
0
I really like the ideas BTW. I have been thinking about a mod that's similar myself (but on other ways completely different) and although I am a Java dev (or atleast, have been for over 10 years before I moved on to a commercial function) and could code it, I also know that it simply would take too much of my time.

Having a 'task based' AI for villages isn't really hard to do and it's not CPU intensive BTW. The process would not have to recompute everything every tick. Just recompute the next 'task' when the current one is either done, or you can't complete it because some item is unreachable for example. That's basically how games like The Sims work.

You could get quite 'real life' behaviour if you would build a model similar to the piramid of Maslov where you would try to fulfill the needs of villagers from the most important to the least important. It's actually quite a lot of fun to do, I did something similar for another project I did a few years ago (simulating website visitors).
 

MrZwij

New Member
Jul 29, 2019
452
0
0
The trade system will get a complete overhaul, and we've already decided we're moving off the 'emerald standard'.
Just spitballing here, but you could use a barter system based on the EMC system from EE2, where everything is assigned an intrinsic value. It didn't work well in that context, but if you built in some profit and overhead for the merchants, it could in this one. Here's a table of the values.
Right now, we're leaning towards our own currency system, and I had an idea that the village doesn't sell anything back to the player that the player sold them to avoid turning it into a huge inventory. I also had an idea that the village also won't sell anything to the player which it doesn't actually possess. Thus it won't be able to sell diamonds to the player because they don't have a way of obtaining them.
You could justify selling unusual things by expanding your imaginary world to include other players Steve never meets, who travel around and occasionally trade rare objects with villages.
 
  • Like
Reactions: Chocorate

Hydra

New Member
Jul 29, 2019
1,869
0
0
Just spitballing here, but you could use a barter system based on the EMC system from EE2, where everything is assigned an intrinsic value. It didn't work well in that context, but if you built in some profit and overhead for the merchants, it could in this one. Here's a table of the values.

IMHO it makes much more sense to base it on needs / surplusses. So a simple economy where they buy stuff they need in exchange for stuff they have a surplus of. That way the stuff they offer will change depending on how advanced the village gets. So for example when they have a forge they need coal to fire it, but once they have that and also have a stock of iron they start selling weapons. When they also have an enchanter they start selling enchanted weapons. Etc. Just having a villager offer you 8k gravel for a diamond isn't very useful :)
 

MrZwij

New Member
Jul 29, 2019
452
0
0
IMHO it makes much more sense to base it on needs / surplusses. So a simple economy where they buy stuff they need in exchange for stuff they have a surplus of. That way the stuff they offer will change depending on how advanced the village gets. So for example when they have a forge they need coal to fire it, but once they have that and also have a stock of iron they start selling weapons. When they also have an enchanter they start selling enchanted weapons. Etc. Just having a villager offer you 8k gravel for a diamond isn't very useful :)
Good point. I wasn't really thinking that every single thing would be available, but I failed to spell that out. It makes a lot of sense to have a limited common-sense-based set of commodities the villages will have available, plus probably a cap on the amount of a particular item, plus the occasional random rare item I mentioned above.
 

ShneekeyTheLost

Too Much Free Time
Dec 8, 2012
3,728
3,004
333
Lost as always
Furthermore, I also had an idea that they will only purchase so many of a single block before they simply aren't interested in it, and if it is a renewable resource, and they have access to a way to generate it, they'll never purchase that item. So if they already have a 'quarry', they'll never purchase cobblestone, or anything else which is directly crafted from cobble (smooth-stone, stone brick, cobblestone/stone brick stairs/slabs/walls). This keeps you from simply dumping fifty or so stacks of cobble on a village and instantly being able to buy anything you'd want.

Again, everything is still at the 'planning and plotting' stage of development. I think we're going to start with the actual village spawning mechanics and layout improvement first, and see if we can't get that hooked into other mods, before working on villager AI. It seems, at first glance, to be the easiest of the challenges to undertake, and will have something which is able to be released as an alphadev version.
 

Democretes

New Member
Jul 29, 2019
1,134
0
1
Furthermore, I also had an idea that they will only purchase so many of a single block before they simply aren't interested in it, and if it is a renewable resource, and they have access to a way to generate it, they'll never purchase that item. So if they already have a 'quarry', they'll never purchase cobblestone, or anything else which is directly crafted from cobble (smooth-stone, stone brick, cobblestone/stone brick stairs/slabs/walls). This keeps you from simply dumping fifty or so stacks of cobble on a village and instantly being able to buy anything you'd want.
I wouldn't go so far as to anything crafted from cobble. If a village has no way to smelt cobble into stone, then it still should accept stone and stone bricks afor trading. Once it has furnaces and such going, it will no longer accept stone for trade, or accept it for a small amount.
 

Yuka

New Member
Jul 29, 2019
318
0
0
I wouldn't go so far as to anything crafted from cobble. If a village has no way to smelt cobble into stone, then it still should accept stone and stone bricks afor trading. Once it has furnaces and such going, it will no longer accept stone for trade, or accept it for a small amount.

But if they have cobble, couldn't they just make a Furnace?