Advertisement
Guest User

SteamGenerator.java

a guest
Oct 9th, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. package com.gmail.bramdecreepgames.mechanicalcraft.events.blocks;
  2.  
  3. import org.bukkit.ChatColor;
  4. import org.bukkit.Location;
  5. import org.bukkit.Material;
  6. import org.bukkit.entity.Player;
  7. import org.bukkit.plugin.Plugin;
  8.  
  9. import nl.shanelab.multiblock.IMultiBlock;
  10. import nl.shanelab.multiblock.MultiBlockActivation;
  11. import nl.shanelab.multiblock.MultiBlockActivationType;
  12. import nl.shanelab.multiblock.MultiBlockPattern;
  13. import nl.shanelab.multiblock.PatternBlock;
  14.  
  15. public class SteamGenerator implements IMultiBlock {
  16.  
  17. @Override
  18. public void onActivate(Plugin plugin, Location location, Player player, MultiBlockActivation activation) {
  19. if (activation.getType() == MultiBlockActivationType.CORE_PLACED) {
  20. // when all pattern blocks are present and the last block placed
  21. // is the core material block of the multiblock pattern, this block will run
  22.  
  23. player.sendMessage(ChatColor.GREEN + "Example multiblock constructed");
  24. } else if (activation.getType() == MultiBlockActivationType.CORE_INTERACTED) {
  25. // when all pattern blocks, including the core material, are present
  26. // and the user interacts with the core material block
  27.  
  28. player.sendMessage(ChatColor.RED + "Interacted with example multiblock");
  29.  
  30. // Optionally you could check for a certain item to be used
  31. if (player.getInventory().getItemInHand().getType() == Material.LEVER) {
  32. // e.g. load custom gui
  33. }
  34. }
  35. }
  36.  
  37. @Override
  38. public MultiBlockPattern getMultiBlockPattern() {
  39. return new MultiBlockPattern(Material.WOOL, // PatternFacing.CARDINAL, optional parameter [patternFacing: {default: CARDINAL} ]
  40. // the cardinal parameter allows to check the pattern in any direction
  41. // or strict the pattern to face a certain one
  42.  
  43. // pattern objects are relative to the core block (WOOL Material)
  44. // NORTH: negative on Z-axis
  45. // EAST: positive on X-axis
  46. // SOUTH: positive on Z-axis
  47. // WEST: negative on X-axis
  48. new PatternBlock(Material.STONE, -2, 0, -2),
  49. new PatternBlock(Material.STONE, 2, 0, -2),
  50. new PatternBlock(Material.STONE, 2, 0, 2),
  51. new PatternBlock(Material.STONE, -2, 0, 2)
  52. );
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement