Minecraft structure overwrites existing blocks 1.20
The java Q&A topic brought by php editor Youzi will give you detailed answers to the questions about structures covering existing blocks in Minecraft. In the game, how to effectively operate and utilize this function will directly affect the game experience and fun of playing. Through the interpretation and guidance of this article, I hope it can help you better master this technique and achieve better results and experience in the game.
Question content
I've been trying to find online a way to modify existing blocks and their properties in Minecraft Fabric, but all I can find is how to create new blocks. Any versions I've found are lower than 1.20.
I can't actually find a way to override existing block properties at all. Overwriting doesn't work either
Workaround
What you essentially want to do is re-register the block
instance of minecraft that is already registered. But there's a reason no one has documented how to do this: You shouldn't.
Reregistering chunks in minecraft can cause strange problems, especially if your mod will be used in a large modpack. This has to do with compatibility with other mods and even Minecraft itself. You better hope to avoid this. There are a dozen other solutions that can change the behavior of specific blocks without causing too many problems. They include but are not limited to:
- Just add your block to one of minecraft's built-in tags - you don't even need java code, just the json file from the package: https://www.php.cn/link/ff7cc29289db44861ce4b3e5e56fe234 . This could make the stone mineable with a shovel, for example.
- Use one of the callbacks provided by the fabric api to listen for certain events you want to handle. For example, it can turn grass blocks into dirt when the player clicks on it.
- Create a so-called "extension block" that can act as a custom state attribute for the block. ie. If you want to give
minecraft:stone
anage
attribute (which may be useful for whatever reason), treatminecraft:stone
asage =0
and create a custom block (e.g.modid:ged_stone
) usingage
The zqb attribute expands the age range from1
to any maximum age.
Another, more general approach is to build the mixin into the block
class or appropriate subclass, and do something like the following to target a specific block (in this case, a stone):
block self = (block) (object) this; if (builtinregistries.block.getkey(self).equals(new resourcelocation("stone"))) { // do something only if this block is stone }
However, if you really, really want to completely replace the block instance, here's a suggestion: Use mixin injection registry.register
to replace a specific block instance with a custom block instance:
@Mixin(Registry.class) public class RegistryMixin { @Inject( // You may need to specify the correct signature after the method // name because there are two `register` methods. method="register", at=@At("HEAD"), cancelable=true ) // Note that this is a generic method, in Mixin you'll have to use // Object to replace type parameters private static void onRegister(Registry reg, ResourceLocation id, Object value, CallbackInfoReturnable<Object> cir) { if (reg != BuiltInRegistries.BLOCK) return; if (!id.toString().equals("minecraft:stone")) return; // Now that you've filtered out the minecraft:stone block, // you can re-register it Block myCustomBlock = new Block(.......); ((WritableRegistry) reg).register(id, myCustomBlock); cir.setReturnValue(myCustomBlock); } }
But again try to avoid this solution. There are dragons here.
Please note that I have not tested any code snippets as I did not have a modified environment on hand at the time of writing this article. It may need adjustment to work.
Also, I used mojang's official mapping, if you use yarn mapping, the name may be different. For example, resourcelocation
is named identifier
in yarn.
I hope this helps. Happy coding!
The above is the detailed content of Minecraft structure overwrites existing blocks 1.20. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Maybe many "Minecraft" students still don't understand how to transfer a homeowner in "Minecraft". Next is "How to transfer a homeowner in Minecraft" compiled by the editor of Wanka. Students who have questions in this regard should take a look. Take a look, I hope it helps you. In "Minecraft", many players will set up their own servers or multiplayer rooms to share this boundless world with their friends. But then there is the possibility that managers or “homeowners” need to transfer their location to someone else for a variety of reasons. How to conduct a homeowner transfer correctly and efficiently? Below is a thorough guide. We need to understand the basic workings of multiplayer rooms or servers in Minecraft. Unlike single-player games, multiplayer interaction involves network communication and

What is the use of mud in Minecraft? Mud is a naturally generated material in the Minecraft game. Many friends would like to know what this naturally occurring material is like. Today I bring you an introduction to Minecraft Mud. Friends who are interested, please come and take a look. Introduction to the function of mud in "Minecraft" Mud item command: /give@pminecraft:mud64 Right-click on mud, sand, and root-tangled mud and use a water bottle to convert it. Generates naturally in mangrove swamps. The height of the block is the same as the soul sand, which is 0.875 blocks. Place the mud on a dripping stone with a dripping stone cone attached below, and the mud will slowly turn into a clay block. Mud was added in 1.19 snapshot 22w11a. Mud item command: /give@pminecra

The World Box tells us how to obtain achievements. Here, the editor will teach you how to operate and understand what this knowledge is all about. First, Shizhu uses explosions and acid rain to turn all the land in the world into acidic wasteland. However, the achievement can be unlocked when the wasteland caused by explosions or acid rain covers the entire world.

The decision to use path tracing or ray tracing is a critical choice for game developers. Although they both perform well visually, there are some differences in practical applications. Therefore, game enthusiasts need to carefully weigh the advantages and disadvantages of both to determine which technology is more suitable for achieving the visual effects they want. What is ray tracing? Ray tracing is a complex rendering technique used to simulate the propagation and interaction of light in virtual environments. Unlike traditional rasterization methods, ray tracing generates realistic lighting and shadow effects by tracing the path of light, providing a more realistic visual experience. This technology not only produces more realistic images, but also simulates more complex lighting effects, making scenes look more realistic and vivid. its main concepts

What are the uses of bricks in the Nether in Minecraft? Nether bricks naturally generate materials in the Minecraft game. Many friends want to know what this naturally generated material is like. Today, the editor brings you an introduction to Minecraft Nether Bricks. Friends who are interested, please come and take a look. Introduction to the use of nether bricks in "Minecraft" Nether bricks item command: /give@pminecraft:nether_bricks64 Nether bricks are generated in the nether fortress and can also be synthesized with nether bricks. They are an important part of the walls and pillars of the nether fortress. Nether bricks were added in Java Edition Beta 1.9-pre1. Nether Brick is an incombustible block and immune to ghast fireballs, making it a suitable material for nether shelters. When to go

When it comes to female-oriented games, the lingering thing is the false love stories created by various otome-oriented games. Although everyone has their own love, there are also many players who are keen to interact with various male characters, and there are even many The "crazy" operation of the new otome-oriented game has attracted attention, but it has to be said that female-oriented games have once again returned to the public eye. Different from these otome-oriented games, there is a relatively "alternative" product among female-oriented games-"In the Name of Shining". As a free fashion lifestyle game for women, "In the Name of Shining" allows female players to truly be themselves according to their own preferences in the virtual world by providing a variety of fashion suits and home construction and other gameplay content. Exposing yourself to your infinite possibilities is like a breath of fresh air in the chaos.

Minecraft is an adventure sandbox game with a high degree of freedom. The game regularly releases updates and expansion packs. Different functions in the game are also updated. We can create a new world of our own in it. There are many in the game. The serum is worth our experience and can help us fight against viruses in the game. How to make Growth Serum in Minecraft Growth serum needs to be synthesized at the workbench. The materials include rotten flesh*3, nether star*1, fire bomb*2, glass bottle*1, and ghast's tears*2. Right-clicking on a creature can make the corresponding creature giant, such as a spider, which can turn it into a spider titan. Only valid for original creatures and Titan summons (excluding special summons, such as giants).

Since the introduction of the Minecraft launcher on the store, some Minecraft players have complained that the login process does not work on their systems. This seems to be an issue only with new launchers. So, we have listed down all these fixes for you to resolve Minecraft login issues. Fix 1 – Repair Minecraft Launcher The first thing you should try is to fix Minecraft Launcher. Step 1 – Press and hold Windows Key + X Key simultaneously. Power user menu will be improved. Step 2 – Once there, click on “Installed Apps” to open it. Step 3 – If you browse down to the “Installed Applications” page you will find “Minecraft Launch