From 4db9a9cab41073b99d0cf6211890b76cfa5caa93 Mon Sep 17 00:00:00 2001 From: trinsdar <30245301+Trinsdar@users.noreply.github.com> Date: Sun, 1 Dec 2024 12:02:06 -0500 Subject: [PATCH] added tooltips to bedrock flowers, and dye recipes using them --- AntimatterAPI | 2 +- .../gt5r/block/BlockBedrockFlower.java | 33 ++++++++++++-- .../gtreimagined/gt5r/data/GT5RBlocks.java | 43 ++++++++++--------- .../gt5r/datagen/GT5RLocalizations.java | 5 +++ .../loader/crafting/VanillaExtensions.java | 15 +++++++ 5 files changed, 74 insertions(+), 24 deletions(-) diff --git a/AntimatterAPI b/AntimatterAPI index dbede39d8..127aae61c 160000 --- a/AntimatterAPI +++ b/AntimatterAPI @@ -1 +1 @@ -Subproject commit dbede39d8d60b91c47f41aab349562da80c49b60 +Subproject commit 127aae61c63013ff28d15a83f19efd298ff258c2 diff --git a/common/src/main/java/org/gtreimagined/gt5r/block/BlockBedrockFlower.java b/common/src/main/java/org/gtreimagined/gt5r/block/BlockBedrockFlower.java index 0025847ac..bc28a472d 100644 --- a/common/src/main/java/org/gtreimagined/gt5r/block/BlockBedrockFlower.java +++ b/common/src/main/java/org/gtreimagined/gt5r/block/BlockBedrockFlower.java @@ -9,8 +9,13 @@ import muramasa.antimatter.registration.IModelProvider; import muramasa.antimatter.registration.ITextureProvider; import muramasa.antimatter.texture.Texture; +import muramasa.antimatter.util.Utils; import net.minecraft.core.BlockPos; +import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.BlockTags; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.block.Block; @@ -22,19 +27,27 @@ import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; +import org.gtreimagined.gt5r.data.GT5RBlocks; +import org.jetbrains.annotations.Nullable; + +import java.util.List; public class BlockBedrockFlower extends BushBlock implements IAntimatterObject, IModelProvider, ITextureProvider { protected static final VoxelShape SHAPE = Block.box(5.0, 0.0, 5.0, 11.0, 10.0, 11.0); private final String domain, id; + public final muramasa.antimatter.material.Material tooltipMaterial; + private final boolean sand; - public BlockBedrockFlower(String domain, String id) { - this(domain, id, Properties.of(Material.PLANT).noCollission().instabreak().sound(SoundType.GRASS)); + public BlockBedrockFlower(String domain, String id, muramasa.antimatter.material.Material tooltipMaterial, boolean sand) { + this(domain, id, tooltipMaterial, sand, Properties.of(Material.PLANT).noCollission().instabreak().sound(SoundType.GRASS)); } - public BlockBedrockFlower(String domain, String id, Properties props) { + public BlockBedrockFlower(String domain, String id, muramasa.antimatter.material.Material tooltipMaterial, boolean sand, Properties props) { super(props); this.domain = domain; this.id = id; + this.tooltipMaterial = tooltipMaterial; + this.sand = sand; AntimatterAPI.register(BlockBedrockFlower.class, this); } @@ -78,4 +91,18 @@ public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, Co public BlockBehaviour.OffsetType getOffsetType() { return OffsetType.XZ; } + + @Override + public boolean mayPlaceOn(BlockState state, BlockGetter level, BlockPos pos) { + if (sand){ + return state.is(BlockTags.SAND); + } + return super.mayPlaceOn(state, level, pos); + } + + @Override + public void appendHoverText(ItemStack stack, @Nullable BlockGetter level, List tooltip, TooltipFlag flag) { + super.appendHoverText(stack, level, tooltip, flag); + tooltip.add(Utils.translatable("tooltip." + getDomain() + "." + getId().replace("/", "."))); + } } diff --git a/common/src/main/java/org/gtreimagined/gt5r/data/GT5RBlocks.java b/common/src/main/java/org/gtreimagined/gt5r/data/GT5RBlocks.java index 3878f3101..40af7b9b1 100644 --- a/common/src/main/java/org/gtreimagined/gt5r/data/GT5RBlocks.java +++ b/common/src/main/java/org/gtreimagined/gt5r/data/GT5RBlocks.java @@ -25,6 +25,9 @@ import net.minecraft.world.level.material.MaterialColor; import org.gtreimagined.gt5r.block.*; +import static muramasa.antimatter.data.AntimatterMaterials.*; +import static org.gtreimagined.gt5r.data.Materials.*; + public class GT5RBlocks { public static final LiquidBlock LAVA = AntimatterAPI.register(Block.class, "lava", GT5RRef.ID, new LiquidBlock(Fluids.LAVA, BlockBehaviour.Properties.of(net.minecraft.world.level.material.Material.LAVA).noCollission().randomTicks().strength(100.0F).lightLevel((blockStatex) -> 15).noDrops()){ @@ -46,21 +49,21 @@ public Texture[] getTextures() { } }; - public static final BlockBedrockFlower ALTERED_ANDESITE_BUCKWHEAT = new BlockBedrockFlower(GT5RRef.ID, "altered_andesite_buckwheat"); - public static final BlockBedrockFlower CROSBY_BUCKWHEAT = new BlockBedrockFlower(GT5RRef.ID, "crosby_buckwheat"); - public static final BlockBedrockFlower ALPINE_CATCHFLY = new BlockBedrockFlower(GT5RRef.ID, "alpine_catchfly"); - public static final BlockBedrockFlower VIOLA_CALAMINARIA = new BlockBedrockFlower(GT5RRef.ID, "viola_calaminaria"); - public static final BlockBedrockFlower THLASPI_LERESCHIANUM = new BlockBedrockFlower(GT5RRef.ID, "thlaspi_lereschianum"); - public static final BlockBedrockFlower TUFTED_EVENING_PRIMROSE = new BlockBedrockFlower(GT5RRef.ID, "tufted_evening_primrose"); - public static final BlockBedrockFlower NARCISSUS_SHELDONIA = new BlockBedrockFlower(GT5RRef.ID, "narcissus_sheldonia"); - public static final BlockBedrockFlower ORECHID = new BlockBedrockFlower(GT5RRef.ID, "orechid"); - public static final BlockBedrockFlower ATRIPLEX_CANESCENS = new BlockBedrockFlower(GT5RRef.ID, "atriplex_canescens"); - public static final BlockBedrockFlower DESERT_TRUMPET = new BlockBedrockFlower(GT5RRef.ID, "desert_trumpet"); - public static final BlockBedrockFlower BECIUM_HOMBLEI = new BlockBedrockFlower(GT5RRef.ID, "becium_homblei"); - public static final BlockBedrockFlower PRINCES_PLUME = new BlockBedrockFlower(GT5RRef.ID, "princes_plume"); - public static final BlockBedrockFlower THOMPSONS_LOCOWEED = new BlockBedrockFlower(GT5RRef.ID, "thompsons_locoweed"); - public static final BlockBedrockFlower PANDANUS_CANDELABRUM = new BlockBedrockFlower(GT5RRef.ID, "pandanus_candelabrum"); - public static final BlockBedrockFlower TUNGSTUS = new BlockBedrockFlower(GT5RRef.ID, "tungstus"); + public static final BlockBedrockFlower ALTERED_ANDESITE_BUCKWHEAT = new BlockBedrockFlower(GT5RRef.ID, "altered_andesite_buckwheat", Gold, false); + public static final BlockBedrockFlower CROSBY_BUCKWHEAT = new BlockBedrockFlower(GT5RRef.ID, "crosby_buckwheat", Silver, false); + public static final BlockBedrockFlower ALPINE_CATCHFLY = new BlockBedrockFlower(GT5RRef.ID, "alpine_catchfly", Copper, false); + public static final BlockBedrockFlower VIOLA_CALAMINARIA = new BlockBedrockFlower(GT5RRef.ID, "viola_calaminaria", Zinc, false); + public static final BlockBedrockFlower THLASPI_LERESCHIANUM = new BlockBedrockFlower(GT5RRef.ID, "thlaspi_lereschianum", Nickel, false); + public static final BlockBedrockFlower TUFTED_EVENING_PRIMROSE = new BlockBedrockFlower(GT5RRef.ID, "tufted_evening_primrose", Uranium, false); + public static final BlockBedrockFlower NARCISSUS_SHELDONIA = new BlockBedrockFlower(GT5RRef.ID, "narcissus_sheldonia", Platinum, false); + public static final BlockBedrockFlower ORECHID = new BlockBedrockFlower(GT5RRef.ID, "orechid", muramasa.antimatter.material.Material.NULL, false); + public static final BlockBedrockFlower ATRIPLEX_CANESCENS = new BlockBedrockFlower(GT5RRef.ID, "atriplex_canescens", Antimony, true); + public static final BlockBedrockFlower DESERT_TRUMPET = new BlockBedrockFlower(GT5RRef.ID, "desert_trumpet", Gold, true); + public static final BlockBedrockFlower BECIUM_HOMBLEI = new BlockBedrockFlower(GT5RRef.ID, "becium_homblei", Copper, true); + public static final BlockBedrockFlower PRINCES_PLUME = new BlockBedrockFlower(GT5RRef.ID, "princes_plume", Redstone, true); + public static final BlockBedrockFlower THOMPSONS_LOCOWEED = new BlockBedrockFlower(GT5RRef.ID, "thompsons_locoweed", Uranium, true); + public static final BlockBedrockFlower PANDANUS_CANDELABRUM = new BlockBedrockFlower(GT5RRef.ID, "pandanus_candelabrum", Diamond, true); + public static final BlockBedrockFlower TUNGSTUS = new BlockBedrockFlower(GT5RRef.ID, "tungstus", Tungsten, true); public static final BlockBasic POWDER_BARREL = new BlockPowderBarrel(); public static final BlockBasic MINING_PIPE_THIN = new BlockMiningPipe(GT5RRef.ID, "mining_pipe_thin", BlockBehaviour.Properties.of(Material.STONE, MaterialColor.COLOR_GRAY).strength(1.0f, 3.0f)); @@ -202,9 +205,9 @@ public Texture[] getTextures() { public static final Cable CABLE_COPPER = AntimatterAPI.register(Cable.class, new Cable<>(GT5RRef.ID, AntimatterMaterials.Copper, 2, Tier.MV).amps(1)); public static final Cable CABLE_ANNEALED_COPPER = AntimatterAPI.register(Cable.class, new Cable<>(GT5RRef.ID, Materials.AnnealedCopper, 1, Tier.MV).amps(1)); public static final Cable CABLE_KANTHAL = AntimatterAPI.register(Cable.class, new Cable<>(GT5RRef.ID, Materials.Kanthal, 3, Tier.HV).amps(4)); //H); - public static final Cable CABLE_GOLD = AntimatterAPI.register(Cable.class, new Cable<>(GT5RRef.ID, AntimatterMaterials.Gold, 2, Tier.HV).amps(3)); + public static final Cable CABLE_GOLD = AntimatterAPI.register(Cable.class, new Cable<>(GT5RRef.ID, Gold, 2, Tier.HV).amps(3)); public static final Cable CABLE_ELECTRUM = AntimatterAPI.register(Cable.class, new Cable<>(GT5RRef.ID, Materials.Electrum, 2, Tier.HV).amps(2)); - public static final Cable CABLE_SILVER = AntimatterAPI.register(Cable.class,new Cable<>(GT5RRef.ID, Materials.Silver, 1, Tier.HV).amps(1)); + public static final Cable CABLE_SILVER = AntimatterAPI.register(Cable.class,new Cable<>(GT5RRef.ID, Silver, 1, Tier.HV).amps(1)); public static final Cable CABLE_NICHROME = AntimatterAPI.register(Cable.class, new Cable<>(GT5RRef.ID, Materials.Nichrome, 4, Tier.EV).amps(3)); //E); public static final Cable CABLE_STEEL = AntimatterAPI.register(Cable.class, new Cable<>(GT5RRef.ID, Materials.Steel, 2, Tier.EV).amps(2)); public static final Cable CABLE_TITANIUM = AntimatterAPI.register(Cable.class, new Cable<>(GT5RRef.ID, Materials.Titanium, 2, Tier.EV).amps(4)); @@ -233,9 +236,9 @@ public Texture[] getTextures() { public static final Wire WIRE_COPPER = AntimatterAPI.register(Wire.class, new Wire<>(GT5RRef.ID, AntimatterMaterials.Copper, 4, Tier.MV).amps(1)); public static final Wire WIRE_ANNEALED_COPPER = AntimatterAPI.register(Wire.class, new Wire<>(GT5RRef.ID, Materials.AnnealedCopper, 2, Tier.MV).amps(1)); public static final Wire WIRE_KANTHAL = AntimatterAPI.register(Wire.class, new Wire<>(GT5RRef.ID, Materials.Kanthal, 6, Tier.HV).amps(4)); //H); - public static final Wire WIRE_GOLD = AntimatterAPI.register(Wire.class, new Wire<>(GT5RRef.ID, AntimatterMaterials.Gold, 4, Tier.HV).amps(3)); + public static final Wire WIRE_GOLD = AntimatterAPI.register(Wire.class, new Wire<>(GT5RRef.ID, Gold, 4, Tier.HV).amps(3)); public static final Wire WIRE_ELECTRUM = AntimatterAPI.register(Wire.class, new Wire<>(GT5RRef.ID, Materials.Electrum, 4, Tier.HV).amps(2)); - public static final Wire WIRE_SILVER = AntimatterAPI.register(Wire.class, new Wire<>(GT5RRef.ID, Materials.Silver, 2, Tier.HV).amps(1)); + public static final Wire WIRE_SILVER = AntimatterAPI.register(Wire.class, new Wire<>(GT5RRef.ID, Silver, 2, Tier.HV).amps(1)); public static final Wire WIRE_NICHROME = AntimatterAPI.register(Wire.class, new Wire<>(GT5RRef.ID, Materials.Nichrome, 8, Tier.EV).amps(3)); //E); public static final Wire WIRE_STEEL = AntimatterAPI.register(Wire.class, new Wire<>(GT5RRef.ID, Materials.Steel, 4, Tier.EV).amps(2)); public static final Wire WIRE_TITANIUM = AntimatterAPI.register(Wire.class, new Wire<>(GT5RRef.ID, Materials.Titanium, 4, Tier.EV).amps(4)); @@ -259,7 +262,7 @@ public Texture[] getTextures() { // it's not in gt6, not sure whether to keep it or not //public static final FluidPipe FLUID_PIPE_BISMUTH_BRONZE = AntimatterAPI.register(FluidPipe.class, new FluidPipe<>(GT5RRef.ID, BismuthBronze, 950, true).caps(1).pressures(800)); //public static final FluidPipe FLUID_PIPE_BLACK_STEEL = AntimatterAPI.register(FluidPipe.class, new FluidPipe<>(GT5RRef.ID, BlackSteel, 1200, true).caps(1).pressures(900)); - public static final FluidPipe FLUID_PIPE_GOLD = AntimatterAPI.register(FluidPipe.class, new FluidPipe<>(GT5RRef.ID, AntimatterMaterials.Gold, 1671, true).acidProof(true).pressures(getPressures(300))); + public static final FluidPipe FLUID_PIPE_GOLD = AntimatterAPI.register(FluidPipe.class, new FluidPipe<>(GT5RRef.ID, Gold, 1671, true).acidProof(true).pressures(getPressures(300))); public static final FluidPipe FLUID_PIPE_INVAR = AntimatterAPI.register(FluidPipe.class,new FluidPipe<>(GT5RRef.ID, Materials.Invar, 2395, true).caps(1).pressures(getPressures(600)).heatProof(true)); public static final FluidPipe FLUID_PIPE_STEEL = AntimatterAPI.register(FluidPipe.class,new FluidPipe<>(GT5RRef.ID, Materials.Steel, 2557, true).caps(1).pressures(getPressures(600))); public static final FluidPipe FLUID_PIPE_CHROMIUM = AntimatterAPI.register(FluidPipe.class, new FluidPipe<>(GT5RRef.ID, Materials.Chromium, 2725, true).acidProof(true).pressures(getPressures(600))); diff --git a/common/src/main/java/org/gtreimagined/gt5r/datagen/GT5RLocalizations.java b/common/src/main/java/org/gtreimagined/gt5r/datagen/GT5RLocalizations.java index 72ce3eb92..8c7867afd 100644 --- a/common/src/main/java/org/gtreimagined/gt5r/datagen/GT5RLocalizations.java +++ b/common/src/main/java/org/gtreimagined/gt5r/datagen/GT5RLocalizations.java @@ -5,12 +5,14 @@ import muramasa.antimatter.Ref; import muramasa.antimatter.datagen.providers.AntimatterLanguageProvider; import muramasa.antimatter.item.ItemBasic; +import muramasa.antimatter.material.Material; import muramasa.antimatter.util.Utils; import org.gtreimagined.gt5r.GT5RRef; import org.gtreimagined.gt5r.block.*; import org.gtreimagined.gt5r.data.GT5RBlocks; import org.gtreimagined.gt5r.data.GT5RCovers; import org.gtreimagined.gt5r.data.GT5RItems; +import org.gtreimagined.gt5r.data.Materials; import org.gtreimagined.gt5r.items.ItemDepletedRod; import org.gtreimagined.gt5r.items.ItemNuclearFuelRod; @@ -377,6 +379,9 @@ protected void english(String domain, String locale) { } else { add(b, lowerUnderscoreToUpperSpaced(b.getId())); } + String material= b.tooltipMaterial != Material.NULL ? b.tooltipMaterial == Materials.Uranium ? "Uranium" : b.tooltipMaterial.getDisplayNameString() : "Ore"; + String n = material.startsWith("A") || material.startsWith("E") || material.startsWith("I") || material.startsWith("O") || material.startsWith("U") ? "n" : ""; + add("tooltip." + b.getDomain() + "." + b.getId().replace("/", "."), "Indicates presence of a" + n + " " + material + " Deposit nearby"); }); add(GT5RBlocks.MINING_PIPE, "Mining Pipe"); diff --git a/common/src/main/java/org/gtreimagined/gt5r/loader/crafting/VanillaExtensions.java b/common/src/main/java/org/gtreimagined/gt5r/loader/crafting/VanillaExtensions.java index bb146743d..0bd0a1cde 100644 --- a/common/src/main/java/org/gtreimagined/gt5r/loader/crafting/VanillaExtensions.java +++ b/common/src/main/java/org/gtreimagined/gt5r/loader/crafting/VanillaExtensions.java @@ -14,6 +14,7 @@ import net.minecraft.world.item.Items; import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.level.block.Blocks; +import org.gtreimagined.gt5r.data.GT5RBlocks; import org.gtreimagined.gtcore.GTCoreConfig; import java.util.function.Consumer; @@ -76,5 +77,19 @@ public static void loadRecipes(Consumer consumer, AntimatterReci provider.removeRecipe(new ResourceLocation(dye.getName() + "_concrete_powder")); } } + provider.shapeless(consumer, GT5RRef.ID, "yellow_dye_from_bedrock_flower", "dyes", Items.YELLOW_DYE.getDefaultInstance(), GT5RBlocks.DESERT_TRUMPET); + provider.shapeless(consumer, GT5RRef.ID, "pink_dye_from_bedrock_flower", "dyes", Items.PINK_DYE.getDefaultInstance(), GT5RBlocks.BECIUM_HOMBLEI); + provider.shapeless(consumer, GT5RRef.ID, "yellow_dye_from_bedrock_flower_2", "dyes", Items.YELLOW_DYE.getDefaultInstance(), GT5RBlocks.PRINCES_PLUME); + provider.shapeless(consumer, GT5RRef.ID, "purple_dye_from_bedrock_flower", "dyes", Items.PURPLE_DYE.getDefaultInstance(), GT5RBlocks.THOMPSONS_LOCOWEED); + provider.shapeless(consumer, GT5RRef.ID, "green_dye_from_bedrock_flower", "dyes", Items.GREEN_DYE.getDefaultInstance(), GT5RBlocks.TUNGSTUS); //smelt? + provider.shapeless(consumer, GT5RRef.ID, "yellow_dye_from_bedrock_flower_3", "dyes", Items.YELLOW_DYE.getDefaultInstance(), GT5RBlocks.ALTERED_ANDESITE_BUCKWHEAT); + provider.shapeless(consumer, GT5RRef.ID, "yellow_dye_from_bedrock_flower_4", "dyes", Items.YELLOW_DYE.getDefaultInstance(), GT5RBlocks.CROSBY_BUCKWHEAT); + provider.shapeless(consumer, GT5RRef.ID, "magenta_dye_from_bedrock_flower", "dyes", Items.MAGENTA_DYE.getDefaultInstance(), GT5RBlocks.ALPINE_CATCHFLY); + provider.shapeless(consumer, GT5RRef.ID, "yellow_dye_from_bedrock_flower_5", "dyes", Items.YELLOW_DYE.getDefaultInstance(), GT5RBlocks.VIOLA_CALAMINARIA); + provider.shapeless(consumer, GT5RRef.ID, "pink_dye_from_bedrock_flower_2", "dyes", Items.PINK_DYE.getDefaultInstance(), GT5RBlocks.THLASPI_LERESCHIANUM); + provider.shapeless(consumer, GT5RRef.ID, "white_dye_from_bedrock_flower_", "dyes", Items.WHITE_DYE.getDefaultInstance(), GT5RBlocks.TUFTED_EVENING_PRIMROSE); + provider.shapeless(consumer, GT5RRef.ID, "light_blue_dye_from_bedrock_flower", "dyes", Items.LIGHT_BLUE_DYE.getDefaultInstance(), GT5RBlocks.NARCISSUS_SHELDONIA); + provider.shapeless(consumer, GT5RRef.ID, "brown_dye_from_bedrock_flower", "dyes", Items.BROWN_DYE.getDefaultInstance(), GT5RBlocks.ORECHID); + } }