72 lines
2.8 KiB
Text
72 lines
2.8 KiB
Text
|
#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();
|
||
|
}
|