editor
72
edits
VeryGoodDog (talk | contribs) m (VeryGoodDog moved page Basic Modding Examples to Modding:Basic Modding Examples: clean up main namespace) |
Ninjanomnom (talk | contribs) (Updates worldgen example to current version) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 14: | Line 14: | ||
This should prevent the player from dropping its inventory upon death. | This should prevent the player from dropping its inventory upon death. | ||
== Changing sleep duration in beds == | == Changing sleep duration in beds == | ||
Beds in the Vanilla game are pretty limited, as they let you only sleep 3-5.5 hours every night. More often than not players prefer to skip the whole night. To achieve that open the file <code>assets/blocktypes/wood | Beds in the Vanilla game are pretty limited, as they let you only sleep 3-5.5 hours every night. More often than not players prefer to skip the whole night. To achieve that open the file <code>assets/survival/blocktypes/wood/bed.json</code> | ||
Line | Line 8-11 should contain these lines: | ||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
sleepEfficiencyByType: { | |||
"bed-wood-*" | "bed-wood-*": 0.70833333, | ||
"bed-hay-*" | "bed-hay-*": 0.58333333, | ||
"bed-woodaged-*" | "bed-woodaged-*": 0.79166666 | ||
}, | }, | ||
</syntaxhighlight> | </syntaxhighlight> | ||
The <code>sleepEfficiency</code> attribute is specific to the bed. In this case a value of 1 means the player can sleep half the day. The hay bed has a value of 0. | The <code>sleepEfficiency</code> attribute is specific to the bed. In this case a value of 1 means the player can sleep half the day. The hay bed has a value of 0.58333333, which means the player can sleep for 12 * 0.58333333 = ~7 in-game hours. Change the value to anything between 0...1 and start the game or leave and re-enter your singleplayer world. Next time you sleep in the bed you will be skipping that amount of time. | ||
Line 40: | Line 34: | ||
Our favorite arch enemy the wolf. If you don't like the silent horror of the winterlands, we can tame him with a few tweaks ;-) | Our favorite arch enemy the wolf. If you don't like the silent horror of the winterlands, we can tame him with a few tweaks ;-) | ||
Open the file <code>assets/entities/land/wolf-male.json</code> | Open the file <code>assets/survival/entities/land/wolf-male.json</code> | ||
Line | Line 108-123 should contain this: | ||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
{ | { | ||
code: "meleeattack", | code: "meleeattack", | ||
entityCodes: ["player"], | entityCodes: ["player", "chicken-rooster", "chicken-hen", "chicken-baby", "hare-*"], | ||
priority: 2, | priority: 2, | ||
damage: | damage: 8, | ||
damageTier: 2, | |||
damageType: "SlashingAttack", | |||
slot: 1, | slot: 1, | ||
mincooldown: 1500, | mincooldown: 1500, | ||
Line 57: | Line 53: | ||
animation: "Attack", | animation: "Attack", | ||
animationSpeed: 2.5, | animationSpeed: 2.5, | ||
sound: "creature/wolf/ | sound: "creature/wolf/attack" | ||
}, | }, | ||
</syntaxhighlight> | </syntaxhighlight> | ||
This is the configuration for the wolves ai task to induce damage to very close by enemies. By default the wolf damages you by | This is the configuration for the wolves ai task to induce damage to very close by enemies. By default the wolf damages you by 8 health points, which means any unprotected player dies in 3 attacks. If you were to change it to 5, the wolf has to attack you up to 4 times before a fully healed player dies. | ||
Line 68: | Line 64: | ||
{ | { | ||
code: "seekentity", | code: "seekentity", | ||
entityCodes: ["player"], | entityCodes: ["player", "chicken-rooster", "chicken-hen", "chicken-baby", "hare-*"], | ||
priority: 1.5, | priority: 1.5, | ||
movespeed: 0. | movespeed: 0.045, | ||
seekingRange: | seekingRange: 15, | ||
belowTempSeekingRange: 25, | |||
belowTempThreshold: -5, | |||
animation: "Run", | animation: "Run", | ||
animationSpeed: | leapAtTarget: true, | ||
sound: "creature/wolf/ | leapAnimation: null, | ||
animationSpeed: 2.2, | |||
leapChance: 0.01, | |||
sound: "creature/wolf/growl", | |||
whenNotInEmotionState: "saturated" | |||
}, | }, | ||
</syntaxhighlight> | </syntaxhighlight> | ||
You can perhaps read out that the wolf has a seeking range of | You can perhaps read out that the wolf has a seeking range of 15 blocks. This means if the wolf finds a player within a radius of 15 blocks, it will start walking towards that player. Changing that to something lower, like 5 blocks, means you can get much closer to a wolf before he begins to chase you. | ||
Be sure to also apply the changes to the female wolf in <code>wolf-female.json</code>! | Be sure to also apply the changes to the female wolf in <code>wolf-female.json</code>! | ||
Line 85: | Line 89: | ||
== Playing around with world generation == | == Playing around with world generation == | ||
Inside the assets folder, navigate to worldgen/ | Inside the assets folder, navigate to <code>assets/survival/worldgen/</code>. Copy aside the landforms.json so you have a backup, then open the landforms.json. Remove everything in this file and paste in the following text: | ||
<pre> | <pre> | ||
{ | { | ||
Line 95: | Line 99: | ||
"comment": "humongous mountains with caverns in them", | "comment": "humongous mountains with caverns in them", | ||
"hexcolor": "#5BC184", | "hexcolor": "#5BC184", | ||
"weight": | "weight": 1.5, | ||
"useClimateMap": false, | "useClimateMap": false, | ||
"terrainOctaves": [ | "terrainOctaves": [0, 0, 0, 1, 1, 1, 1, 0.6, 0.15], | ||
"terrainOctaveThresholds": [ | "terrainOctaveThresholds": [0, 0, 0, 0.5, 0, 0, 0, 0, 0], | ||
"terrainYKeyPositions": [ | "terrainYKeyPositions": [0.000, 0.330, 0.370, 0.420, 0.430, 0.500, 0.600, 0.700, 1.000], | ||
"terrainYKeyThresholds": [1, | "terrainYKeyThresholds": [1.000, 1.000, 0.870, 0.840, 0.700, 0.940, 1.000, 1.000, 0.000] | ||
}, | }, | ||
] | ] |