Standards or lack thereof
Jan. 4th, 2022 12:44 pmI have encountered both situations. There's a lot of open-source devs out there that don't seem to understand that an API (Application Programming Interface) is supposed to be a STABLE interface to back-end code; you can re-arrange the back-end code to suit, but the interface (API) is supposed to remain the same.
Minecraft Modding, Redux
Aug. 13th, 2021 07:07 pmAn update to my original Minecraft Modding post, focusing on 1.13/1/14 modding and later. Refer to the older post for older versions of Minecraft. The old one got a bit unwieldy for updates.
Not all modding tutorials are useful. Some are outdated, and some were written by people with a shaky grasp on Java, how Minecraft works internally, the MinecraftForge source, or all three. A lot of them are uninformative, because the authors start at the beginning and never get to advanced topics, so you have a lot of tutorials on how to make a basic block, but very few (if any) on how to add new crops or render entities or add new crafting interfaces.
( Read more... )Notes on new Tool system in 1.17.1+
Aug. 13th, 2021 07:03 pmBuild: 1.17.1-37.0.31 - Tue Aug 10 22:45:23 GMT 2021
gigaherz:
Redesign the tool system to rely on the new vanilla tags. (#7970)
Changed:
- ToolType is replaced with ToolAction, which can selectively represent which actions are supported by an item.
- Added a canPerformAction method to query ToolActions.
- Renamed canHarvestBlock to isCorrectToolForDrops to match vanilla.
- Added TierSortingRegistry, which can be used to add custom tiers and supports sorting between vanilla or with other mods.
How to use:
For the breaking system there's 2 methods:
- getDestroySpeed decides if an item *can* mine the block fast. Override if you have multiple tags or your item isn't a DiggerItem.
- isCorrectToolForDrops decides if an item will get drops. Returning false will also slow down mining, regardless of getDestroySpeed. Override if you have type-dependant tiers or your item isn't a DiggerItem.
For the tier system mods can just call `TierSortingRegistry.registerTier(tier, "name", List.of(lesser tiers), List.of(better tiers));` to register their tiers.
There's helper methods to query tiers such as TierSortingRegsitry.isCorrectTierForDrops.
The ToolActions solve 2 problems:
1. distinguishing which kind of digger an item can be
2. querying if the item can perform specific secondary actions.
Any item can override `canPerformAction` to customize which actions it performs.
Additional notes from Gigahertz on updating tools:
Remove the harvestTool and harvestLevel calls from the blocks
and instead, add the block to the relevant tags
ToolType.AXE -> minecraft:mineable/axe
ToolType.PICKAXE -> minecraft:mineable/pickaxe
ToolType.SHOVEL -> minecraft:mineable/shovel
and so on
- harvest level 0 -> forge:needs_wood_tool
- was harvest level 0 but you want only GOLD tools to mine, not wood -> forge:needs_gold_tool
- harvest level 1 -> minecraft:needs_stone_tool
- harvest level 2 -> minecraft:needs_iron_tool
- harvest level 3 -> minecraft:needs_diamond_tool
- harvest level 4 -> forge:needs_netherite_tool
if you define a custom tool type, define a custom tool type tag, can be optional if you don't have any default blocks
if you define a custom tier, register it into the TierSortingRegistry
if your tier is supposed to be equivalent to a vanilla tier, specify the tier you want to be equivalent to in the "after" list, the tier right after that in the "before" list, and have an empty optional tag in your tier.
you can use ForgeTier as a convenience
Minecraft mods: Ashenwheat
Jun. 16th, 2020 09:55 pmI thought Ashenwheat was going to be a simple port from 1.12.2, but noooo... there were a lot of new issues to unravel. Like, how to add seed drops to grass? (Answer: GlobalLootModifers) How to add seeds and other items as dungeon chest loot? (Answer: loot pool injection). Why isn't one of the crops growing once planted? (Answer: you forgot to give it the 'tickrandomly' property). Etc, etc, etc.
Minecraft Forge 1.14.4/1.15.2 modding is such a complete paradigm change from all previous versions that I refuse to support any of my mods from previous versions. I just can't wrap my head around the older way of doing things in addition to everything else.
The golden ages of Minecraft modding have been:
- 1.6.4 (Forge API mature, negates need for jar mods),
- 1.7.10 (Forge & Minecraft stayed on this version for a long time, so a lot of mods were written)
- 1.12.2 (Forge stayed on this version for a long time, because a complete rewrite was needed for the internal changes to 1.13+)
I predict that 1.14.4 & 1.15.2 may be another, because Forge has committed to long-term support of 1.14.4, in addition to following Mojang's updates. That will give mod developers a stable target to aim at. Or we'll all jump to 1.16 when it comes out, because there's a major rewrite of the dimension internals, so makers of dimension mods might want to take advantage of that, I don't know.
More Minecraft modding...
May. 21st, 2020 09:04 pmNext up: "akkamaddi's Hadite Coal", which I ported to 1.12.2 at one point, so it should be easier to port than the really old stuff.
Then, I think I'll port "akkamaddi's Ashenwheat", just for a change of pace from ore & tool mods. I'll learn how to do crops in 1.15.2.
Then, if I still have no response from Zot21, I'll fork his mod, "Only Silver", which added silver ore and tools back into Simple Ores (or could be used stand-alone). It's under the Apache open source license, so the author long ago gave the world permission to port his stuff.
Eventually I'll port the rest of akkamaddi's Additions (to Simple Ores). "Sterling & Black" depends on "Only Silver" (or any other mod that provides silver), which is why "Only Silver" is on the menu. I *think* the rest just depend on Fusion, which has been ported. They are also ore & tool mods with alloys, all of which coding I've learned how to do.
I may junk the recycling recipes, since vanilla has added recycling by way of smelting used weapons & armor. Or perhaps not, as fusion furnace recycling yields ingots rather than nuggets, but costs catalysts and extra inputs, so it is a balanced alternative. We'll see.
And more programming stuff..
May. 19th, 2020 08:59 pmIn Minecraft modding news, I investigated a crash bug one of my users reported, and kicked myself for blowing off testing my code in server-client configuration, as well as in single-player configuration, because the alloy furnace thingy (aka the 'fusion furnace') was indeed "crossing the streams" and calling server-only code from the standalone client. Whoops. I fixed that, but between overhauling WeatherMaker and the Fusion mod's little issue, I haven't moved forward with any of my modding--just fixed bugs for several days now. Meh.
Fusion is progressing...
Apr. 25th, 2020 10:03 pmIf I ignore the configuration and JEI support issues, I could probably release an alpha tomorrow.
I've also updated my minecraft links page a bit (It's the one on the sidebar over there ==> ).
I used to maintain a series of Minecraft mods whose original developers had abandoned: SimpleOres and related add-ons. I'm finally getting back to porting those mods up the the current modded Minecraft version 1.15.2.
So far:
- Simple Ores, the base mod, has been ported to 1.15.2. Shears work properly.
- Netherrocks, the only add-on that does NOT require the Fusion mod to be working, has been ported to 1.15.2. The funky properties of nether metal armor and tools work properly.
Next in my sights: Fusion, because all the remaining add-ons depend on that alloy furnace working.
Courtesy of Draco18s:
The loot modifier is a replacement system for HarvestDropsEvent. It allows a modder to hook into the loot system and examine or modify the loot being dropped without having to overwrite dozens or possibly hundreds of loot tables (which does not have inter-mod compatibility: if two mods try to replace the same loot table, which ever mod loads last wins).
As an example, a smelting enchantment that when used on any block causes it to drop the item as if it was smelted in a furnace instead of its usual drop.
There's essentially three pieces:
1) The json data file
2) The backing code
3) The inclusion of the registry name in the global_loot_modifiers.json Forge data file (this file is the tag-like master list: any modifier not listed will not be loaded, the rest are loaded in the resulting order from the data file merging, same as how tags are handled).
#3 is the easiest. Just create a new json file called global_loot_modifiers in the Forge data/loot_modifiers folder and list the registry names of your modifiers.
#1 is the serialized form of your modifier. The important bit is the conditions attribute which determines under what conditions your modifier is executed.
#2 is the java code that actually performs the loot modification, similar to the code you would have used in a HarvestDropsEvent handler.
So as an example, the smelting modifier.
1) https://github.com/MinecraftForge/MinecraftForge/blob/1.15.x/src/test/resources/data/global_loot_test/loot_modifiers/smelting.json#L2-L16
Line 17 is obsolete and I forgot to clean it up.
2) https://github.com/MinecraftForge/MinecraftForge/blob/1.15.x/src/test/java/net/minecraftforge/debug/gameplay/loot/GlobalLootModifiersTest.java#L77-L104
Lines 98-103 are a factory class (same as is used in all other json data classes)
Lines 78-80 are a standard constructor, most modifiers likely won't need something more complex (but here's an example). Its just whatever data gets stored in the json and is deserialized, it needs to be passed in. The parent class only needs to know about the conditions.
Lines 84-88 is the automatically invoked method that performs the modification. Smelting is a little complicated, but those lines there just say "for every item in the generated loot, attempt to smelt it."
Lines 90-96 is the method that attempts to smelt a given item. It just fetches the smelting recipe list, smelts the input, and collects the output. If the item can't be smelted, then the item itself is returned. All you're looking at is a sequence of LINQ queries.
3) https://github.com/MinecraftForge/MinecraftForge/blob/1.15.x/src/test/resources/data/forge/loot_modifiers/global_loot_modifiers.json#L5
Should be pretty self explanatory
And of course, the serializers are Forge registry entries, so they need to be registered. These are the registry names that are looked up from the "master list" that step 1 builds.
https://github.com/MinecraftForge/MinecraftForge/blob/1.15.x/src/test/java/net/minecraftforge/debug/gameplay/loot/GlobalLootModifiersTest.java#L58-L62
Peacepack is live on CurseForge
Jul. 12th, 2019 08:43 pmhttps://www.curseforge.com/minecraft/customization/peacepack
It is also on my GitHub as release of v1.0.0 of same.
Peacepack: A datapack for Minecraft 1.14
Jul. 6th, 2019 12:03 pmSo I created a datapack that adds recipes to make several such items. The nice thing about datapacks is that they are not mods; they are part of vanilla Minecraft's customization and don't require Forge, or Fabric, or any other mod loader. Loading a datapack is like adding an alternate texture pack. General instructions here: https://minecraft.gamepedia.com/Tutorials/Installing_a_data_pack
Peacepack (on Github) is currently a work-in-progress; I'll post it as a zipped datapack somewhere when I'm done tweaking it. In the meantime, there it is on GitHub.
Simple Ores & Add-ons Roadmap for 1.14
Jun. 23rd, 2019 08:00 pm- SimpleOres -
already in progress. Need to work out shears, bucket. Note: onyx blocks need new texture to match revised vanilla netherrack texture.Pretty much done, until Forge implements a better way to do shears and fixes their fluid block handlers. Up on CurseForge now. - SimpleOres: Netherrocks - Phase one, a simple ore & tools mod. (And no friggin' buckets!) Changed mind; will implement nether furnace in phase two (beta).
- SimpleOres: Aesthetics (phase 1) - mostly standard objects with new skins.
- SimpleOres: Machines - need to implement furnaces.
- SimpleOres: Fusion - need to implement fusion furnace. non-trivial.
- SimpleOres: Aesthetics (phase 2) - Add objects made from SimpleOres:Fusion metals.
- akkamaddi's Hadite Coal - requires SimpleOres:Fusion. Texture needs reworking.
- akkamaddi's Cthon - requires SimpleOres:Fusion
- akkamaddi's Simple Arsenic and Old Lace - requires SimpleOres:Fusion
- akkamaddi's Golden Glitter - requires SimpleOres:Fusion
- akkamaddi's Simple Tungsten - requires SimpleOres:Fusion
- akkamaddi's Sterling and Black - requires SimpleOres:Fusion, add a Silver Ore.
- akkamaddi's Classical Alchemy - requires SimpleOres:Fusion, and Simple Arsenic and Old Lace.
- akkamaddi's Simple Tungsten - requires SimpleOres:Fusion, and SimpleOres.
- akkamaddi's Steely Glint - will not be ported, as it is redundant with SimpleOres:Fusion's steel.
- akkamaddi's Ashenwheat - who knows? Want to add more peaceful crops to it.
Playing Minecraft again...
May. 27th, 2019 09:29 pmOops, accidentally posted while editing tags. To continue...
I'm playing vanilla Minecraft because most of the modded world hasn't gotten past 1.12.2, because the Forge modding API and mod loader hasn't been released in a non-alpha state for 1.13, let alone 1.14.1. There's a competing "lightweight" modding API and mod loader, Fabric, that is out for 1.14.1, but not all that many mods yet, and most of them are by people I've never heard of. (Fabric proper includes one dev I greatly respect, though--asiekierka). And, of course, I wanted to try 1.13 and 1.14's cool new features. Mojang has added a lot of things that used to be mod-only to the vanilla game, like campfires and capturable fish and concrete you can mix and pour, and more undersea ruins and undersea "plants" like kelp forests and seagrass and coral reefs. They've added more animals, like polar bears and dolphins and turtles. Over in the part of the game I don't play, they've added more monsters, mostly undead variants. Also raiding hordes of brigands called 'illagers'. (They're like villagers, only they look grey/ill--same guys found in woodland manors in 1.12.2. Now they have outposts and ride buffalo-things)
However, there are mods I miss greatly. Here's what I really hate doing without, and by "hate doing without", I mean "grit my teeth and not scream" when I hit one of the things that I can't do/have to do because I don't have the mod.
1. Fast Leaf Decay! If I never wait on a leaf blocks to rot and drop saplings again, it will be too soon.
2. JEI - without that ever handy 'U for use' button, I'm back to the bad old days of 'look every item up in Minecraft Wiki every 5 minutes'. At least we have the recipe book, and can use it to automatically load the crafting table and make an item in one click.
3. Hunger in Peace - I like food gathering to matter for more than composting. (At least I have that use for wheat bread and apples...) Just because I don't want to be ambushed by monsters doesn't mean I don't want the other things that go with survival. If I didn't want food to matter, I'd play Creative.
Without mods, there's still some major holes in Peaceful mode. Mojang finally put in some alternate methods for getting bone meal, such as composting (easy) and finding fossils (rare). String can be fished up or cut from generated cobwebs. However, you can't do brewing without monsters or cheating things in. There's no way to get blaze rods in Peaceful vanilla, nor spider eyes, nor gunpowder. There needs to be a way to get these items.
...Maybe I should work on pre-porting akkamaddi's Ashenwheat and adding a blaze rod plant to it?
A whole new world...
Aug. 23rd, 2018 07:07 amThat sounds like an interesting world. I may have to try that seed. (From Jenny Islander: The seed is (take out the spaces) 7267 5644 6546 4405 901).
Right now, I am playing through a peaceful run of Direwolf20's 1.12.2 2.2.0 modpack. I added "Hunger in Peace" to the pack because I like food to matter even on Peaceful mode, and "Smoother Fonts" because being able to anti-alias fonts and pick the font you want for the tiny print on tooltips and buttons is really nice. I also updated a few mods in the pack before Direwolf20 did, because I don't like keeping known bugs that have already been fixed. The official pack has since caught up. I also set the world to a "rare" Lost Cities with Biomes O' Plenty (BOP) configuration, but someone's definition of "rare" is a lot different from mine, because there are abandoned, crumbling cities at various distances in all directions.
I spawned in a BOP Highlands area right next to a Thaumcraft Magical Forest (which means all the oaks are giant branching oaks, the grass is bluegrass, and there are Greatwood trees--a Thaumcraft (TC) specific tree with huge branching trunks and a very dark wood, like Dark Oak only darker. There are also TC Silverwood trees, which are magical, birch-like trees with branching trunks, and giant mushrooms and weird mushrooms.)

As the pack also includes Botania, and BOP has a lot of biome-specific plants, there are strange flowers galore, everywhere. Since my base style tends to be "tunnel into the nearest hill before it gets dark" and expand from there, I have my base on the border between the Magical Forest (the lowland entrance to my base) and the Highlands (the mountain interior of my base).
Entrance to my base

My sheep pen is up in the Highlands, as I found dozens of sheep up there.

I also built chicken pits there, after bringing a few stacks of eggs back from one of my major expeditions to the nearest "Lost City".

My current base load power generation is up on the mountain, too, as is my nether portal and, just built last night, my Astral Sorcery crafting table.

I'll explain the power generation another time. You can see a "Lost City" on the upper left, not very far away. The dead "city" (more like a small office park) nearest me has been a treasure trove of glass, iron bars, anvils, bookshelves, crafting tables, furnaces, the occaisional enchanting table and brewing stand, flower pots, and endless stacks of terracotta, which were the Minecraft material used to generate that 'modern brutalist concrete' architecture look. (McJty's Lost Cities mod defaults to using vanilla materials to generate the dead cities). That terracotta has turned out to be useful in some of the other mods, saving me the trouble of digging a lot of clay out of the bottom of local ponds. The dead office park has also been a trove of other junk, such as mob spawners; since I'm doing a Peaceful mode play-through, they are mostly useless and harmless. I guess I'm bypassing the intended difficulty of pillaging the abandoned office park by being on Peaceful; apparently its supposed to be infested with zombies, skeletons and giant spiders. OTOH, I don't get to use the monster spawners to make mob farms. I'm going to have to get mob drops the hard way: breeding BEES!
There were also "feral" chickens; on one of my later visits, I penned some chickens in the bottom floor of one of the abandoned office buildings and bred them until I collected several stacks of eggs, which I took home to start my chicken farm. (Chickens don't transport easily long distances, but eggs do).
The Magical Forest lowlands had wild cows and pigs wandering the forest, so I used some of the extensive supplies of wood I had lumbered off to build cowpens and pigpens, and lured some breeding pairs in. I still haven't found any carrots, but it turns out that pigs can be bred with beetroot, and beetroot seeds drop from breaking grass in this modpack, like wheat seeds do. So I have everything I need to breed my sheep, cows, chickens and pigs, which keep me in meat, wool, eggs, feathers and hides. (And help power my power plant, but that's another, more complicated story). As for the rest of a balanced diet, this modpack includes Pam's HarvestCraft, which has all the fruits, vegetables and recipes to use everything you could want. I have already found and started growing many different vegetables and leafy spices. The main things I am still missing are carrots, potatoes, and orchard trees, though I have found the latter on my travels--they just didn't have ripe fruits for me to pick and take home and plant.
I have far more I could tell you about; Direwolf20 the YouTube guy likes to play around with different tech mods and has a very easy-going style on YouTube (i.e. he's competent at making a good video, but can get too enthralled in the "exciting" tasks of making things in a crafting table). His modpack is what they call a "kitchen sink" modpack: some of this, some of that, mods tweaked as necessary to play well together, no special emphasis on "balance" or "progression". Very much a sandbox to play in rather than a game to play through, if you get my drift.
The pack includes some nifty little tools that make building easier, such as Building Gadgets and MeeCreeps. Also /dank/null turned out to be the most useful device for storing (and/or auto-voiding) all that junk/potential building materials that you dig up when mining--cobblestone, dirt, gravel, diorite, etc.
Building Gadgets include the Builder, which is like a Builder's Wand on steroids--it will let you lay down lines and walls of blocks from your inventory without having to place each one yourself. If you've ever hung off the edge of a roof or cliff trying to place another row of edging, you'll appreciate it a lot. The Builder will work with the /dank/null widget and pull blocks out of its inventory, if they exist. I have found the combination handy in mining--an iron /dank/null holds 1152 of any individual block in it, like cobblestone, so as I mine out all that cobblestone, it gets stashed, and if I need to bridge a chasm, out comes the Builder and I can use it to toss up a quick bridge from that stash of cobblestone. (It also has an 'undo' function, so I can take that bridge back down when I'm done with it).
The other Building Gadget is the Exchanger, which lets you switch a block in inventory with a block in the world, also in walls, columns, etc. This is handy for laying pretty floors and paneling your underground base's walls in something better looking than stone cut by random seams of diorite/granite/andesite.
MeeCreeps are summoned by a widget craftable by vanilla stuff you will collect in deep mining, such as diamonds. They are turquoise-blue enderman looking dudes who will carry out simple tasks, depending on where you summoned them--if you summon one by clicking the widget on a tree, it will offer to cut the tree down for you. If you click on the floor, it will offer to flatten the area, or build a cobblestone platform, or dig down to bedrock, or whatever. Extra materials do need to be provided by you: if you want a platform, throw stacks of cobblestone at it if the local area doesn't have stone.
More to come, I hope...
Modding this way was not easy, either for the programmer or for the end user, who had to master the art of unpacking jar files and inserting the provided modded jars.... not something that gamers are normally encouraged to learn or do.
Eventually, some bright lads came up with the idea of a standard mod loader, that would automatically load those modified classes as Minecraft launched, so that the end user didn't to do surgery on their game executable. They also decided to solve the other problem, that if two different mods modified the same base class, you'd have a mess.
They created an API for modding, so that mods would play nicely with each other, and have a standard interface with which to mod Minecraft. That combined mod loader and API is called Minecraft Forge. Originally, you had to do surgery on your Minecraft executable to install Forge, though it would then handle all the other mods, but the Forge guys got tired of explaining how to do that, so they wrote an installer to do it automatically, and the rest is history.
So, I write mods using the Forge API. At some point, Mojang (the developers of Minecraft, now owned by Microsoft), decided to start cleaning up the internals of the game to make it easier to write mods and other add-ons. This necessarily required large internal changes, which made modding across major versions... interesting. Players who don't write mods have little-to-no idea about this, and just want to know "have you ported your mod to 1.8 yet?"
Repeat ad nauseum for every single major version change from 1.6.4 => 1.7.10 => 1.8+ => 1.9.4/1.10.2 => 1.11.2 => 1.12.2
Not ONE modder I've ever heard tell about likes being nagged about porting code. Not one. Fortunately most forum moderators figured out a long time ago that "When are you going to port your mod?" is 99% of the time, a passive-aggressive way of demanding that you hurry up and port your mod, and so forbid the question. One, it is rude and entitled to demand that modders work for you for free, and two, annoyed modders have been known to quit modding. Or put explosive bees in their mods.
So don't do that.
Self, don't do that
Jan. 29th, 2017 07:50 amChinese New Year was last night, so people were shooting off firecrackers around town, which meant that Elsa spent the night shivering and terrified, huddling by our bed. She's sort of tired this morning, but still thinks it's time to play, around her yawns.
Sammie picked up a terracotta warrior statue for his house, and Ivana has the same quest, and will get another one for her house. Radzwell is back online, and we did a guild group to help Sulyamon (Steve's ranger) get Raincaller as a pre-req for his epic weapon quests. First time I've ever been to the front steps of Mistmoore Castle in this game.
Did a fair amount of Minecrafting on Cybertron; I added another automated oreberry farm, and experimented with running power using IE wires all the way past my underground test farm to a new resource plants farm I've set up. So far it's only growing nitor wart (for glowstone) and redstodendron (for redstone). Going to add any more resource crops that I crossbreed to the farm, though. Set up an OpenBlocks sprinkler with a Pressure Pipes Infinite Water Source to keep it hydrated, an MFR harvester to harvest it, and a fair bit of Immersive Engineering infrastructure to bring the power over. (IE wires are way cheaper in materials to run long stretches than energy conduits/ducts/etc from other mods.) I use BuildCraft pipes for long-haul liquid and item transport, as they are also cheaper in materials than EnderIO, Thermal Expansion, or Extra Utilities pipes. In any case, I now have enough glowstone coming in to actually use glowstone-based lights all over the place. Torches on the floor look tacky, and I got tired of hitting my head on railroad lanterns.
I need a Minecraft icon...
Jan. 25th, 2017 10:26 pmMinecraft-Cybertron: I finally disassembled the smelter and moved it to its new room downstairs. I'm slowly breeding nitor wart, so I can farm glowstone instead of having to go mine it in the Nether. I hate the Nether, and hate going there, and hate having to mine anything there. Sadly, I'm going to need blaze rods for stuff, and that means finding a Nether fortress and setting up a mob grinder around a blaze spawner. Joy. I really like flying, fireball hurling demon-machine things beating on me while I build a cage for them.
Speaking of monsters that I need to find: I going to have to go zombie hunting for zombie heads to make zombie controllers from. I hate listening to zombies; their moaning creeps me out. I also need way more Ender pearls than I have, which means either killing endermen (which hit like trucks), or lucking out and finding ender lily seeds in a dungeon chest. Dungeon chests are found in dungeons, which are nasty places full of monsters. Bleh.
At least I don't have to hunt spiders yet. I can get all the string I need from wool, flax and hemp. Which reminds me, I need to build a proper stable for the sheep and set them up with a rancher or ranching station or something to auto-harvest wool. And I have this great blueprint for a Railcraft-based beef & leather farm that I should build sometime.