Add ore indicators as items placed on the ground

Item placing on the ground is added by Draconic Evolution,
I used a janky way to setblock generated indicator to that tile.
That tile needs nbt so I had to set a block using execute as setblock command,
which is bad, because it spams logs and operators chat
This commit is contained in:
Wroclaw 2022-11-13 07:51:29 +01:00
parent 8c5f469cc3
commit 2d1a2f14e5
5 changed files with 100 additions and 4 deletions

View file

@ -5,6 +5,12 @@
"block": "thermalfoundation:ore", "block": "thermalfoundation:ore",
"meta": 0 "meta": 0
}, },
"indicator": {
"blocks": "contenttweaker:juice/internal/indicator/copper",
"ignore_vegatation": false,
"ignore_liquids": false,
"rarity": 24
},
"stone": "minecraft:stone", "stone": "minecraft:stone",
"rarity": 160, "rarity": 160,
"min_y": 8, "min_y": 8,
@ -20,6 +26,12 @@
"block": "forestry:resources", "block": "forestry:resources",
"meta": 0 "meta": 0
}, },
"indicator": {
"blocks": "contenttweaker:juice/internal/indicator/apatite",
"ignore_vegatation": false,
"ignore_liquids": false,
"rarity": 24
},
"stone": "minecraft:stone", "stone": "minecraft:stone",
"rarity": "100", "rarity": "100",
"min_y": -10, "min_y": -10,
@ -35,9 +47,9 @@
"ore": "minecraft:gold_ore", "ore": "minecraft:gold_ore",
"stone": "minecraft:stone", "stone": "minecraft:stone",
"indicator": { "indicator": {
"blocks": "minecraft:gold_ore", "blocks": "contenttweaker:juice/internal/indicator/gold",
"ignore_vegatation": false, "ignore_vegatation": false,
"ignore_liquids": true, "ignore_liquids": false,
"rarity": 24 "rarity": 24
}, },
"rarity": 170, "rarity": 170,

10
index.toml generated
View file

@ -302,7 +302,7 @@ hash = "5046cde3673ccd62ba2209aaab9a917b3e1b0da7f521477e89f68bdba1648187"
[[files]] [[files]]
file = "config/oreveins/ore_veins.json" file = "config/oreveins/ore_veins.json"
hash = "214f7142f586483b47112fa0e39fc24a693e512634a71f3851e5cefbd4dbf6bb" hash = "44c43ee20b7998d261565da99b0a54ad268eaa1f44bc14d323489a885a5a246c"
[[files]] [[files]]
file = "config/sereneseasons/biome_info.json" file = "config/sereneseasons/biome_info.json"
@ -1539,3 +1539,11 @@ hash = "b4aea7892748ecfa5cf775fb0a18f0909795c0b025666ecaea88bb3a923b4194"
[[files]] [[files]]
file = "scripts/nc_script_addons/MoarRealisticRadiation/rad_qmd.zs" file = "scripts/nc_script_addons/MoarRealisticRadiation/rad_qmd.zs"
hash = "a07879875ad20ae8e285c3cb39beeee648bd080ec12985b76583ad707a3de3ee" hash = "a07879875ad20ae8e285c3cb39beeee648bd080ec12985b76583ad707a3de3ee"
[[files]]
file = "scripts/ore_veins/indicators.1.zs"
hash = "eee1737869c3a9a2d2261894b32f09d8dee48df55f07393eec54ba8748a13d79"
[[files]]
file = "scripts/ore_veins/indicators.2.zs"
hash = "08d456f730c1a797aab31811ba5a24e319ce35d000c4af80348a964a6c471898"

View file

@ -6,7 +6,7 @@ pack-format = "packwiz:1.1.0"
[index] [index]
file = "index.toml" file = "index.toml"
hash-format = "sha256" hash-format = "sha256"
hash = "1d97754f0f1410e1990d6465b9d99ad55e152fa11804dd642f72013a1acb0503" hash = "dadadd056bd26d8a241d36194b27f48fe13db960074ae4a2475f8afe66af4ba6"
[versions] [versions]
forge = "14.23.5.2860" forge = "14.23.5.2860"

View file

@ -0,0 +1,71 @@
#loader contenttweaker
import mods.contenttweaker.Block;
import mods.contenttweaker.DropHandler;
import mods.contenttweaker.ResourceLocation;
import mods.contenttweaker.VanillaFactory;
var nugget_table as string[][] = [
# [name, id, meta]
["copper", "thermalfoundation:ore", "0"],
["apatite", "forestry:resources", "0"],
["gold", "minecraft:gold_ore", "0"]
];
function replaceCommand(blockName as string, item as string, meta as string, blockPos as mods.contenttweaker.BlockPos) as string {
return "execute @a " +
blockPos.getX() as string + " " +
blockPos.getY() as string + " " +
blockPos.getZ() as string + " " +
"detect " +
blockPos.getX() as string + " " +
blockPos.getY() as string + " " +
blockPos.getZ() as string + " " +
"contenttweaker:" + blockName + " * " +
"setblock " +
blockPos.getX() as string + " " +
blockPos.getY() as string + " " +
blockPos.getZ() as string + " " +
"draconicevolution:placed_item " +
"0 " +
"replace " +
"{InventoryStacks: [{ id: \"" + item + "\", Count: 1, Damage: " + meta as string + " }]}";
}
for i in nugget_table {
var blockName as string = "juice/internal/indicator/" + i[0];
var item as string = i[1];
var meta as string = i[2];
print("Adding internal ore indicator block: " + i[0]);
var block = VanillaFactory.createBlock(blockName, <blockmaterial:air>);
block.setTextureLocation(ResourceLocation.create("contenttweaker:blocks/ore_nugget"));
block.setToolLevel(0);
# block.setAxisAlignedBB(mods.contenttweaker.AxisAlignedBB.create(0.375f, 0.0f, 0.375f, 0.625f, 0.125f, 0.625f));
block.setEnumBlockRenderType("MODEL");
block.setBlockHardness(0.1);
block.setBlockLayer("CUTOUT");
block.setBlockResistance(0);
block.setDropHandler(function(drops, world, position, state, fortune) { drops.clear(); });
block.setFullBlock(false);
block.setLightOpacity(0);
block.setPassable(true);
block.setReplaceable(true);
# janky hack, mate
block.setOnBlockPlace(function(world, blockPos, blockState) {
var command as string = replaceCommand(blockName, item, meta, blockPos);
server.commandManager.executeCommand(server, command);
});
block.setOnRandomTick(function(world, blockPos, blockState) {
var command as string = replaceCommand(blockName, item, meta, blockPos);
server.commandManager.executeCommand(server, command);
});
block.setOnUpdateTick(function(world, blockPos, blockState) {
var command as string = replaceCommand(blockName, item, meta, blockPos);
server.commandManager.executeCommand(server, command);
});
block.register();
}

View file

@ -0,0 +1,5 @@
for i in loadedMods["contenttweaker"].items {
if (i.definition.name.contains("internal")) {
mods.jei.JEI.hide(i);
}
}