Fix recipe and model

This commit is contained in:
SD 2021-03-25 18:39:56 +05:30
parent 53a234c109
commit 1d02356036
6 changed files with 28 additions and 19 deletions

View file

@ -1,14 +1,17 @@
package org.dimdev.dimdoors.client.wthit; package org.dimdev.dimdoors.client.wthit;
import java.util.List; import java.util.List;
import java.util.Objects;
import mcp.mobius.waila.api.IComponentProvider; import mcp.mobius.waila.api.IComponentProvider;
import mcp.mobius.waila.api.IDataAccessor; import mcp.mobius.waila.api.IDataAccessor;
import mcp.mobius.waila.api.IPluginConfig; import mcp.mobius.waila.api.IPluginConfig;
import org.dimdev.dimdoors.block.entity.EntranceRiftBlockEntity; import org.dimdev.dimdoors.block.entity.EntranceRiftBlockEntity;
import org.dimdev.dimdoors.rift.registry.LinkProperties; import org.dimdev.dimdoors.rift.registry.LinkProperties;
import org.dimdev.dimdoors.rift.targets.VirtualTarget;
import net.minecraft.text.LiteralText; import net.minecraft.text.LiteralText;
import net.minecraft.text.MutableText;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TextColor; import net.minecraft.text.TextColor;
import net.minecraft.text.TranslatableText; import net.minecraft.text.TranslatableText;
@ -19,18 +22,11 @@ public enum EntranceRiftProvider implements IComponentProvider {
@Override @Override
public void appendBody(List<Text> tooltip, IDataAccessor accessor, IPluginConfig config) { public void appendBody(List<Text> tooltip, IDataAccessor accessor, IPluginConfig config) {
EntranceRiftBlockEntity blockEntity = ((EntranceRiftBlockEntity) accessor.getBlockEntity()); EntranceRiftBlockEntity blockEntity = ((EntranceRiftBlockEntity) accessor.getBlockEntity());
LinkProperties properties = blockEntity.getProperties(); VirtualTarget destination = Objects.requireNonNull(blockEntity).getDestination();
if (properties != null) { if (destination != null) {
tooltip.add(new TranslatableText("dimdoors.linkProperties.oneWay", properties.isOneWay())); TranslatableText tKey = new TranslatableText(destination.getType().getTranslationKey());
tooltip.add(new TranslatableText("dimdoors.linkProperties.linksRemaining", properties.getLinksRemaining())); 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"));
} }
} }

View file

@ -4,10 +4,11 @@ import mcp.mobius.waila.api.IRegistrar;
import mcp.mobius.waila.api.IWailaPlugin; import mcp.mobius.waila.api.IWailaPlugin;
import mcp.mobius.waila.api.TooltipPosition; import mcp.mobius.waila.api.TooltipPosition;
import org.dimdev.dimdoors.block.door.DimensionalDoorBlock; import org.dimdev.dimdoors.block.door.DimensionalDoorBlock;
import org.dimdev.dimdoors.block.entity.EntranceRiftBlockEntity;
public class WthitPlugin implements IWailaPlugin { public class WthitPlugin implements IWailaPlugin {
@Override @Override
public void register(IRegistrar registrar) { public void register(IRegistrar registrar) {
registrar.registerComponentProvider(EntranceRiftProvider.INSTANCE, TooltipPosition.TAIL, DimensionalDoorBlock.class); registrar.registerComponentProvider(EntranceRiftProvider.INSTANCE, TooltipPosition.TAIL, EntranceRiftBlockEntity.class);
} }
} }

View file

@ -1,11 +1,13 @@
package org.dimdev.dimdoors.rift.targets; package org.dimdev.dimdoors.rift.targets;
import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.function.Function; import java.util.function.Function;
import javax.sound.sampled.Port; import javax.sound.sampled.Port;
import com.mojang.serialization.Lifecycle; import com.mojang.serialization.Lifecycle;
import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap;
import org.dimdev.dimdoors.util.Location; import org.dimdev.dimdoors.util.Location;
import org.dimdev.dimdoors.util.RGBA; import org.dimdev.dimdoors.util.RGBA;
@ -98,6 +100,7 @@ public abstract class VirtualTarget implements Target {
VirtualTargetType<IdMarker> ID_MARKER = register("dimdoors:id_marker", IdMarker::fromTag, IdMarker::toTag, VirtualTarget.COLOR); VirtualTargetType<IdMarker> ID_MARKER = register("dimdoors:id_marker", IdMarker::fromTag, IdMarker::toTag, VirtualTarget.COLOR);
VirtualTargetType<UnstableTarget> UNSTABLE = register("dimdoors:unstable", tag -> new UnstableTarget(), t -> new CompoundTag(), VirtualTarget.COLOR); VirtualTargetType<UnstableTarget> UNSTABLE = register("dimdoors:unstable", tag -> new UnstableTarget(), t -> new CompoundTag(), VirtualTarget.COLOR);
VirtualTargetType<NoneTarget> NONE = register("dimdoors:none", tag -> NoneTarget.INSTANCE, i -> new CompoundTag(), COLOR); VirtualTargetType<NoneTarget> NONE = register("dimdoors:none", tag -> NoneTarget.INSTANCE, i -> new CompoundTag(), COLOR);
Map<VirtualTargetType<?>, String> TRANSLATION_KEYS = new Object2ObjectArrayMap<>();
T fromTag(CompoundTag tag); T fromTag(CompoundTag tag);
@ -105,6 +108,17 @@ public abstract class VirtualTarget implements Target {
RGBA getColor(); 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() { static void register() {
} }

View file

@ -46,6 +46,7 @@
"block.dimdoors.unravelled_fabric": "Unraveled Fabric", "block.dimdoors.unravelled_fabric": "Unraveled Fabric",
"block.dimdoors.rift": "Rift Scar", "block.dimdoors.rift": "Rift Scar",
"block.dimdoors.eternal_fluid": "Eternal Fluid", "block.dimdoors.eternal_fluid": "Eternal Fluid",
"block.dimdoors.solid_static": "Solid Static",
"item.dimdoors.gold_door": "Gold Door", "item.dimdoors.gold_door": "Gold Door",
"item.dimdoors.quartz_door": "Quartz Door", "item.dimdoors.quartz_door": "Quartz Door",
@ -202,10 +203,7 @@
"argument.dimdoors.schematic.invalidNamespace": "Invalid schematic namespace. Expected one of %s, found %s.", "argument.dimdoors.schematic.invalidNamespace": "Invalid schematic namespace. Expected one of %s, found %s.",
"command.dimdoors.schematicv2.unknownSchematic": "Unknown schematic \"%s\" in namespace \"%s\" ", "command.dimdoors.schematicv2.unknownSchematic": "Unknown schematic \"%s\" in namespace \"%s\" ",
"dimdoors.config.screen.reload": "Reload Config", "dimdoors.destination": "Destination type",
"dimdoors.linkProperties.oneWay": "One way: %s",
"dimdoors.linkProperties.linksRemaining": "Remaining links: %s",
"dimdoors.color": "Color: ",
"dimdoors.advancement.root": "Dimensional Doors", "dimdoors.advancement.root": "Dimensional Doors",
"dimdoors.advancement.root.desc": "Venture into the depths", "dimdoors.advancement.root.desc": "Venture into the depths",
"dimdoors.advancement.public_pocket": "Public Pockets", "dimdoors.advancement.public_pocket": "Public Pockets",

View file

@ -1,6 +1,6 @@
{ {
"parent": "block/cube_all", "parent": "block/cube_all",
"textures": { "textures": {
"all": "dimdoors:blocks/solid_static" "all": "dimdoors:block/solid_static"
} }
} }

View file

@ -7,7 +7,7 @@
], ],
"key": { "key": {
"X": { "X": {
"item": "minecraft:stable_fabric" "item": "dimdoors:stable_fabric"
}, },
"#": { "#": {
"item": "minecraft:diamond" "item": "minecraft:diamond"