Skip to content

Commit

Permalink
迁移部分物品
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhuRuoLing committed Sep 8, 2024
1 parent 7bad363 commit c0182b9
Show file tree
Hide file tree
Showing 30 changed files with 297 additions and 271 deletions.
51 changes: 18 additions & 33 deletions src/main/java/dev/dubhe/anvilcraft/init/ModBlockTags.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,47 +17,32 @@ public class ModBlockTags {
public static final TagKey<Block> HAMMER_CHANGEABLE = bind("hammer_changeable");
public static final TagKey<Block> OVERSEER_BASE = bind("overseer_base");
public static final TagKey<Block> BLOCK_DEVOURER_PROBABILITY_DROPPING = bind("block_devourer_probability_dropping");
public static final TagKey<Block> DEEPSLATE_METAL = bindC("deepslate_metal");
public static final TagKey<Block> LASE_CAN_PASS_THROUGH = bind("lase_can_pass_though");
public static final TagKey<Block> END_PORTAL_UNABLE_CHANGE = bind("end_portal_unable_change");
public static final TagKey<Block> GLASS_BLOCKS = bindC("glass_blocks");

public static final TagKey<Block> DEEPSLATE_METAL = bindC("deepslate_metal");

public static final TagKey<Block> GLASS_BLOCKS = bindC("glass");
public static final TagKey<Block> GLASS_PANES = bindC("glass_panes");
public static final TagKey<Block> ORES = bindC("ores");
public static final TagKey<Block> ORES_IN_GROUND_NETHERRACK = bindC("ores_in_ground/netherrack");
public static final TagKey<Block> ORES_IN_GROUND_DEEPSLATE = bindC("ores_in_ground/deepslate");
public static final TagKey<Block> FORGE_GLASS_BLOCKS = bindForge("glass");
public static final TagKey<Block> FORGE_GLASS_PANES = bindForge("glass_panes");
public static final TagKey<Block> FORGE_ORES = bindForge("ores");
public static final TagKey<Block> FORGE_ORES_IN_GROUND_NETHERRACK = bindForge("ores_in_ground/netherrack");
public static final TagKey<Block> FORGE_ORES_IN_GROUND_DEEPSLATE = bindForge("ores_in_ground/deepslate");

// 矿物块tag
public static final TagKey<Block> TUNGSTEN_BLOCKS = bindC("tungsten_blocks");
public static final TagKey<Block> TITANIUM_BLOCKS = bindC("titanium_blocks");
public static final TagKey<Block> ZINC_BLOCKS = bindC("zinc_blocks");
public static final TagKey<Block> TIN_BLOCKS = bindC("tin_blocks");
public static final TagKey<Block> LEAD_BLOCKS = bindC("lead_blocks");
public static final TagKey<Block> SILVER_BLOCKS = bindC("silver_blocks");
public static final TagKey<Block> URANIUM_BLOCKS = bindC("uranium_blocks");
public static final TagKey<Block> BRONZE_BLOCKS = bindC("bronze_blocks");
public static final TagKey<Block> BRASS_BLOCKS = bindC("brass_blocks");

public static final TagKey<Block> FORGE_TUNGSTEN_BLOCKS = bindForge("storage_blocks/tungsten_blocks");
public static final TagKey<Block> FORGE_TITANIUM_BLOCKS = bindForge("storage_blocks/titanium_blocks");
public static final TagKey<Block> FORGE_ZINC_BLOCKS = bindForge("storage_blocks/zinc_blocks");
public static final TagKey<Block> FORGE_TIN_BLOCKS = bindForge("storage_blocks/tin_blocks");
public static final TagKey<Block> FORGE_LEAD_BLOCKS = bindForge("storage_blocks/lead_blocks");
public static final TagKey<Block> FORGE_SILVER_BLOCKS = bindForge("storage_blocks/silver_blocks");
public static final TagKey<Block> FORGE_URANIUM_BLOCKS = bindForge("storage_blocks/uranium_blocks");
public static final TagKey<Block> FORGE_BRONZE_BLOCKS = bindForge("storage_blocks/bronze_blocks");
public static final TagKey<Block> FORGE_BRASS_BLOCKS = bindForge("storage_blocks/brass_blocks");

public static final TagKey<Block> TUNGSTEN_BLOCKS = bindC("storage_blocks/tungsten_blocks");
public static final TagKey<Block> TITANIUM_BLOCKS = bindC("storage_blocks/titanium_blocks");
public static final TagKey<Block> ZINC_BLOCKS = bindC("storage_blocks/zinc_blocks");
public static final TagKey<Block> TIN_BLOCKS = bindC("storage_blocks/tin_blocks");
public static final TagKey<Block> LEAD_BLOCKS = bindC("storage_blocks/lead_blocks");
public static final TagKey<Block> SILVER_BLOCKS = bindC("storage_blocks/silver_blocks");
public static final TagKey<Block> URANIUM_BLOCKS = bindC("storage_blocks/uranium_blocks");
public static final TagKey<Block> BRONZE_BLOCKS = bindC("storage_blocks/bronze_blocks");
public static final TagKey<Block> BRASS_BLOCKS = bindC("storage_blocks/brass_blocks");

public static final TagKey<Block> INCORRECT_FOR_AMYTHEST_TOOL = bind("incorrect_for_amythest_tool");
public static final TagKey<Block> INCORRECT_FOR_EMBER_TOOL = bind("incorrect_for_amythest_tool");

private static @NotNull TagKey<Block> bindC(String id) {
return TagKey.create(Registries.BLOCK, new ResourceLocation("c", id));
}

private static @NotNull TagKey<Block> bindForge(String id) {
return TagKey.create(Registries.BLOCK, new ResourceLocation("forge", id));
return TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath("c", id));
}

private static @NotNull TagKey<Block> bind(String id) {
Expand Down
15 changes: 1 addition & 14 deletions src/main/java/dev/dubhe/anvilcraft/init/ModEnchantments.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,13 @@ public class ModEnchantments {
(Registry<Enchantment>) BuiltInRegistries.REGISTRY.get(Registries.ENCHANTMENT.location());
return enchantmentRegistry.getHolderOrThrow(HARVEST_KEY).getDelegate();
});
;

public static final Lazy<Holder<Enchantment>> BEHEADING = new Lazy<>(() -> {
Registry<Enchantment> enchantmentRegistry =
(Registry<Enchantment>) BuiltInRegistries.REGISTRY.get(Registries.ENCHANTMENT.location());
return enchantmentRegistry.getHolderOrThrow(BEHEADING_KEY).getDelegate();
});
;

// public static final RegistryEntry<FellingEnchantment> FELLING = REGISTRATE
// .enchantment("felling", EnchantmentCategory.DIGGER, FellingEnchantment::new)
// .rarity(Enchantment.Rarity.RARE)
// .register();
// public static final RegistryEntry<HarvestEnchantment> HARVEST = REGISTRATE
// .enchantment("harvest", EnchantmentCategory.DIGGER, HarvestEnchantment::new)
// .rarity(Enchantment.Rarity.RARE)
// .register();
// public static final RegistryEntry<BeheadingEnchantment> BEHEADING = REGISTRATE
// .enchantment("beheading", EnchantmentCategory.WEAPON, BeheadingEnchantment::new)
// .rarity(Enchantment.Rarity.RARE)
// .register();

public static ResourceKey<Enchantment> key(String name) {
return ResourceKey.create(Registries.ENCHANTMENT, AnvilCraft.of(name));
Expand Down
9 changes: 0 additions & 9 deletions src/main/java/dev/dubhe/anvilcraft/init/ModItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import dev.dubhe.anvilcraft.item.EmberMetalUpgradeTemplateItem;
import dev.dubhe.anvilcraft.item.EmptyCapacitorItem;
import dev.dubhe.anvilcraft.item.GeodeItem;
import dev.dubhe.anvilcraft.item.GuideBookItem;
import dev.dubhe.anvilcraft.item.LevitationPowderItem;
import dev.dubhe.anvilcraft.item.MagnetItem;
import dev.dubhe.anvilcraft.item.ModFoods;
Expand Down Expand Up @@ -934,14 +933,6 @@ public class ModItems {
.save(provider))
.register();

public static final ItemEntry<GuideBookItem> GUIDE_BOOK = REGISTRATE
.item("guide_book", GuideBookItem::new)
.properties(p -> p.stacksTo(1))
.model((ctx, provider) -> {
})
.lang("AnvilCraft Guide Book")
.register();

public static final ItemEntry<Item> LIME_POWDER = REGISTRATE
.item("lime_powder", Item::new)
.register();
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/dev/dubhe/anvilcraft/item/AmethystAxeItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

public class AmethystAxeItem extends AxeItem {
public AmethystAxeItem(Properties properties) {
super(ModTiers.AMETHYST, 7, -3.2f, properties);
super(ModTiers.AMETHYST, properties.attributes(AxeItem.createAttributes(
ModTiers.AMETHYST,7, -3.2f
)));
}

@Override
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/dev/dubhe/anvilcraft/item/AmethystHoeItem.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
package dev.dubhe.anvilcraft.item;

import dev.dubhe.anvilcraft.init.ModEnchantments;
import net.minecraft.world.item.AxeItem;
import net.minecraft.world.item.HoeItem;
import net.minecraft.world.item.ItemStack;
import org.jetbrains.annotations.NotNull;

public class AmethystHoeItem extends HoeItem {
public AmethystHoeItem(Properties properties) {
super(ModTiers.AMETHYST, -1, -2.0f, properties);
super(ModTiers.AMETHYST, properties.attributes(AxeItem.createAttributes(
ModTiers.AMETHYST, -1, -2.0f
)));
}

@Override
public @NotNull ItemStack getDefaultInstance() {
ItemStack stack = super.getDefaultInstance();
stack.enchant(ModEnchantments.HARVEST, 1);
stack.enchant(ModEnchantments.HARVEST.get(), 1);
return stack;
}
}
25 changes: 17 additions & 8 deletions src/main/java/dev/dubhe/anvilcraft/item/AmethystPickaxeItem.java
Original file line number Diff line number Diff line change
@@ -1,39 +1,48 @@
package dev.dubhe.anvilcraft.item;

import net.minecraft.ChatFormatting;
import net.minecraft.MethodsReturnNonnullByDefault;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.AxeItem;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.PickaxeItem;
import net.minecraft.world.item.Tiers;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.level.Level;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import javax.annotation.ParametersAreNonnullByDefault;
import java.util.List;

@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
public class AmethystPickaxeItem extends PickaxeItem {
public AmethystPickaxeItem(Properties properties) {
super(ModTiers.AMETHYST, 1, -2.8f, properties);
super(ModTiers.AMETHYST, properties.attributes(AxeItem.createAttributes(
ModTiers.AMETHYST, 1, -2.8f
)));
}

@Override
public void appendHoverText(
@NotNull ItemStack stack,
@Nullable Level level,
@NotNull List<Component> tooltipComponents,
@NotNull TooltipFlag isAdvanced
ItemStack pStack,
TooltipContext pContext,
List<Component> pTooltipComponents,
TooltipFlag pTooltipFlag
) {
super.appendHoverText(stack, level, tooltipComponents, isAdvanced);
tooltipComponents
super.appendHoverText(pStack, pContext, pTooltipComponents, pTooltipFlag);
pTooltipComponents
.add(Component.translatable("item.anvilcraft.amethyst_pickaxe.tooltip")
.withStyle(ChatFormatting.GRAY));
}


@Override
public @NotNull ItemStack getDefaultInstance() {
ItemStack stack = super.getDefaultInstance();
stack.enchant(Enchantments.BLOCK_FORTUNE, 3);
stack.enchant(Enchantments.FORTUNE, 3);
return stack;
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
package dev.dubhe.anvilcraft.item;

import net.minecraft.world.item.AxeItem;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.ShovelItem;
import net.minecraft.world.item.Tiers;
import net.minecraft.world.item.enchantment.Enchantments;
import org.jetbrains.annotations.NotNull;

public class AmethystShovelItem extends ShovelItem {
public AmethystShovelItem(Properties properties) {
super(ModTiers.AMETHYST, 1.5f, -3.0f, properties);
super(ModTiers.AMETHYST, properties.attributes(AxeItem.createAttributes(
ModTiers.AMETHYST, 1.5f, -3.0f
)));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
package dev.dubhe.anvilcraft.item;

import dev.dubhe.anvilcraft.init.ModEnchantments;
import net.minecraft.world.item.AxeItem;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.SwordItem;
import net.minecraft.world.item.Tiers;
import org.jetbrains.annotations.NotNull;

public class AmethystSwordItem extends SwordItem {
public AmethystSwordItem(Properties properties) {
super(ModTiers.AMETHYST, 3, -2.4f, properties);
super(ModTiers.AMETHYST, properties.attributes(AxeItem.createAttributes(
ModTiers.AMETHYST, 3, -2.4f
)));
}

@Override
Expand Down
Loading

0 comments on commit c0182b9

Please sign in to comment.