Modpack-1.12.2/scripts/ore_veins/indicators.1.zs

98 lines
4 KiB
Text
Raw Normal View History

#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", "ic2:resource", "1"],
["apatite", "forestry:resources", "0"],
["gold", "minecraft:gold_ore", "0"],
["silver", "thermalfoundation:ore", "2"],
["platinium", "thermalfoundation:ore", "6"],
["tin", "mekanism:oreblock", "2"],
2022-11-15 22:24:45 +01:00
["aluminium", "thermalfoundation:ore", "4"],
["nickel", "thermalfoundation:ore", "5"],
["redstone", "minecraft:redstone_ore", "0"],
["osmium", "mekanism:oreblock", "0"],
["magnesium", "nuclearcraft:ore", "7"],
["boron", "nuclearcraft:ore", "5"],
["lithium", "nuclearcraft:ore", "6"],
["uranium", "nuclearcraft:ore", "4"],
2022-11-15 22:24:45 +01:00
["coal", "minecraft:coal_ore", "0"],
["iron", "minecraft:iron_ore", "0"],
["diamond", "minecraft:diamond_ore", "0"],
["lapis", "minecraft:lapis_ore", "0"],
["silicon", "galacticraftcore:basic_block_core", "8"],
["lead", "thermalfoundation:ore", "3"],
["iridium", "thermalfoundation:ore", "7"],
2022-11-15 22:24:45 +01:00
["black_quartz", "actuallyadditions:block_misc", "3"],
["ruby", "biomesoplenty:gem_ore", "1"],
["amber", "biomesoplenty:gem_ore", "7"],
["sapphire", "biomesoplenty:gem_ore", "6"],
["peridot", "biomesoplenty:gem_ore", "2"],
["malachite", "biomesoplenty:gem_ore", "5"],
["tanzite", "biomesoplenty:gem_ore", "4"],
["certus_quartz", "appliedenergistics2:material", "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();
}