diff --git a/src/main/java/org/dimdev/dimdoors/client/wthit/EntranceRiftProvider.java b/src/main/java/org/dimdev/dimdoors/client/wthit/EntranceRiftProvider.java index 975a4736..d1506bd5 100644 --- a/src/main/java/org/dimdev/dimdoors/client/wthit/EntranceRiftProvider.java +++ b/src/main/java/org/dimdev/dimdoors/client/wthit/EntranceRiftProvider.java @@ -1,14 +1,17 @@ package org.dimdev.dimdoors.client.wthit; import java.util.List; +import java.util.Objects; import mcp.mobius.waila.api.IComponentProvider; import mcp.mobius.waila.api.IDataAccessor; import mcp.mobius.waila.api.IPluginConfig; import org.dimdev.dimdoors.block.entity.EntranceRiftBlockEntity; import org.dimdev.dimdoors.rift.registry.LinkProperties; +import org.dimdev.dimdoors.rift.targets.VirtualTarget; import net.minecraft.text.LiteralText; +import net.minecraft.text.MutableText; import net.minecraft.text.Text; import net.minecraft.text.TextColor; import net.minecraft.text.TranslatableText; @@ -19,18 +22,11 @@ public enum EntranceRiftProvider implements IComponentProvider { @Override public void appendBody(List tooltip, IDataAccessor accessor, IPluginConfig config) { EntranceRiftBlockEntity blockEntity = ((EntranceRiftBlockEntity) accessor.getBlockEntity()); - LinkProperties properties = blockEntity.getProperties(); - if (properties != null) { - tooltip.add(new TranslatableText("dimdoors.linkProperties.oneWay", properties.isOneWay())); - tooltip.add(new TranslatableText("dimdoors.linkProperties.linksRemaining", properties.getLinksRemaining())); + VirtualTarget destination = Objects.requireNonNull(blockEntity).getDestination(); + if (destination != null) { + TranslatableText tKey = new TranslatableText(destination.getType().getTranslationKey()); + Text main = new TranslatableText("dimdoors.destination").append(" ").append(tKey); + tooltip.add(main); } - if (blockEntity.getColor() != null) { - TranslatableText colorText = new TranslatableText("dimdoors.color"); - LiteralText actualColorText = new LiteralText(Integer.toHexString(blockEntity.getColor().toIntNoAlpha())); - actualColorText.getStyle().withColor(TextColor.fromRgb(blockEntity.getColor().toIntNoAlpha())); - colorText.append(actualColorText); - tooltip.add(new TranslatableText("dimdoors.color", colorText)); - } - tooltip.add(new LiteralText("Foo")); } } diff --git a/src/main/java/org/dimdev/dimdoors/client/wthit/WthitPlugin.java b/src/main/java/org/dimdev/dimdoors/client/wthit/WthitPlugin.java index 63ad859a..d4713a6d 100644 --- a/src/main/java/org/dimdev/dimdoors/client/wthit/WthitPlugin.java +++ b/src/main/java/org/dimdev/dimdoors/client/wthit/WthitPlugin.java @@ -4,10 +4,11 @@ import mcp.mobius.waila.api.IRegistrar; import mcp.mobius.waila.api.IWailaPlugin; import mcp.mobius.waila.api.TooltipPosition; import org.dimdev.dimdoors.block.door.DimensionalDoorBlock; +import org.dimdev.dimdoors.block.entity.EntranceRiftBlockEntity; public class WthitPlugin implements IWailaPlugin { @Override public void register(IRegistrar registrar) { - registrar.registerComponentProvider(EntranceRiftProvider.INSTANCE, TooltipPosition.TAIL, DimensionalDoorBlock.class); + registrar.registerComponentProvider(EntranceRiftProvider.INSTANCE, TooltipPosition.TAIL, EntranceRiftBlockEntity.class); } } diff --git a/src/main/java/org/dimdev/dimdoors/rift/targets/VirtualTarget.java b/src/main/java/org/dimdev/dimdoors/rift/targets/VirtualTarget.java index 013a258b..2ff906b9 100644 --- a/src/main/java/org/dimdev/dimdoors/rift/targets/VirtualTarget.java +++ b/src/main/java/org/dimdev/dimdoors/rift/targets/VirtualTarget.java @@ -1,11 +1,13 @@ package org.dimdev.dimdoors.rift.targets; +import java.util.Map; import java.util.Objects; import java.util.function.Function; import javax.sound.sampled.Port; import com.mojang.serialization.Lifecycle; +import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap; import org.dimdev.dimdoors.util.Location; import org.dimdev.dimdoors.util.RGBA; @@ -98,6 +100,7 @@ public abstract class VirtualTarget implements Target { VirtualTargetType ID_MARKER = register("dimdoors:id_marker", IdMarker::fromTag, IdMarker::toTag, VirtualTarget.COLOR); VirtualTargetType UNSTABLE = register("dimdoors:unstable", tag -> new UnstableTarget(), t -> new CompoundTag(), VirtualTarget.COLOR); VirtualTargetType NONE = register("dimdoors:none", tag -> NoneTarget.INSTANCE, i -> new CompoundTag(), COLOR); + Map, String> TRANSLATION_KEYS = new Object2ObjectArrayMap<>(); T fromTag(CompoundTag tag); @@ -105,6 +108,17 @@ public abstract class VirtualTarget implements Target { RGBA getColor(); + default Identifier getId() { + return REGISTRY.getId(this); + } + + default String getTranslationKey() { + return TRANSLATION_KEYS.computeIfAbsent(this, t -> { + Identifier id = t.getId(); + return "dimdoors.virtualTarget." + id.getNamespace() + "." + id.getPath(); + }); + } + static void register() { } diff --git a/src/main/resources/assets/dimdoors/lang/en_us.json b/src/main/resources/assets/dimdoors/lang/en_us.json index 9f523765..6b7701dd 100644 --- a/src/main/resources/assets/dimdoors/lang/en_us.json +++ b/src/main/resources/assets/dimdoors/lang/en_us.json @@ -46,6 +46,7 @@ "block.dimdoors.unravelled_fabric": "Unraveled Fabric", "block.dimdoors.rift": "Rift Scar", "block.dimdoors.eternal_fluid": "Eternal Fluid", + "block.dimdoors.solid_static": "Solid Static", "item.dimdoors.gold_door": "Gold Door", "item.dimdoors.quartz_door": "Quartz Door", @@ -202,10 +203,7 @@ "argument.dimdoors.schematic.invalidNamespace": "Invalid schematic namespace. Expected one of %s, found %s.", "command.dimdoors.schematicv2.unknownSchematic": "Unknown schematic \"%s\" in namespace \"%s\" ", - "dimdoors.config.screen.reload": "Reload Config", - "dimdoors.linkProperties.oneWay": "One way: %s", - "dimdoors.linkProperties.linksRemaining": "Remaining links: %s", - "dimdoors.color": "Color: ", + "dimdoors.destination": "Destination type", "dimdoors.advancement.root": "Dimensional Doors", "dimdoors.advancement.root.desc": "Venture into the depths", "dimdoors.advancement.public_pocket": "Public Pockets", diff --git a/src/main/resources/assets/dimdoors/models/block/solid_static.json b/src/main/resources/assets/dimdoors/models/block/solid_static.json index 03fe6dfa..4fde8e8a 100644 --- a/src/main/resources/assets/dimdoors/models/block/solid_static.json +++ b/src/main/resources/assets/dimdoors/models/block/solid_static.json @@ -1,6 +1,6 @@ { "parent": "block/cube_all", "textures": { - "all": "dimdoors:blocks/solid_static" + "all": "dimdoors:block/solid_static" } } diff --git a/src/main/resources/data/dimdoors/recipes/rift_stabilizer_stable_fabric.json b/src/main/resources/data/dimdoors/recipes/rift_stabilizer_stable_fabric.json index 0d03f442..f8429585 100644 --- a/src/main/resources/data/dimdoors/recipes/rift_stabilizer_stable_fabric.json +++ b/src/main/resources/data/dimdoors/recipes/rift_stabilizer_stable_fabric.json @@ -7,7 +7,7 @@ ], "key": { "X": { - "item": "minecraft:stable_fabric" + "item": "dimdoors:stable_fabric" }, "#": { "item": "minecraft:diamond"