Skip to content

Commit c0182b9

Browse files
committed
迁移部分物品
1 parent 7bad363 commit c0182b9

30 files changed

+297
-271
lines changed

src/main/java/dev/dubhe/anvilcraft/init/ModBlockTags.java

+18-33
Original file line numberDiff line numberDiff line change
@@ -17,47 +17,32 @@ public class ModBlockTags {
1717
public static final TagKey<Block> HAMMER_CHANGEABLE = bind("hammer_changeable");
1818
public static final TagKey<Block> OVERSEER_BASE = bind("overseer_base");
1919
public static final TagKey<Block> BLOCK_DEVOURER_PROBABILITY_DROPPING = bind("block_devourer_probability_dropping");
20-
public static final TagKey<Block> DEEPSLATE_METAL = bindC("deepslate_metal");
2120
public static final TagKey<Block> LASE_CAN_PASS_THROUGH = bind("lase_can_pass_though");
2221
public static final TagKey<Block> END_PORTAL_UNABLE_CHANGE = bind("end_portal_unable_change");
23-
public static final TagKey<Block> GLASS_BLOCKS = bindC("glass_blocks");
22+
23+
public static final TagKey<Block> DEEPSLATE_METAL = bindC("deepslate_metal");
24+
25+
public static final TagKey<Block> GLASS_BLOCKS = bindC("glass");
2426
public static final TagKey<Block> GLASS_PANES = bindC("glass_panes");
2527
public static final TagKey<Block> ORES = bindC("ores");
2628
public static final TagKey<Block> ORES_IN_GROUND_NETHERRACK = bindC("ores_in_ground/netherrack");
2729
public static final TagKey<Block> ORES_IN_GROUND_DEEPSLATE = bindC("ores_in_ground/deepslate");
28-
public static final TagKey<Block> FORGE_GLASS_BLOCKS = bindForge("glass");
29-
public static final TagKey<Block> FORGE_GLASS_PANES = bindForge("glass_panes");
30-
public static final TagKey<Block> FORGE_ORES = bindForge("ores");
31-
public static final TagKey<Block> FORGE_ORES_IN_GROUND_NETHERRACK = bindForge("ores_in_ground/netherrack");
32-
public static final TagKey<Block> FORGE_ORES_IN_GROUND_DEEPSLATE = bindForge("ores_in_ground/deepslate");
33-
34-
// 矿物块tag
35-
public static final TagKey<Block> TUNGSTEN_BLOCKS = bindC("tungsten_blocks");
36-
public static final TagKey<Block> TITANIUM_BLOCKS = bindC("titanium_blocks");
37-
public static final TagKey<Block> ZINC_BLOCKS = bindC("zinc_blocks");
38-
public static final TagKey<Block> TIN_BLOCKS = bindC("tin_blocks");
39-
public static final TagKey<Block> LEAD_BLOCKS = bindC("lead_blocks");
40-
public static final TagKey<Block> SILVER_BLOCKS = bindC("silver_blocks");
41-
public static final TagKey<Block> URANIUM_BLOCKS = bindC("uranium_blocks");
42-
public static final TagKey<Block> BRONZE_BLOCKS = bindC("bronze_blocks");
43-
public static final TagKey<Block> BRASS_BLOCKS = bindC("brass_blocks");
44-
45-
public static final TagKey<Block> FORGE_TUNGSTEN_BLOCKS = bindForge("storage_blocks/tungsten_blocks");
46-
public static final TagKey<Block> FORGE_TITANIUM_BLOCKS = bindForge("storage_blocks/titanium_blocks");
47-
public static final TagKey<Block> FORGE_ZINC_BLOCKS = bindForge("storage_blocks/zinc_blocks");
48-
public static final TagKey<Block> FORGE_TIN_BLOCKS = bindForge("storage_blocks/tin_blocks");
49-
public static final TagKey<Block> FORGE_LEAD_BLOCKS = bindForge("storage_blocks/lead_blocks");
50-
public static final TagKey<Block> FORGE_SILVER_BLOCKS = bindForge("storage_blocks/silver_blocks");
51-
public static final TagKey<Block> FORGE_URANIUM_BLOCKS = bindForge("storage_blocks/uranium_blocks");
52-
public static final TagKey<Block> FORGE_BRONZE_BLOCKS = bindForge("storage_blocks/bronze_blocks");
53-
public static final TagKey<Block> FORGE_BRASS_BLOCKS = bindForge("storage_blocks/brass_blocks");
30+
31+
public static final TagKey<Block> TUNGSTEN_BLOCKS = bindC("storage_blocks/tungsten_blocks");
32+
public static final TagKey<Block> TITANIUM_BLOCKS = bindC("storage_blocks/titanium_blocks");
33+
public static final TagKey<Block> ZINC_BLOCKS = bindC("storage_blocks/zinc_blocks");
34+
public static final TagKey<Block> TIN_BLOCKS = bindC("storage_blocks/tin_blocks");
35+
public static final TagKey<Block> LEAD_BLOCKS = bindC("storage_blocks/lead_blocks");
36+
public static final TagKey<Block> SILVER_BLOCKS = bindC("storage_blocks/silver_blocks");
37+
public static final TagKey<Block> URANIUM_BLOCKS = bindC("storage_blocks/uranium_blocks");
38+
public static final TagKey<Block> BRONZE_BLOCKS = bindC("storage_blocks/bronze_blocks");
39+
public static final TagKey<Block> BRASS_BLOCKS = bindC("storage_blocks/brass_blocks");
40+
41+
public static final TagKey<Block> INCORRECT_FOR_AMYTHEST_TOOL = bind("incorrect_for_amythest_tool");
42+
public static final TagKey<Block> INCORRECT_FOR_EMBER_TOOL = bind("incorrect_for_amythest_tool");
5443

5544
private static @NotNull TagKey<Block> bindC(String id) {
56-
return TagKey.create(Registries.BLOCK, new ResourceLocation("c", id));
57-
}
58-
59-
private static @NotNull TagKey<Block> bindForge(String id) {
60-
return TagKey.create(Registries.BLOCK, new ResourceLocation("forge", id));
45+
return TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath("c", id));
6146
}
6247

6348
private static @NotNull TagKey<Block> bind(String id) {

src/main/java/dev/dubhe/anvilcraft/init/ModEnchantments.java

+1-14
Original file line numberDiff line numberDiff line change
@@ -34,26 +34,13 @@ public class ModEnchantments {
3434
(Registry<Enchantment>) BuiltInRegistries.REGISTRY.get(Registries.ENCHANTMENT.location());
3535
return enchantmentRegistry.getHolderOrThrow(HARVEST_KEY).getDelegate();
3636
});
37-
;
37+
3838
public static final Lazy<Holder<Enchantment>> BEHEADING = new Lazy<>(() -> {
3939
Registry<Enchantment> enchantmentRegistry =
4040
(Registry<Enchantment>) BuiltInRegistries.REGISTRY.get(Registries.ENCHANTMENT.location());
4141
return enchantmentRegistry.getHolderOrThrow(BEHEADING_KEY).getDelegate();
4242
});
43-
;
4443

45-
// public static final RegistryEntry<FellingEnchantment> FELLING = REGISTRATE
46-
// .enchantment("felling", EnchantmentCategory.DIGGER, FellingEnchantment::new)
47-
// .rarity(Enchantment.Rarity.RARE)
48-
// .register();
49-
// public static final RegistryEntry<HarvestEnchantment> HARVEST = REGISTRATE
50-
// .enchantment("harvest", EnchantmentCategory.DIGGER, HarvestEnchantment::new)
51-
// .rarity(Enchantment.Rarity.RARE)
52-
// .register();
53-
// public static final RegistryEntry<BeheadingEnchantment> BEHEADING = REGISTRATE
54-
// .enchantment("beheading", EnchantmentCategory.WEAPON, BeheadingEnchantment::new)
55-
// .rarity(Enchantment.Rarity.RARE)
56-
// .register();
5744

5845
public static ResourceKey<Enchantment> key(String name) {
5946
return ResourceKey.create(Registries.ENCHANTMENT, AnvilCraft.of(name));

src/main/java/dev/dubhe/anvilcraft/init/ModItems.java

-9
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import dev.dubhe.anvilcraft.item.EmberMetalUpgradeTemplateItem;
2828
import dev.dubhe.anvilcraft.item.EmptyCapacitorItem;
2929
import dev.dubhe.anvilcraft.item.GeodeItem;
30-
import dev.dubhe.anvilcraft.item.GuideBookItem;
3130
import dev.dubhe.anvilcraft.item.LevitationPowderItem;
3231
import dev.dubhe.anvilcraft.item.MagnetItem;
3332
import dev.dubhe.anvilcraft.item.ModFoods;
@@ -934,14 +933,6 @@ public class ModItems {
934933
.save(provider))
935934
.register();
936935

937-
public static final ItemEntry<GuideBookItem> GUIDE_BOOK = REGISTRATE
938-
.item("guide_book", GuideBookItem::new)
939-
.properties(p -> p.stacksTo(1))
940-
.model((ctx, provider) -> {
941-
})
942-
.lang("AnvilCraft Guide Book")
943-
.register();
944-
945936
public static final ItemEntry<Item> LIME_POWDER = REGISTRATE
946937
.item("lime_powder", Item::new)
947938
.register();

src/main/java/dev/dubhe/anvilcraft/item/AmethystAxeItem.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88

99
public class AmethystAxeItem extends AxeItem {
1010
public AmethystAxeItem(Properties properties) {
11-
super(ModTiers.AMETHYST, 7, -3.2f, properties);
11+
super(ModTiers.AMETHYST, properties.attributes(AxeItem.createAttributes(
12+
ModTiers.AMETHYST,7, -3.2f
13+
)));
1214
}
1315

1416
@Override
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
package dev.dubhe.anvilcraft.item;
22

33
import dev.dubhe.anvilcraft.init.ModEnchantments;
4+
import net.minecraft.world.item.AxeItem;
45
import net.minecraft.world.item.HoeItem;
56
import net.minecraft.world.item.ItemStack;
67
import org.jetbrains.annotations.NotNull;
78

89
public class AmethystHoeItem extends HoeItem {
910
public AmethystHoeItem(Properties properties) {
10-
super(ModTiers.AMETHYST, -1, -2.0f, properties);
11+
super(ModTiers.AMETHYST, properties.attributes(AxeItem.createAttributes(
12+
ModTiers.AMETHYST, -1, -2.0f
13+
)));
1114
}
1215

1316
@Override
1417
public @NotNull ItemStack getDefaultInstance() {
1518
ItemStack stack = super.getDefaultInstance();
16-
stack.enchant(ModEnchantments.HARVEST, 1);
19+
stack.enchant(ModEnchantments.HARVEST.get(), 1);
1720
return stack;
1821
}
1922
}
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,48 @@
11
package dev.dubhe.anvilcraft.item;
22

33
import net.minecraft.ChatFormatting;
4+
import net.minecraft.MethodsReturnNonnullByDefault;
45
import net.minecraft.network.chat.Component;
6+
import net.minecraft.world.item.AxeItem;
57
import net.minecraft.world.item.ItemStack;
68
import net.minecraft.world.item.PickaxeItem;
9+
import net.minecraft.world.item.Tiers;
710
import net.minecraft.world.item.TooltipFlag;
811
import net.minecraft.world.item.enchantment.Enchantments;
912
import net.minecraft.world.level.Level;
1013
import org.jetbrains.annotations.NotNull;
1114
import org.jetbrains.annotations.Nullable;
1215

16+
import javax.annotation.ParametersAreNonnullByDefault;
1317
import java.util.List;
1418

19+
@ParametersAreNonnullByDefault
20+
@MethodsReturnNonnullByDefault
1521
public class AmethystPickaxeItem extends PickaxeItem {
1622
public AmethystPickaxeItem(Properties properties) {
17-
super(ModTiers.AMETHYST, 1, -2.8f, properties);
23+
super(ModTiers.AMETHYST, properties.attributes(AxeItem.createAttributes(
24+
ModTiers.AMETHYST, 1, -2.8f
25+
)));
1826
}
1927

2028
@Override
2129
public void appendHoverText(
22-
@NotNull ItemStack stack,
23-
@Nullable Level level,
24-
@NotNull List<Component> tooltipComponents,
25-
@NotNull TooltipFlag isAdvanced
30+
ItemStack pStack,
31+
TooltipContext pContext,
32+
List<Component> pTooltipComponents,
33+
TooltipFlag pTooltipFlag
2634
) {
27-
super.appendHoverText(stack, level, tooltipComponents, isAdvanced);
28-
tooltipComponents
35+
super.appendHoverText(pStack, pContext, pTooltipComponents, pTooltipFlag);
36+
pTooltipComponents
2937
.add(Component.translatable("item.anvilcraft.amethyst_pickaxe.tooltip")
3038
.withStyle(ChatFormatting.GRAY));
3139
}
3240

41+
3342
@Override
3443
public @NotNull ItemStack getDefaultInstance() {
3544
ItemStack stack = super.getDefaultInstance();
36-
stack.enchant(Enchantments.BLOCK_FORTUNE, 3);
45+
stack.enchant(Enchantments.FORTUNE, 3);
3746
return stack;
3847
}
3948
}

src/main/java/dev/dubhe/anvilcraft/item/AmethystShovelItem.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
package dev.dubhe.anvilcraft.item;
22

3+
import net.minecraft.world.item.AxeItem;
34
import net.minecraft.world.item.ItemStack;
45
import net.minecraft.world.item.ShovelItem;
6+
import net.minecraft.world.item.Tiers;
57
import net.minecraft.world.item.enchantment.Enchantments;
68
import org.jetbrains.annotations.NotNull;
79

810
public class AmethystShovelItem extends ShovelItem {
911
public AmethystShovelItem(Properties properties) {
10-
super(ModTiers.AMETHYST, 1.5f, -3.0f, properties);
12+
super(ModTiers.AMETHYST, properties.attributes(AxeItem.createAttributes(
13+
ModTiers.AMETHYST, 1.5f, -3.0f
14+
)));
1115
}
1216

1317
@Override

src/main/java/dev/dubhe/anvilcraft/item/AmethystSwordItem.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
package dev.dubhe.anvilcraft.item;
22

33
import dev.dubhe.anvilcraft.init.ModEnchantments;
4+
import net.minecraft.world.item.AxeItem;
45
import net.minecraft.world.item.ItemStack;
56
import net.minecraft.world.item.SwordItem;
7+
import net.minecraft.world.item.Tiers;
68
import org.jetbrains.annotations.NotNull;
79

810
public class AmethystSwordItem extends SwordItem {
911
public AmethystSwordItem(Properties properties) {
10-
super(ModTiers.AMETHYST, 3, -2.4f, properties);
12+
super(ModTiers.AMETHYST, properties.attributes(AxeItem.createAttributes(
13+
ModTiers.AMETHYST, 3, -2.4f
14+
)));
1115
}
1216

1317
@Override

0 commit comments

Comments
 (0)