katubug

chest script

Jan 30th, 2020
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. import crafttweaker.block.IBlock;
  2. import crafttweaker.block.IBlockDefinition;
  3. import crafttweaker.event.BlockBreakEvent;
  4. import crafttweaker.events.IEventManager;
  5. import crafttweaker.item.IItemStack;
  6. import crafttweaker.player.IPlayer;
  7.  
  8. //test
  9. //if player is not holding axe, chest is unbreakable
  10.  
  11. events.onBlockBreak(function(event as crafttweaker.event.BlockBreakEvent){
  12. if (event.block==(<minecraft:chest>)){
  13. if (!event.player.currentItem.matches(<ore:toolAxe>)) {
  14. event.cancel();
  15. if (event.world.remote) {
  16. event.player.sendChat("You need an axe to break this item.");
  17. }
  18. }
  19. }
  20. });
Advertisement
Add Comment
Please, Sign In to add comment