Created
January 12, 2021 23:36
-
-
Save TheQKnight/d7ced8b776bf6d732b9bb4d7980f5b78 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import crafttweaker.item.IItemStack; | |
import crafttweaker.item.IIngredient; | |
import crafttweaker.item.IItemDefinition; | |
import crafttweaker.item.IItemCondition; | |
import crafttweaker.item.IItemTransformer; | |
import crafttweaker.item.WeightedItemStack; | |
import crafttweaker.recipes.ICraftingInventory; | |
import crafttweaker.recipes.ICraftingRecipe; | |
import crafttweaker.oredict.IOreDictEntry; | |
import crafttweaker.event.IEventCancelable; | |
import crafttweaker.event.PlayerInteractEvent; | |
import crafttweaker.command.ICommandManager; | |
import crafttweaker.server.IServer; | |
import crafttweaker.data.IData; | |
import crafttweaker.event.IPlayerEvent; | |
import crafttweaker.command.ICommandSender; | |
import mods.ctutils.commands.Commands; | |
events.onPlayerTick(function(event as crafttweaker.event.PlayerTickEvent) { | |
var dimension = event.player.dimension; | |
if (dimension == 0) { | |
var worldTime = event.player.world.getWorldTime(); | |
if (worldTime % 80 == 0) { | |
var playerData = event.player.data as IData; | |
var lastMusicData = playerData.lastMusic as IData; | |
var addPlayerData = { | |
lastMusic: worldTime | |
} as IData; | |
if (isNull(lastMusicData)) { | |
event.player.update(playerData + addPlayerData); | |
} else if (worldTime - lastMusicData >= 79) { | |
event.player.update(playerData + addPlayerData); | |
event.player.sendMessage(worldTime); | |
var commandSender = mods.ctutils.commands.Commands.getServerCommandSender(); | |
event.player.server.commandManager.executeCommand(commandSender, "/playsound minecraft:block.chest.close record " ~ event.player.name ~ " ~ ~ ~ 10000 1"); | |
} | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment