forked from EXTERNAL/bareiron
update ore mining behavior
This commit is contained in:
@@ -4,7 +4,12 @@ const path = require("path");
|
||||
// Overrides for block-to-item conversion
|
||||
const blockToItemOverrides = {
|
||||
"grass_block": "dirt",
|
||||
"stone": "cobblestone"
|
||||
"stone": "cobblestone",
|
||||
"diamond_ore": "diamond",
|
||||
"gold_ore": "raw_gold",
|
||||
"redstone_ore": "redstone",
|
||||
"iron_ore": "raw_iron",
|
||||
"coal_ore": "coal"
|
||||
};
|
||||
|
||||
const biomes = [
|
||||
@@ -261,7 +266,12 @@ async function convert () {
|
||||
"block": {
|
||||
"mineable/pickaxe": [
|
||||
itemsAndBlocks.blockRegistry["stone"],
|
||||
itemsAndBlocks.blockRegistry["cobblestone"]
|
||||
itemsAndBlocks.blockRegistry["cobblestone"],
|
||||
itemsAndBlocks.blockRegistry["diamond_ore"],
|
||||
itemsAndBlocks.blockRegistry["gold_ore"],
|
||||
itemsAndBlocks.blockRegistry["redstone_ore"],
|
||||
itemsAndBlocks.blockRegistry["iron_ore"],
|
||||
itemsAndBlocks.blockRegistry["coal_ore"]
|
||||
],
|
||||
"mineable/axe": [
|
||||
itemsAndBlocks.blockRegistry["oak_log"],
|
||||
|
23
src/tools.c
23
src/tools.c
@@ -299,6 +299,10 @@ void makeBlockChange (short x, short y, short z, uint8_t block) {
|
||||
// Probability numbers obtained with this formula: N = floor(P * 32 ^ 2)
|
||||
uint16_t getMiningResult (int client_fd, uint8_t block) {
|
||||
|
||||
PlayerData *player;
|
||||
if (getPlayerData(client_fd, &player)) return 0;
|
||||
uint16_t held_item = player->inventory_items[player->hotbar];
|
||||
|
||||
switch (block) {
|
||||
|
||||
case B_oak_leaves:
|
||||
@@ -311,10 +315,9 @@ uint16_t getMiningResult (int client_fd, uint8_t block) {
|
||||
|
||||
case B_stone:
|
||||
case B_cobblestone:
|
||||
// Check if player is holding a pickaxe
|
||||
PlayerData *player;
|
||||
if (getPlayerData(client_fd, &player)) return 0;
|
||||
uint16_t held_item = player->inventory_items[player->hotbar];
|
||||
case B_coal_ore:
|
||||
case B_iron_ore:
|
||||
// Check if player is holding (any) pickaxe
|
||||
if (
|
||||
held_item != I_wooden_pickaxe &&
|
||||
held_item != I_stone_pickaxe &&
|
||||
@@ -325,6 +328,18 @@ uint16_t getMiningResult (int client_fd, uint8_t block) {
|
||||
) return 0;
|
||||
break;
|
||||
|
||||
case B_gold_ore:
|
||||
case B_redstone_ore:
|
||||
case B_diamond_ore:
|
||||
// Check if player is holding an iron (or better) pickaxe
|
||||
if (
|
||||
held_item != I_iron_pickaxe &&
|
||||
held_item != I_golden_pickaxe &&
|
||||
held_item != I_diamond_pickaxe &&
|
||||
held_item != I_netherite_pickaxe
|
||||
) return 0;
|
||||
break;
|
||||
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user