Become a premium member to remove ads

Notice

The Chaotic United Wiki is currently in beta. As such, some pages may display incorrectly, and some content may be inaccurate. If you find any issues, be sure to let us know on the bug tracker!


Custom Block Techniques

 Share


With the introduction of CUCraftingPlus, one of its key features is the ability to, when combined with the server resource pack, allow for the implementation of custom blocks. These blocks have a multitude of possible uses, and can be achieved using one of several possible techniques.


Item Frame Technique

The Item Frame Technique was the first custom block technique made with the plugin. At the time, it was believed to be the only viable approach for implementing custom blocks.

 

The way this technique works is by using an Item Frame, in conjunction with a custom item. Since resource packs allow for a custom item model have to a custom position when placed in an item frame, these models could be positioned and lined up in such a way that it resembles a standard Minecraft block.

 

For blocks that need to be solid and have proper collision, it is possible to place these item frames within a Barrier block - where the Barrier provides the required collision for the block, further adding to the illusion of having a custom block. If a block should be non-solid, it can simply not have any block placed on top - allowing the player to walk over or through it easily.

 

While this technique has largely been overshadowed by the Note Block Technique, it is still possible within the plugin. It is primarily still useful in some of the following situations:

  • A custom block has a fully custom model which is partially transparent and/or exposes part of the adjacent blocks (such as the Upgrade Station)
  • A custom block needs to be non-solid, such as the decorative Ground Rock or Ground Branch blocks

 

Limitations

While still used for specific use cases, this technique has several limitations which make it undesirable in the case of standard blocks:

Lack of Ambient Occlusion, or 'Fancy' Lighting

Most immediately obvious is that these blocks do not render quite the same as a standard block - almost appearing as though they're being rendered with Fast lighting, which was the lighting engine used in earlier versions of Minecraft. This would be particularly noticeable when several blocks are placed side-by-side across different light levels.

 

Lack of Block Breaking Animations

Another quickly noticeable issue is that, unlike most blocks, there are no visible cracks or any sort of animation while breaking one of these blocks - not even any particles are displayed while breaking.

 

Reduced Render Distance and Culling

The last primary issue relates to how these types of blocks are drawn - or more accurately, how they aren't. Because Item Frames are actually entities, they will relatively quickly become hidden from the player if they move too far away. As such, if a structure was made primarily or entirely out of custom blocks using this technique, the building might not be visible from a distance - even if the same terrain that the building sits on can be seen.

 

The other related issue is culling, where if you look away from the Item Frame, it is no longer displayed to the player. In normal use, this is fine - since normally, all items within an Item Frame don't take up a full block's worth of space. However, when relying on Item Frames to display something with the size of a full block, it is possible for the Item Frame to stop being rendered, even when the block that it represents should still be visible. This can cause issues where any custom blocks at the very edges of a player's screen are simply not displayed.

 

Limited Singleplayer Support

Because of the fact that these types of blocks can often rely on an Item Frame being placed inside of a Barrier block (or in some cases, item frames which are floating and not attached to any block), as soon as any publicly released world downloads are opened in single player, or are even run in a server without the use of the CUCraftingPlus plugin (or at least with item frame ticking disabled), the majority of these types of blocks will simply break on their own a few seconds after the world is loaded.

 

The only workaround for this is to load the world on a server with item frame ticking disabled. Doing so will ensure that any item frames that are in "invalid" locations (such as having a block placed on top of them or not being attached to a block) will remain in the world and will not break.

 

Note Block Technique

The Note Block Technique is the second possible, and has become the primary approach for most custom blocks, is the Note Block Technique.

 

This approach relies on overriding the textures of the Note Block, based on its instrument and note. Since resource packs allow models to be overridden in this manner, it is possible for the server itself to handle the placement of these custom blocks, and place them in the world as Note Blocks - then manually specifying the block's instrument and note directly. This, combined with several other key considerations, allows for a type of custom block which is almost seamlessly integrated, with the only surefire way to reveal the block's true identity to be using the various debug utilities built into Minecraft itself.

 

Technical Challenges

Implementing custom blocks in this manner requires a great deal of technical considerations in order to pull off the illusion of custom blocks.

 

Note Blocks

First and foremost, Note Blocks themselves have to effectively be disabled - no interaction with the block in the form of playing or changing the note can be allowed during gameplay, be it with redstone or otherwise - otherwise, any custom block could start playing notes when interacted with, or worse, blocks could be transformed into other, more rare blocks, simply by changing the note.

 

The issue with this is that, without doing additional work, Note Blocks would effectively be removed from the game. In the case of CUCraftingPlus, Note Blocks are reimplemented as a custom block themselves - allowing them to continue to be used for most typical use cases. Commercially available plugins that offer similar functionality as CUCraftingPlus typically do not do this - and simply leave Note Blocks behind.

 

Block Breaking Animations

Additionally, Note Blocks are made of wood and have their own hardness values, which poses a challenge if blocks of different materials (such as stone, dirt, or otherwise), or if blocks with different hardness values are desired. In order to achieve this, the server must first apply Mining Fatigue of -1 to the player - which keeps the animations for digging a block intact at the proper speed compared to other values, but reduces digging speed significantly enough to effectively prevent the block from ever being broken this way.

 

Then, the plugin itself must, through a combination of its own animation tracking and usage of packets, fake the block breaking animation to simulate what the player would generally expect. This is possible thanks to the fact that other player's block breaking animations are visible on servers - as its these packets which are sent to the client during a break animation. Once the animation is complete, the block is set to Air, particles are displayed, and the appropriate item is dropped.

 

Essentially, the CUCraftingPlus plugin has to take control of the entire process of breaking custom blocks - disabling/hiding the vanilla animations for breaking blocks, and then using its own code to simulate these same animations, adjusted for different hardness values, while also accounting for certain enchantments and status effects.

 

Block Sounds

Alongside the other challenges, Note Blocks themselves have their own block sounds - those being the standard wooden block sounds. However, in most cases, custom blocks may want to use different sounds - or even provide their own.

 

In order to achieve this, the resource pack must first mute all wooden block sounds. This includes break sounds, placement sounds, footsteps, and others. Once this is done, the CUCraftingPlus plugin can then play sounds when appropriate - either during the block break animations, or during footsteps.

 

One issue, however, is that without additional work done to the plugin, all wooden blocks would no longer play any sounds whatsoever - and custom blocks wouldn't be able to use them, either. The solution that CUCraftingPlus uses is to reference the wooden block sounds, but with a different sound name - allowing the plugin to play these sounds itself, not just for custom wooden blocks, but for all other vanilla wooden blocks. Since the wooden block sounds are under a different sound name, this also prevents wood sounds from being played twice in the case that a player is using an outdated version of the server resource pack, or is opting to not use it at all.

 

Limitations

Despite overcoming several major technical challenges, several limitations still apply to these types of custom blocks.

 

Limited Singleplayer Support

While this technique works better offline than the Item Frame Technique, any custom blocks will behave as Note Blocks when the CUCraftingPlus plugin is absent. Interacting with them (or even the blocks adjacent to them) will result in the custom blocks being transformed into another Note Block variant. As long as they are not disturbed (either by players or redstone), however, they will remain intact when loaded in a server without CUCraftingPlus or when loaded in single player.

 

No Transparent Blocks

Because Note Blocks are always solid blocks, it is not currently possible to use this technique for transparent blocks. It is possible that either a new discovery or future changes to how resource packs behave could change this, however this is not currently known to be possible.

 

Removal of Mining Fatigue

Because of how the plugin uses Mining Fatigue and relies on it for breaking custom blocks, it effectively requires that it be removed from the game. Allowing Mining Fatigue effects with positive values would fundamentally break the custom block break animation process and could cause any number of possible issues.

 

Poor Note Block Performance (Theoretical)

Because Note Blocks are now controlled by CUCraftingPlus entirely, it is probable that they do not perform nearly as well as a standard Note Block. This has not yet been tested thoroughly, however, so it is currently only a theoretical limitation.

Image: Several custom blocks using different techniques.

Published:

User Feedback

Recommended Comments

There are no comments to display.



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Minecraft Server

Items
Materials
Armor
Individual Items
Tools
Utility
Cosmetics
Internal
Unused
Unimplemented
Removed
Blocks
Resources
Building
Functional
Unused
Unimplemented
Removed
Mobs
Bosses
Unimplemented
Locations
Dungeons
Technical Resources
Plugins
Other