1.16.5 Best Way to Simulate Custom Blocks with a Resource Pack + Plugin?

Discussion in 'Spigot Plugin Development' started by AntivirusDev, Jun 29, 2021.

  1. What is the best way to emulate "custom blocks" using a resource pack and plugin? I can't seem to find a method that is both performance-friendly and realistic. I am well aware that a Spigot plugin cannot add true custom blocks into the game, but I know there are some ways that this can be simulated using a plugin working in sync with a server resource pack.

    I need to add between 50 and 80 'custom blocks' and I really do not want to retexture blocks that are attainable in vanilla survival. I have looked into using block states of the mushroom blocks and note block, but the plugin-side requirement is sometimes performance-intensive if a lot of these custom blocks are next to each other (FPS drops for clients and CPU usage spikes on server).

    What's the best way to stop block state textures from changing via player or natural game mechanics?

    EDIT: using entities such as armor stands or item frames is out of the question because these will cause tremendous lag if too many are in a concentrated area.
  2. I'm not a plugin creator, but I know some of the ways.
    For example, spawner with armor stand. They can be used as blocks, the strength of which is equal to the strength of the stone.
    Still somehow create custom trees, but I do not know how)
    My English is bad
  3. I saw one method using mooshroom blocks.
  4. What you're trying to do is something developers have been trying to do since Minecraft's day 0.
    For now there are 3 ways to do this:
    1) Block states (not just mushroom blocks - string and a few more)
    2) Modified armor stand - you change the model of the armor stand so the blocks displayed on it look as big as regular blocks, give some item in the resourcepack the proper textures, and put the textured item on the armor stand.
    3) Use packets to change blocks in specific locations (I'm not 100% sure about this one because I don't know if it'll work)

    1) Uses the game's own engine so less buggy.
    2) Can add literally as many blocks as you want.
    3) ??? (packets are better maybe?...)

    1) Limited by the number of block states that can actually do this. Also, some blocks may change in certain situations so you'll have to check for those instances and disable them via a plugin or use these in places where you can't change them too much.
    2) It's armor stands... This will literally kill the TPS (you know this). On the other hand, if you use packets to display the armor stands then it might not be as bad, but then you'll have a problem of the blocks not actually being there and you'll have to place actual blocks there as well (which is pretty much #3 I think...).
    3) Possibly a good way as it only uses packets, but then you'll have to place blocks to simulate something there and keep track of the blocks that are like this so you can drop the proper items and remove them when they are broken.

    For now, option #1 is used because it's the "best one" - textures don't end up taking too much memory and performance. Of course, the more new things you introduce to Minecraft the more it's prone to bugs so... (50 to 80 blocks? that's kinda a lot...)

    At this point it's up to you to decide which option you're going to pursue.
  5. Another option: Custom Model Data on an ItemStack + custom model override in resource pack + place item into an invisible (and optionally locked) item frame

    Pros: Unlimited amount of blocks can be added, blocks can be any shape, easy to animate
    Cons: uses item frames, blocks can't really be "broken", though they will drop the correct custom item (unlike mushrooms)
    #5 eccentric, Jul 2, 2021
    Last edited: Jul 2, 2021