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:
parent
8c5f469cc3
commit
2d1a2f14e5
5 changed files with 100 additions and 4 deletions
71
scripts/ore_veins/indicators.1.zs
Normal file
71
scripts/ore_veins/indicators.1.zs
Normal 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();
|
||||
}
|
5
scripts/ore_veins/indicators.2.zs
Normal file
5
scripts/ore_veins/indicators.2.zs
Normal file
|
@ -0,0 +1,5 @@
|
|||
for i in loadedMods["contenttweaker"].items {
|
||||
if (i.definition.name.contains("internal")) {
|
||||
mods.jei.JEI.hide(i);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue