Skip to content

Commit 292d6db

Browse files
committed
Ensure Palladium Rails are fireproof
1 parent 80f3f95 commit 292d6db

File tree

3 files changed

+17
-20
lines changed

3 files changed

+17
-20
lines changed

PATCHNOTES.md

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ Most of these are made by thyreo. Thanks again for awesome new textures!
6464
- This cool ride made out of five Palladium Ingots will keep you fireproof while riding in it
6565
- Functions via the "mythicmetals:grants_fire_resistance_while_riding" entity type tag
6666
- Added Palladium Rails
67+
- These are Fireproof Rails which are crafted from Palladium
6768
- Work as Powered Rails when lavalogged
6869

6970
## Bug Fixes

src/main/java/nourl/mythicmetals/blocks/MythicBlocks.java

+15-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package nourl.mythicmetals.blocks;
22

3-
import java.util.HashMap;
4-
import java.util.Map;
3+
import java.util.*;
54
import net.minecraft.block.*;
65
import net.minecraft.item.*;
6+
import net.minecraft.item.tooltip.TooltipType;
77
import net.minecraft.registry.tag.BlockTags;
88
import net.minecraft.sound.BlockSoundGroup;
99
import net.minecraft.text.Text;
@@ -94,9 +94,9 @@ public class MythicBlocks {
9494
.strength(3.0F)
9595
.createStorageBlock(IRON_MINING_LEVEL)
9696
.sounds(RegisterSounds.MORKITE_ORE)
97-
.createOre(IRON_MINING_LEVEL, UniformIntProvider.create(0, 2))
97+
.createOre(IRON_MINING_LEVEL, UniformIntProvider.create(1, 2))
9898
.sounds(RegisterSounds.DEEPSLATE_MORKITE_ORE)
99-
.createOreVariant("deepslate", IRON_MINING_LEVEL, UniformIntProvider.create(0, 2))
99+
.createOreVariant("deepslate", IRON_MINING_LEVEL, UniformIntProvider.create(1, 3))
100100
.finish();
101101

102102
public static final BlockSet MIDAS_GOLD = BlockSet.Builder.begin("midas_gold", false)
@@ -152,6 +152,14 @@ public boolean hasGlint(ItemStack stack) {
152152
.sounds(BlockSoundGroup.METAL)
153153
);
154154

155+
public static final Item PALLADIUM_RAIL_ITEM = new BlockItem(PALLADIUM_RAIL, new Item.Settings().group(MythicMetals.TABBED_GROUP).tab(1).fireproof()) {
156+
@Override
157+
public void appendTooltip(ItemStack stack, TooltipContext context, List<Text> tooltip, TooltipType type) {
158+
super.appendTooltip(stack, context, tooltip, type);
159+
tooltip.add(Text.translatable("tooltip.palladium_rail.info"));
160+
}
161+
};
162+
155163
public static final BlockSet PLATINUM = BlockSet.Builder.begin("platinum", false)
156164
.createDefaultSet(3.5F, IRON_MINING_LEVEL, IRON_MINING_LEVEL).finish();
157165

@@ -224,7 +232,9 @@ public static void init() {
224232
// Manually registering these in order to get the glint
225233
RegistryHelper.blockOnly("enchanted_midas_gold_block", ENCHANTED_MIDAS_GOLD_BLOCK);
226234
RegistryHelper.item("enchanted_midas_gold_block", ENCHANTED_MIDAS_GOLD_BLOCK_ITEM);
227-
RegistryHelper.blockWithTooltip("palladium_rail", PALLADIUM_RAIL, Text.translatable("tooltip.palladium_rail.info"));
235+
// Manually registering to get a tooltip and fireproofing
236+
RegistryHelper.blockOnly("palladium_rail", PALLADIUM_RAIL);
237+
RegistryHelper.item("palladium_rail", PALLADIUM_RAIL_ITEM);
228238
RegistryHelper.block("quadrillum_nuke_core", QUADRILLUM_NUKE_CORE);
229239
RegistryHelper.block("sponge_nuke_core", SPONGE_NUKE_CORE);
230240
}

src/main/java/nourl/mythicmetals/misc/RegistryHelper.java

+1-15
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package nourl.mythicmetals.misc;
22

3+
import java.util.function.UnaryOperator;
34
import com.mojang.serialization.MapCodec;
45
import io.wispforest.owo.itemgroup.OwoItemGroup;
56
import net.minecraft.block.Block;
@@ -9,19 +10,15 @@
910
import net.minecraft.entity.attribute.EntityAttribute;
1011
import net.minecraft.entity.effect.StatusEffect;
1112
import net.minecraft.item.*;
12-
import net.minecraft.item.tooltip.TooltipType;
1313
import net.minecraft.loot.condition.LootCondition;
1414
import net.minecraft.loot.condition.LootConditionType;
1515
import net.minecraft.potion.Potion;
1616
import net.minecraft.registry.*;
1717
import net.minecraft.registry.entry.RegistryEntry;
18-
import net.minecraft.text.Text;
1918
import net.minecraft.util.Identifier;
2019
import net.minecraft.util.Rarity;
2120
import net.minecraft.world.gen.feature.ConfiguredFeature;
2221
import nourl.mythicmetals.MythicMetals;
23-
import java.util.List;
24-
import java.util.function.UnaryOperator;
2522

2623
/**
2724
* A helper class containing methods for registering various blocks and items.
@@ -79,17 +76,6 @@ public static void blockOnly(String path, Block block) {
7976
Registry.register(Registries.BLOCK, id(path), block);
8077
}
8178

82-
public static void blockWithTooltip(String path, Block block, Text translatableText) {
83-
Registry.register(Registries.BLOCK, id(path), block);
84-
Registry.register(Registries.ITEM, id(path), new BlockItem(block, new Item.Settings().group(MythicMetals.TABBED_GROUP).tab(1)) {
85-
@Override
86-
public void appendTooltip(ItemStack stack, TooltipContext context, List<Text> tooltip, TooltipType type) {
87-
super.appendTooltip(stack, context, tooltip, type);
88-
tooltip.add(translatableText);
89-
}
90-
});
91-
}
92-
9379
public static void entityType(String path, EntityType<?> type) {
9480
Registry.register(Registries.ENTITY_TYPE, RegistryHelper.id(path), type);
9581
}

0 commit comments

Comments
 (0)