Skip to content

Commit

Permalink
Merge branch 'Anvil-Dev:releases/1.20.1' into releases/1.20.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhuRuoLing authored Apr 28, 2024
2 parents 4260042 + 34bdadc commit d707336
Show file tree
Hide file tree
Showing 72 changed files with 1,947 additions and 203 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package dev.dubhe.anvilcraft.block;

import net.minecraft.core.BlockPos;
import net.minecraft.core.cauldron.CauldronInteraction;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.AbstractCauldronBlock;
import net.minecraft.world.level.block.state.BlockState;

public class MeltGemCauldron extends AbstractCauldronBlock {

public MeltGemCauldron(Properties properties) {
super(properties, CauldronInteraction.EMPTY);
}

@Override
protected double getContentHeight(BlockState state) {
return 0.9375;
}

@Override
public boolean isFull(BlockState state) {
return true;
}

@Override
public int getAnalogOutputSignal(BlockState state, Level level, BlockPos pos) {
return 3;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package dev.dubhe.anvilcraft.data.generator.recipe;

import com.tterrag.registrate.providers.RegistrateRecipeProvider;
import dev.dubhe.anvilcraft.AnvilCraft;
import dev.dubhe.anvilcraft.data.generator.AnvilCraftDatagen;
import dev.dubhe.anvilcraft.data.recipe.anvil.AnvilRecipe;
import dev.dubhe.anvilcraft.init.ModBlocks;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.phys.Vec3;

import java.util.Map;

import static dev.dubhe.anvilcraft.api.power.IPowerComponent.OVERLOAD;

public class HeaterRecipesLoader {
/**
* 初始化加热器配方
*
* @param provider 提供器
*/
public static void init(RegistrateRecipeProvider provider) {
AnvilRecipe.Builder.create(RecipeCategory.MISC)
.icon(Items.EMERALD_BLOCK)
.hasBlock(ModBlocks.HEATER.get(), new Vec3(0, -2, 0), Map.entry(OVERLOAD, false))
.hasBlockIngredient(new Vec3(0, -1, 0), Blocks.CAULDRON)
.hasItemIngredient(
new Vec3(0, -1, 0),
Items.EMERALD_BLOCK,
ModBlocks.RUBY_BLOCK,
ModBlocks.TOPAZ_BLOCK,
ModBlocks.SAPPHIRE_BLOCK
)
.setBlock(new Vec3(0, -1, 0), ModBlocks.MELT_GEM_CAULDRON.get())
.unlockedBy(
AnvilCraftDatagen.hasItem(Items.EMERALD_BLOCK), AnvilCraftDatagen.has(Items.EMERALD_BLOCK)
)
.unlockedBy(
AnvilCraftDatagen.hasItem(ModBlocks.RUBY_BLOCK), AnvilCraftDatagen.has(ModBlocks.RUBY_BLOCK)
)
.unlockedBy(
AnvilCraftDatagen.hasItem(ModBlocks.TOPAZ_BLOCK), AnvilCraftDatagen.has(ModBlocks.TOPAZ_BLOCK)
)
.unlockedBy(
AnvilCraftDatagen.hasItem(ModBlocks.SAPPHIRE_BLOCK), AnvilCraftDatagen.has(ModBlocks.SAPPHIRE_BLOCK)
)
.save(provider, AnvilCraft.of("heating/melt_gem_cauldron"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public static void init(RegistrateRecipeProvider provider) {
CompactionRecipesLoader.init(provider);
CompressRecipesLoader.init(provider);
CookingRecipesLoader.init(provider);
HeaterRecipesLoader.init(provider);
ItemInjectRecipesLoader.init(provider);
SmashBlockRecipesLoader.init(provider);
SievingRecipesLoader.init(provider);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ public static void init(RegistrateRecipeProvider provider) {
timeWarp(ModBlocks.CINERITE, Items.TUFF, 1, provider);
timeWarp(ModBlocks.NETHER_DUST, Items.SOUL_SOIL, 1, provider);
timeWarp(ModBlocks.END_DUST, Items.END_STONE, 1, provider);

timeWarpWithMeltGem(Items.EMERALD, Items.EMERALD_BLOCK, provider);
timeWarpWithMeltGem(ModItems.RUBY, ModBlocks.RUBY_BLOCK, provider);
timeWarpWithMeltGem(ModItems.TOPAZ, ModBlocks.TOPAZ_BLOCK, provider);
timeWarpWithMeltGem(ModItems.SAPPHIRE, ModBlocks.SAPPHIRE_BLOCK, provider);
}

/**
Expand Down Expand Up @@ -73,4 +78,23 @@ public static void timeWarpWithWater(ItemLike item, ItemLike item1, RegistrateRe
.unlockedBy(AnvilCraftDatagen.hasItem(item), AnvilCraftDatagen.has(item))
.save(provider, AnvilCraft.of("timewarp/" + BuiltInRegistries.ITEM.getKey(item1.asItem()).getPath()));
}

public static void timeWarpWithMeltGem(ItemLike item, ItemLike item1, RegistrateRecipeProvider provider) {
AnvilRecipe.Builder.create(RecipeCategory.MISC)
.icon(item1)
.hasBlock(
ModBlocks.CORRUPTED_BEACON.get(),
new Vec3(0.0, -2.0, 0.0),
Map.entry(CorruptedBeaconBlock.LIT, true)
)
.hasBlockIngredient(
new Vec3(0, -1, 0),
ModBlocks.MELT_GEM_CAULDRON.get()
)
.hasItemIngredient(new Vec3(0, -1, 0), item)
.spawnItem(new Vec3(0.0, -1.0, 0.0), item1)
.setBlock(new Vec3(0, -1, 0), Blocks.CAULDRON)
.unlockedBy(AnvilCraftDatagen.hasItem(item), AnvilCraftDatagen.has(item))
.save(provider, AnvilCraft.of("timewarp/" + BuiltInRegistries.ITEM.getKey(item1.asItem()).getPath()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import dev.dubhe.anvilcraft.block.entity.CrabTrapBlockEntity;
import dev.dubhe.anvilcraft.block.entity.CreativeGeneratorBlockEntity;
import dev.dubhe.anvilcraft.block.entity.HeaterBlockEntity;
import dev.dubhe.anvilcraft.block.entity.TransmissionPoleBlockEntity;
import dev.dubhe.anvilcraft.block.entity.SimpleChuteBlockEntity;
import dev.dubhe.anvilcraft.block.entity.TransmissionPoleBlockEntity;
import dev.dubhe.anvilcraft.client.renderer.blockentity.CorruptedBeaconRenderer;

import static dev.dubhe.anvilcraft.AnvilCraft.REGISTRATE;
Expand All @@ -33,6 +33,12 @@ public class ModBlockEntities {
.validBlock(ModBlocks.SIMPLE_CHUTE)
.register();

public static final BlockEntityEntry<CrabTrapBlockEntity> CRAB_TRAP = REGISTRATE
.blockEntity("crab_trap", CrabTrapBlockEntity::createBlockEntity)
.onRegister(CrabTrapBlockEntity::onBlockEntityRegister)
.validBlock(ModBlocks.CRAB_TRAP)
.register();

public static final BlockEntityEntry<CorruptedBeaconBlockEntity> CORRUPTED_BEACON = REGISTRATE
.blockEntity("corrupted_beacon", CorruptedBeaconBlockEntity::createBlockEntity)
.validBlock(ModBlocks.CORRUPTED_BEACON)
Expand All @@ -53,13 +59,9 @@ public class ModBlockEntities {
.blockEntity("transmission_pole", TransmissionPoleBlockEntity::createBlockEntity)
.validBlock(ModBlocks.TRANSMISSION_POLE)
.register();
public static final BlockEntityEntry<CrabTrapBlockEntity> CRAB_TRAP = REGISTRATE
.blockEntity("crab_trap", CrabTrapBlockEntity::createBlockEntity)
.onRegister(CrabTrapBlockEntity::onBlockEntityRegister)
.validBlock(ModBlocks.CRAB_TRAP)
.register();

public static final BlockEntityEntry<ChargeCollectorBlockEntity> CHARGE_COLLECTOR = REGISTRATE
.blockEntity("crab_trap", ChargeCollectorBlockEntity::createBlockEntity)
.blockEntity("charge_collector", ChargeCollectorBlockEntity::createBlockEntity)
.validBlock(ModBlocks.CHARGE_COLLECTOR)
.register();

Expand Down
121 changes: 99 additions & 22 deletions common/src/main/java/dev/dubhe/anvilcraft/init/ModBlocks.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package dev.dubhe.anvilcraft.init;

import static dev.dubhe.anvilcraft.AnvilCraft.REGISTRATE;
import static dev.dubhe.anvilcraft.api.power.IPowerComponent.OVERLOAD;
import static dev.dubhe.anvilcraft.api.power.IPowerComponent.SWITCH;

import com.tterrag.registrate.providers.RegistrateRecipeProvider;
import com.tterrag.registrate.util.entry.BlockEntry;
import dev.dubhe.anvilcraft.AnvilCraft;
Expand All @@ -20,6 +16,7 @@
import dev.dubhe.anvilcraft.block.JewelCraftingTable;
import dev.dubhe.anvilcraft.block.LavaCauldronBlock;
import dev.dubhe.anvilcraft.block.MagnetBlock;
import dev.dubhe.anvilcraft.block.MeltGemCauldron;
import dev.dubhe.anvilcraft.block.PiezoelectricCrystalBlock;
import dev.dubhe.anvilcraft.block.ResinBlock;
import dev.dubhe.anvilcraft.block.RoyalAnvilBlock;
Expand All @@ -36,7 +33,6 @@
import dev.dubhe.anvilcraft.item.PlaceInWaterBlockItem;
import dev.dubhe.anvilcraft.item.ResinBlockItem;
import dev.dubhe.anvilcraft.item.TransmissionPoleBlockItem;
import java.util.Map;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.data.recipes.ShapedRecipeBuilder;
Expand All @@ -58,6 +54,12 @@
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.phys.Vec3;

import java.util.Map;

import static dev.dubhe.anvilcraft.AnvilCraft.REGISTRATE;
import static dev.dubhe.anvilcraft.api.power.IPowerComponent.OVERLOAD;
import static dev.dubhe.anvilcraft.api.power.IPowerComponent.SWITCH;

public class ModBlocks {
public static final BlockEntry<? extends Block> STAMPING_PLATFORM = REGISTRATE
.block("stamping_platform", StampingPlatformBlock::new)
Expand Down Expand Up @@ -606,17 +608,77 @@ public class ModBlocks {
})
.initialProperties(() -> Blocks.IRON_BLOCK)
.tag(BlockTags.MINEABLE_WITH_PICKAXE)
.recipe((ctx, provider) -> ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ctx.get())
.pattern("ABA")
.pattern(" B ")
.pattern("ABA")
.define('A', Blocks.QUARTZ_BLOCK)
.define('B', Items.COPPER_INGOT)
.unlockedBy(AnvilCraftDatagen.hasItem(Blocks.QUARTZ_BLOCK),
AnvilCraftDatagen.has(Blocks.CRAFTING_TABLE))
.unlockedBy(AnvilCraftDatagen.hasItem(Items.COPPER_INGOT),
AnvilCraftDatagen.has(Blocks.CRAFTING_TABLE))
.save(provider))
.recipe((ctx, provider) -> {
ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ctx.get())
.pattern("ABA")
.pattern(" B ")
.pattern("ABA")
.define('A', Items.COPPER_INGOT)
.define('B', ModItemTags.QUARTZ_BLOCKS)
.unlockedBy(
AnvilCraftDatagen.hasItem(Items.COPPER_INGOT),
AnvilCraftDatagen.has(Items.COPPER_INGOT)
)
.unlockedBy(
AnvilCraftDatagen.hasItem(ModItemTags.QUARTZ_BLOCKS),
AnvilCraftDatagen.has(ModItemTags.QUARTZ_BLOCKS)
)
.save(provider);
ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ctx.get())
.pattern("ABA")
.pattern(" B ")
.pattern("ABA")
.define('A', Items.COPPER_INGOT)
.define('B', ModItemTags.AMETHYST_BLOCKS)
.unlockedBy(
AnvilCraftDatagen.hasItem(Items.COPPER_INGOT),
AnvilCraftDatagen.has(Items.COPPER_INGOT)
)
.unlockedBy(
AnvilCraftDatagen.hasItem(ModItemTags.AMETHYST_BLOCKS),
AnvilCraftDatagen.has(ModItemTags.AMETHYST_BLOCKS)
)
.save(
provider,
BuiltInRegistries.ITEM.getKey(ctx.get().asItem()) + "_amethyst"
);
ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ctx.get())
.pattern("ABA")
.pattern(" B ")
.pattern("ABA")
.define('A', Items.COPPER_INGOT)
.define('B', ModItemTags.QUARTZ_BLOCKS_FORGE)
.unlockedBy(
AnvilCraftDatagen.hasItem(Items.COPPER_INGOT),
AnvilCraftDatagen.has(Items.COPPER_INGOT)
)
.unlockedBy(
AnvilCraftDatagen.hasItem(ModItemTags.QUARTZ_BLOCKS_FORGE),
AnvilCraftDatagen.has(ModItemTags.QUARTZ_BLOCKS_FORGE)
)
.save(
provider,
BuiltInRegistries.ITEM.getKey(ctx.get().asItem()) + "_forge"
);
ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ctx.get())
.pattern("ABA")
.pattern(" B ")
.pattern("ABA")
.define('A', Items.COPPER_INGOT)
.define('B', ModItemTags.AMETHYST_BLOCKS_FORGE)
.unlockedBy(
AnvilCraftDatagen.hasItem(Items.COPPER_INGOT),
AnvilCraftDatagen.has(Items.COPPER_INGOT)
)
.unlockedBy(
AnvilCraftDatagen.hasItem(ModItemTags.AMETHYST_BLOCKS_FORGE),
AnvilCraftDatagen.has(ModItemTags.AMETHYST_BLOCKS_FORGE)
)
.save(
provider,
BuiltInRegistries.ITEM.getKey(ctx.get().asItem()) + "_amethyst_forge"
);
})
.register();
public static final BlockEntry<ChargeCollectorBlock> CHARGE_COLLECTOR =
REGISTRATE
Expand All @@ -634,15 +696,30 @@ public class ModBlocks {
.define('A', ModItems.MAGNETOELECTRIC_CORE)
.define('B', Items.COPPER_INGOT)
.define('C', Items.IRON_INGOT)
.unlockedBy(AnvilCraftDatagen.hasItem(ModBlocks.FERRITE_CORE_MAGNET_BLOCK),
AnvilCraftDatagen.has(Blocks.CRAFTING_TABLE))
.unlockedBy(AnvilCraftDatagen.hasItem(Items.COPPER_INGOT),
AnvilCraftDatagen.has(Blocks.CRAFTING_TABLE))
.unlockedBy(AnvilCraftDatagen.hasItem(Items.IRON_INGOT),
AnvilCraftDatagen.has(Blocks.CRAFTING_TABLE))
.unlockedBy(
AnvilCraftDatagen.hasItem(ModItems.MAGNETOELECTRIC_CORE),
AnvilCraftDatagen.has(ModItems.MAGNETOELECTRIC_CORE)
)
.unlockedBy(
AnvilCraftDatagen.hasItem(Items.COPPER_INGOT),
AnvilCraftDatagen.has(Items.COPPER_INGOT)
)
.unlockedBy(
AnvilCraftDatagen.hasItem(Items.IRON_INGOT),
AnvilCraftDatagen.has(Items.IRON_INGOT)
)
.save(provider))
.register();

public static final BlockEntry<MeltGemCauldron> MELT_GEM_CAULDRON = REGISTRATE
.block("melt_gem_cauldron", MeltGemCauldron::new)
.initialProperties(() -> Blocks.CAULDRON)
.blockstate((ctx, provider) -> {
})
.loot((tables, block) -> tables.dropOther(block, Items.CAULDRON))
.tag(BlockTags.MINEABLE_WITH_PICKAXE)
.register();

public static void register() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public class ModItemTags {
public static final TagKey<Item> TIN_NUGGETS = bindC("tin_nuggets");
public static final TagKey<Item> TIN_INGOTS = bindC("tin_ingots");
public static final TagKey<Item> COPPER_NUGGETS = bindC("copper_nuggets");
public static final TagKey<Item> QUARTZ_BLOCKS = bindC("quartz_blocks");
public static final TagKey<Item> AMETHYST_BLOCKS = bindC("amethyst_blocks");

public static final TagKey<Item> FLOUR_FORGE = bindForge("flour");
public static final TagKey<Item> WHEAT_FLOUR_FORGE = bindForge("flour/wheat");
Expand All @@ -58,6 +60,9 @@ public class ModItemTags {
public static final TagKey<Item> TIN_NUGGETS_FORGE = bindForge("tin_nuggets");
public static final TagKey<Item> TIN_INGOTS_FORGE = bindForge("tin_ingots");
public static final TagKey<Item> COPPER_NUGGETS_FORGE = bindForge("copper_nuggets");
public static final TagKey<Item> QUARTZ_BLOCKS_FORGE = bindForge("quartz_blocks");
public static final TagKey<Item> AMETHYST_BLOCKS_FORGE = bindForge("amethyst_blocks");


public static final TagKey<Item> ROYAL_STEEL_PICKAXE_BASE = bind("royal_steel_pickaxe_base");
public static final TagKey<Item> ROYAL_STEEL_AXE_BASE = bind("royal_steel_axe_base");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "anvilcraft:block/melt_gem_cauldron"
}
}
}
4 changes: 2 additions & 2 deletions common/src/main/resources/assets/anvilcraft/lang/es_es.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"item.anvilcraft.royal_steel_pickaxe": "Pico de acero real",
"item.anvilcraft.royal_steel_shovel": "Pala Acero Real",
"item.anvilcraft.royal_steel_sword": "Espada Acero Real",
"item.anvilcraft.royal_steel_upgrade_smithing_template": "Plantilla de mejora de acero real",
"item.anvilcraft.royal_steel_upgrade_smithing_template": "Plantilla de herrería",
"item.anvilcraft.ruby": "Rubí",
"item.anvilcraft.sapphire": "Zafiro",
"item.anvilcraft.sea_heart_shell": "Concha de corazón marino",
Expand Down Expand Up @@ -127,7 +127,7 @@
"screen.anvilcraft.royal_steel_upgrade_smithing_template": "Plantilla de mejora de acero real",
"screen.anvilcraft.slot.disable.tooltip": "Usar clics en elementos para establecer el filtro",
"screen.anvilcraft.smithing_template.royal_steel_upgrade_smithing_template.additions_slot_description": "Coloque el lingote de acero real",
"screen.anvilcraft.smithing_template.royal_steel_upgrade_smithing_template.applies_to": "Pico de amatista Pico de oro Pico de hierro Pico de diamante",
"screen.anvilcraft.smithing_template.royal_steel_upgrade_smithing_template.applies_to": "Herramientas o bloques forjados",
"screen.anvilcraft.smithing_template.royal_steel_upgrade_smithing_template.base_slot_description": "Coloque el pico",
"text.autoconfig.anvilcraft.option.anvilEfficiency": "Eficiencia del yunque",
"text.autoconfig.anvilcraft.option.anvilEfficiency.@Tooltip": "Número máximo de artículos procesados por el yunque al mismo tiempo",
Expand Down
4 changes: 2 additions & 2 deletions common/src/main/resources/assets/anvilcraft/lang/fr_fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"item.anvilcraft.royal_steel_pickaxe": "Pioche en acier royal",
"item.anvilcraft.royal_steel_shovel": "Pelle en acier Royal",
"item.anvilcraft.royal_steel_sword": "Épée d'acier royal",
"item.anvilcraft.royal_steel_upgrade_smithing_template": "Modèle de forge d'acier royal",
"item.anvilcraft.royal_steel_upgrade_smithing_template": "Modèle de forge",
"item.anvilcraft.ruby": "Rubis",
"item.anvilcraft.sapphire": "Saphir",
"item.anvilcraft.sea_heart_shell": "Coquille de coeur de mer",
Expand Down Expand Up @@ -127,7 +127,7 @@
"screen.anvilcraft.royal_steel_upgrade_smithing_template": "Modèle de forge-Amélioration royale",
"screen.anvilcraft.slot.disable.tooltip": "Utiliser les clics sur les éléments pour définir le filtre",
"screen.anvilcraft.smithing_template.royal_steel_upgrade_smithing_template.additions_slot_description": "Mettre les lingots d'acier royal",
"screen.anvilcraft.smithing_template.royal_steel_upgrade_smithing_template.applies_to": "Pioche en améthyste, Pioche en fer, Pioche en or, Pioche en diamant",
"screen.anvilcraft.smithing_template.royal_steel_upgrade_smithing_template.applies_to": "Outils ou blocs forgés",
"screen.anvilcraft.smithing_template.royal_steel_upgrade_smithing_template.base_slot_description": "Mettez la pioche",
"text.autoconfig.anvilcraft.option.anvilEfficiency": "Efficacité de l'enclume",
"text.autoconfig.anvilcraft.option.anvilEfficiency.@Tooltip": "Nombre maximum d'éléments traités par l'enclume en même temps",
Expand Down
Loading

0 comments on commit d707336

Please sign in to comment.