Some Tips you could use (spruce tree, crops stage, etc ...)

Discussion in 'Resources' started by IdCom4, Oct 22, 2019.

?

Was it usefull

  1. yes

    0 vote(s)
    0.0%
  2. no

    0 vote(s)
    0.0%
  1. Offline

    IdCom4

    Hi guys ! first of all i'm sorry if my english hurt your feelings, i ain't english but i'll do my best :)

    I've started develloping plugins a little while ago, and i've struggled a lot with small and silly things because i couldn't get a clear answer (or any anwser) anywhere.
    I've found a way each time, but it took me way more energy and time than it should have, so here i am, to tell you some random things that i wish i knew before, and i'll probably keep this updated if i remember stuff or anything:

    - in the TreeType import, the spruce tree is the REDWOOD (why???)

    - to get or check or modify the growth stage of a crop, cast the BlockData of the block into Ageable (if you're sure it's an ageable block), wich will provide you all the methods that you need

    - the growing block of cacao is of Material type CACAO, and his drop of Material type CACAO_BEANS

    - to make an item glow without an actual enchant, there is this nice small and accurate tuto : https://bukkit.org/threads/how-to-create-glowing-items-without-actually-enchanting-them-1-14.479311/

    - to set the facing direction of a block, cast the BlockData of the block into Directional, that will provide you the methods that you seek

    - to get wich face of a block the player is looking at, i didn't find a perfect solution, but i ended up with this: compare the two positions of the block and the player itself to find the position of the block that is next to the first one, and the most between it and the player. Then iterate through the BlockFace(s) to get the relatives blocks of the first one, and the one that is the previous one that you've found give you most of the time the good face.

    - by default, every methods that allow to write into a file (or read it) will consider the relatrive path "./" as the main directory of server since it's where the plugins are executed

    - when you want to delay some task or do a timer, synchronously, just use Bukkit.getScheduler() as follow :
    Code:
    Bukkit.getScheduler().runTaskLater(plugin, new Runnable() {
                        @Override
                        public void run() {
                              //some code
                        }
                    }, timeUntilExecution);
    where plugin is your main class, and timeUntilExectution is in game ticks, as 20 is a second, * 60 a minute, and so on


    That's all for now, and i really hope it will help some of you :)
     
    Last edited: Oct 23, 2019
  2. Online

    timtower Moderator Moderator

Share This Page