记得在 resources/contenttweaker/textures/blocks 目录下存放自定义花的贴图 (贴图名 : unlocalizedName.png)
import mods.randomtweaker.cote.SubTileEntity;
import mods.contenttweaker.VanillaFactory;
import mods.randomtweaker.cote.ISubTileEntityGenerating;
import mods.randomtweaker.cote.ISubTileEntityFunctional;
//产魔花
var test_flower0 as ISubTileEntityGenerating = VanillaFactory.createSubTileGenerating("test_flower0", 0xFFFFFF);
test_flower0.maxMana = 2000;
test_flower0.onUpdate = function(subtile, world, pos) {
if(!world.remote) {
if(isNull(subtile.data.time))
subtile.updateCustomData({time : 0});
if(!isNull(subtile.data.time)) {
subtile.updateCustomData({time : subtile.data.time.asInt() + 1});
if(subtile.data.time.asInt() == 100){
server.commandManager.executeCommand(server, "dididididididididi~~~");
}
}
}
};
test_flower0.register();
//功能花
var test_flower1 as ISubTileFunctional = VanillaFactory.createSubTileFunctional("test_flower1", 0x000000);
test_flower1.maxMana = 100086;
test_flower1.onUpdate = function(subtile, world, pos) {
if(!world.remote) {
if(isNull(subtile.data.time))
subtile.updateCustomData({time : 0});
if(!isNull(subtile.data.time)) {
subtile.updateCustomData({time : subtile.data.time.asInt() + 1});
if(subtile.data.time.asInt() == 100){
server.commandManager.executeCommand(server, "dididididididididi~~~");
}
}
}
};
test_flower1.register();