From 0f5106abe3f1d6791c88c1b3714b67b3de980b0a Mon Sep 17 00:00:00 2001 From: IThundxr Date: Sat, 15 Jun 2024 10:11:09 -0400 Subject: [PATCH] start work on display sources #70 --- .../content/vendor/VendorDisplaySource.java | 33 +++++++++++++++++++ .../registry/NumismaticsBlocks.java | 5 +++ 2 files changed, 38 insertions(+) create mode 100644 common/src/main/java/dev/ithundxr/createnumismatics/content/vendor/VendorDisplaySource.java diff --git a/common/src/main/java/dev/ithundxr/createnumismatics/content/vendor/VendorDisplaySource.java b/common/src/main/java/dev/ithundxr/createnumismatics/content/vendor/VendorDisplaySource.java new file mode 100644 index 00000000..eaa8e9f9 --- /dev/null +++ b/common/src/main/java/dev/ithundxr/createnumismatics/content/vendor/VendorDisplaySource.java @@ -0,0 +1,33 @@ +/* + * Numismatics + * Copyright (c) 2024 The Railways Team + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package dev.ithundxr.createnumismatics.content.vendor; + +import com.simibubi.create.content.redstone.displayLink.DisplayLinkContext; +import com.simibubi.create.content.redstone.displayLink.source.DisplaySource; +import com.simibubi.create.content.redstone.displayLink.target.DisplayTargetStats; +import net.minecraft.network.chat.MutableComponent; + +import java.util.List; + +public class VendorDisplaySource extends DisplaySource { + @Override + public List provideText(DisplayLinkContext context, DisplayTargetStats stats) { + return List.of(); + } +} diff --git a/common/src/main/java/dev/ithundxr/createnumismatics/registry/NumismaticsBlocks.java b/common/src/main/java/dev/ithundxr/createnumismatics/registry/NumismaticsBlocks.java index 42e0cf89..6329c63e 100644 --- a/common/src/main/java/dev/ithundxr/createnumismatics/registry/NumismaticsBlocks.java +++ b/common/src/main/java/dev/ithundxr/createnumismatics/registry/NumismaticsBlocks.java @@ -20,6 +20,7 @@ import com.simibubi.create.AllBlocks; import com.simibubi.create.AllTags; +import com.simibubi.create.content.redstone.displayLink.source.BoilerDisplaySource; import com.simibubi.create.foundation.data.CreateRegistrate; import com.simibubi.create.foundation.data.SharedProperties; import com.simibubi.create.foundation.item.ItemDescription; @@ -31,6 +32,7 @@ import dev.ithundxr.createnumismatics.content.depositor.AndesiteDepositorBlock; import dev.ithundxr.createnumismatics.content.depositor.BrassDepositorBlock; import dev.ithundxr.createnumismatics.content.vendor.VendorBlock; +import dev.ithundxr.createnumismatics.content.vendor.VendorDisplaySource; import dev.ithundxr.createnumismatics.multiloader.CommonTags; import net.minecraft.client.renderer.RenderType; import net.minecraft.core.registries.Registries; @@ -42,6 +44,7 @@ import net.minecraft.world.level.storage.loot.entries.LootItem; import net.minecraft.world.level.storage.loot.providers.number.ConstantValue; +import static com.simibubi.create.content.redstone.displayLink.AllDisplayBehaviours.assignDataBehaviour; import static com.simibubi.create.foundation.data.TagGen.axeOrPickaxe; import static com.simibubi.create.foundation.data.TagGen.pickaxeOnly; @@ -112,6 +115,7 @@ public class NumismaticsBlocks { .properties(p -> p.strength(1.0F, 3600000.0F)) // Unexplodable .properties(BlockBehaviour.Properties::requiresCorrectToolForDrops) .transform(pickaxeOnly()) + .onRegister(assignDataBehaviour(new VendorDisplaySource(), "vendor_price")) .addLayer(() -> RenderType::cutout) .lang("Vendor") .transform(BuilderTransformers.vendor(false)) @@ -128,6 +132,7 @@ public class NumismaticsBlocks { .properties(p -> p.strength(-1.0F, 3600000.0F)) // Unbreakable & Unexplodable .properties(BlockBehaviour.Properties::requiresCorrectToolForDrops) .transform(pickaxeOnly()) + .onRegister(assignDataBehaviour(new VendorDisplaySource(), "vendor_price")) .addLayer(() -> RenderType::cutout) .lang("Creative Vendor") .transform(BuilderTransformers.vendor(true))