mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Prevent double placement for custom block items (#3399)
This commit is contained in:
parent
37931e4996
commit
7171ade0bd
1 changed files with 13 additions and 0 deletions
|
@ -124,6 +124,10 @@ public class CustomItemRegistryPopulator {
|
||||||
computeArmorProperties(mapping.getArmorType(), mapping.getProtectionValue(), componentBuilder);
|
computeArmorProperties(mapping.getArmorType(), mapping.getProtectionValue(), componentBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mapping.getFirstBlockRuntimeId() != null) {
|
||||||
|
computeBlockItemProperties(mapping.getBedrockIdentifier(), componentBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
computeRenderOffsets(false, customItemData, componentBuilder);
|
computeRenderOffsets(false, customItemData, componentBuilder);
|
||||||
|
|
||||||
componentBuilder.putCompound("item_properties", itemProperties.build());
|
componentBuilder.putCompound("item_properties", itemProperties.build());
|
||||||
|
@ -260,6 +264,15 @@ public class CustomItemRegistryPopulator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void computeBlockItemProperties(String blockItem, NbtMapBuilder componentBuilder) {
|
||||||
|
// carved pumpkin should be able to be worn and for that we would need to add wearable and armor with protection 0 here
|
||||||
|
// however this would have the side effect of preventing carved pumpkins from working as an attachable on the RP side outside the head slot
|
||||||
|
// it also causes the item to glitch when right clicked to "equip" so this should only be added here later if these issues can be overcome
|
||||||
|
|
||||||
|
// all block items registered should be given this component to prevent double placement
|
||||||
|
componentBuilder.putCompound("minecraft:block_placer", NbtMap.builder().putString("block", blockItem).build());
|
||||||
|
}
|
||||||
|
|
||||||
private static void computeRenderOffsets(boolean isHat, CustomItemData customItemData, NbtMapBuilder componentBuilder) {
|
private static void computeRenderOffsets(boolean isHat, CustomItemData customItemData, NbtMapBuilder componentBuilder) {
|
||||||
if (isHat) {
|
if (isHat) {
|
||||||
componentBuilder.remove("minecraft:render_offsets");
|
componentBuilder.remove("minecraft:render_offsets");
|
||||||
|
|
Loading…
Reference in a new issue