Register CC's modems as brittle

This tells Create that modems will pop-off if their neighbour is moved,
and so changes the order that the block is moved in.

We possibly should use BlockMovementChecks.AttachedCheck instead, to
properly handle the direction modems are facing in. However, this
doesn't appear to be part of the public API, so probably best avoided.

Fixes #948
This commit is contained in:
Jonathan Coates 2024-04-03 08:44:30 +01:00
parent 0c1ab780bb
commit c8eadf4011
No known key found for this signature in database
GPG Key ID: B9E431FF07C98D06
4 changed files with 51 additions and 0 deletions

View File

@ -6,6 +6,7 @@
import dan200.computercraft.api.ComputerCraftTags;
import dan200.computercraft.shared.ModRegistry;
import dan200.computercraft.shared.integration.ExternalModTags;
import dan200.computercraft.shared.platform.RegistryWrappers;
import net.minecraft.data.tags.ItemTagsProvider;
import net.minecraft.data.tags.TagsProvider;
@ -81,6 +82,12 @@ public static void blockTags(TagConsumer<Block> tags) {
);
tags.tag(BlockTags.WITHER_IMMUNE).add(ModRegistry.Blocks.COMPUTER_COMMAND.get());
tags.tag(ExternalModTags.Blocks.CREATE_BRITTLE).add(
ModRegistry.Blocks.CABLE.get(),
ModRegistry.Blocks.WIRELESS_MODEM_ADVANCED.get(),
ModRegistry.Blocks.WIRELESS_MODEM_ADVANCED.get()
);
}
public static void itemTags(ItemTagConsumer tags) {

View File

@ -0,0 +1,37 @@
// SPDX-FileCopyrightText: 2024 The CC: Tweaked Developers
//
// SPDX-License-Identifier: MPL-2.0
package dan200.computercraft.shared.integration;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
import net.minecraft.world.level.block.Block;
/**
* Tags defined by external mods.
*/
public final class ExternalModTags {
private ExternalModTags() {
}
/**
* Block tags defined by external mods.
*/
public static final class Blocks {
private Blocks() {
}
/**
* Create's "brittle" tag, used to determine if this block needs to be moved before its neighbours.
*
* @see <a href="https://github.com/Creators-of-Create/Create/blob/mc1.20.1/dev/src/main/java/com/simibubi/create/content/contraptions/BlockMovementChecks.java">{@code BlockMovementChecks}</a>
*/
public static final TagKey<Block> CREATE_BRITTLE = make("create", "brittle");
private static TagKey<Block> make(String mod, String name) {
return TagKey.create(Registries.BLOCK, new ResourceLocation(mod, name));
}
}
}

View File

@ -0,0 +1,4 @@
{
"replace": false,
"values": ["computercraft:cable", "computercraft:wireless_modem_advanced", "computercraft:wireless_modem_advanced"]
}

View File

@ -0,0 +1,3 @@
{
"values": ["computercraft:cable", "computercraft:wireless_modem_advanced", "computercraft:wireless_modem_advanced"]
}