Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #priority 1000
- import crafttweaker.enchantments.IEnchantmentDefinition;
- import crafttweaker.enchantments.IEnchantment;
- import crafttweaker.block.IBlockDefinition;
- import crafttweaker.block.IBlock;
- import crafttweaker.block.IBlockState;
- /* import crafttweaker.event.PlayerInteractEvent; */
- import crafttweaker.event.IPlayerEvent;
- import mods.contenttweaker.Commands;
- import mods.ctutils.utils.Math;
- import crafttweaker.entity.IEntityEquipmentSlot as slots;
- function getUnbreakingLevel (enchantments as IEnchantment []) as int
- {
- val unbreaking as IEnchantmentDefinition [] = [<enchantment:minecraft:unbreaking>] as IEnchantmentDefinition [];
- for enchant in enchantments
- {
- if (unbreaking[0].id == enchant.definition.id)
- {
- return enchant.level;
- }
- }
- return 0;
- }
- function damageTool(event as IPlayerEvent)
- {
- val unbreakingLvl = getUnbreakingLevel(event.player.currentItem.enchantments);
- if(Math.random() < (0.5/((unbreakingLvl as float) + 1.0)))
- {
- if(event.player.currentItem.damage < event.player.currentItem.maxDamage)
- {
- event.player.setItemToSlot(slots.mainHand(), event.player.currentItem.withDamage(event.player.currentItem.damage + 1));
- }
- else
- {
- Commands.call("playsound entity.item.break player @s", event.player, event.player.world, false, true);
- event.player.setItemToSlot(slots.mainHand(), null);
- }
- }
- }
- static hoeMatchState as IBlockState[IBlockDefinition] =
- {
- <block:vbe:stairscoarsedirt>.getBlock().definition : <blockstate:vbe:stairsdirt>,
- <block:vbe:slabcoarsedirt>.getBlock().definition : <blockstate:vbe:slabdirt>,
- <block:blocklayering:layer_coarse_dirt>.getBlock().definition : <blockstate:blocklayering:layer_dirt>
- };
- /* static shovelable as IBlock[IBlock] =
- [
- <block:minecraft:grass_path> : <block:minecraft:grass>,
- <block:vbe:stairspath> : <block:vbe:stairsgrass>,
- <block:vbe:slabpath> : <block:vbe:slabgrass>,
- <block:blocklayering:layer_path> : <block:blocklayering:layer_grass>
- ]; */
- /* static hoeable as IBlock[IBlockDefinition] =
- {
- <vbe:stairscoarsedirt>.asBlock().definition : <vbe:stairsdirt>.asBlock(),
- <vbe:slabcoarsedirt>.asBlock().definition : <vbe:slabdirt>.asBlock(),
- <blocklayering:layer_coarse_dirt>.asBlock().definition : <blocklayering:layer_dirt>.asBlock(),
- <minecraft:grass_path>.asBlock().definition : <minecraft:grass>.asBlock(),
- <vbe:stairspath>.asBlock().definition : <vbe:stairsgrass>.asBlock(),
- <vbe:slabpath>.asBlock().definition : <vbe:slabgrass>.asBlock(),
- <blocklayering:layer_path>.asBlock().definition : <blocklayering:layer_grass>.asBlock(),
- <minecraft:farmland>.asBlock().definition : <vbe:stairsdirt>.asBlock()
- }; */
- /* static hoeableIds as string[string] =
- {
- <vbe:stairscoarsedirt>.asBlock().definition.id : <vbe:stairsdirt>.asBlock().definition.id,
- <vbe:slabcoarsedirt>.asBlock().definition.id : <vbe:slabdirt>.asBlock().definition.id,
- <blocklayering:layer_coarse_dirt>.asBlock().definition.id : <blocklayering:layer_dirt>.asBlock().definition.id,
- <minecraft:grass_path>.asBlock().definition.id : <minecraft:grass>.asBlock().definition.id,
- <minecraft:grass_path>.asBlock().definition.id : <minecraft:grass>.asBlock().definition.id,
- <vbe:stairspath>.asBlock().definition.id : <vbe:stairsgrass>.asBlock().definition.id,
- <vbe:slabpath>.asBlock().definition.id : <vbe:slabgrass>.asBlock().definition.id,
- <blocklayering:layer_path>.asBlock().definition.id : <blocklayering:layer_grass>.asBlock().definition.id
- }; */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement