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

106 lines
3.8 KiB
Text
Raw Permalink Normal View History

#loader contenttweaker
import crafttweaker.block.IBlock;
import crafttweaker.block.IBlockState;
import crafttweaker.data.IData;
import crafttweaker.world.IBlockPos;
import crafttweaker.world.IWorld;
import mods.contenttweaker.Block;
import mods.contenttweaker.BlockPos;
import mods.contenttweaker.DropHandler;
import mods.contenttweaker.ResourceLocation;
import mods.contenttweaker.VanillaFactory;
import mods.contenttweaker.World;
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 replace(
item as string,
meta as string,
blockPos as mods.contenttweaker.BlockPos,
world as World
)
{
if (world.isRemote()) { return null; }
# janky hack, mate
var trueWorld as IWorld = IWorld.getFromID(world.getDimension());
var nbt as IData = {
Facing: 0 as byte,
InventoryStacks: [{
id: item as string,
Count: 1 as byte,
Damage: meta as short
}]
};
var position as IBlockPos = crafttweaker.util.Position3f.create(blockPos.getX(), blockPos.getY(), blockPos.getZ()).asBlockPos();
trueWorld.setBlockState(<blockstate:draconicevolution:placed_item:facing=down>, nbt, position);
}
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);
block.setOnBlockPlace(function(world, blockPos, blockState) {
replace(item, meta, blockPos, world);
});
block.setOnRandomTick(function(world, blockPos, blockState) {
replace(item, meta, blockPos, world);
});
block.setOnUpdateTick(function(world, blockPos, blockState) {
replace(item, meta, blockPos, world);
});
block.register();
}