Skip to content

Commit

Permalink
Merge pull request #427 from Gu-ZT/releases/1.20.1
Browse files Browse the repository at this point in the history
修正压电晶体和集电器中存在的问题
  • Loading branch information
Gugle2308 authored Apr 28, 2024
2 parents e1daf17 + 2e481d6 commit 7323765
Show file tree
Hide file tree
Showing 25 changed files with 533 additions and 61 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.dubhe.anvilcraft.entity.render;
package dev.dubhe.anvilcraft.client.renderer.entity;

import com.mojang.blaze3d.vertex.PoseStack;
import dev.dubhe.anvilcraft.entity.AnimateAscendingBlockEntity;
Expand Down
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
111 changes: 89 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 Down Expand Up @@ -36,7 +32,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 +53,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 +607,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,12 +695,18 @@ 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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.tterrag.registrate.util.entry.EntityEntry;
import dev.dubhe.anvilcraft.AnvilCraft;
import dev.dubhe.anvilcraft.entity.AnimateAscendingBlockEntity;
import dev.dubhe.anvilcraft.entity.render.AscendingBlockRenderer;
import dev.dubhe.anvilcraft.client.renderer.entity.AscendingBlockRenderer;
import net.minecraft.world.entity.MobCategory;

public class ModEntities {
Expand Down
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
Expand Up @@ -6,31 +6,31 @@
"items": [
{
"items": [
"minecraft:crafting_table"
"minecraft:copper_ingot"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_ferrite_core_magnet_block": {
"has_iron_ingot": {
"conditions": {
"items": [
{
"items": [
"minecraft:crafting_table"
"minecraft:iron_ingot"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_iron_ingot": {
"has_magnetoelectric_core": {
"conditions": {
"items": [
{
"items": [
"minecraft:crafting_table"
"anvilcraft:magnetoelectric_core"
]
}
]
Expand All @@ -46,7 +46,7 @@
},
"requirements": [
[
"has_ferrite_core_magnet_block",
"has_magnetoelectric_core",
"has_copper_ingot",
"has_iron_ingot",
"has_the_recipe"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,18 @@
"items": [
{
"items": [
"minecraft:crafting_table"
"minecraft:copper_ingot"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_quartz_block": {
"has_quartz_blocks": {
"conditions": {
"items": [
{
"items": [
"minecraft:crafting_table"
]
"tag": "c:quartz_blocks"
}
]
},
Expand All @@ -34,8 +32,8 @@
},
"requirements": [
[
"has_quartz_block",
"has_copper_ingot",
"has_quartz_blocks",
"has_the_recipe"
]
],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_amethyst_blocks": {
"conditions": {
"items": [
{
"tag": "c:amethyst_blocks"
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_copper_ingot": {
"conditions": {
"items": [
{
"items": [
"minecraft:copper_ingot"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "anvilcraft:piezoelectric_crystal_amethyst"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_copper_ingot",
"has_amethyst_blocks",
"has_the_recipe"
]
],
"rewards": {
"recipes": [
"anvilcraft:piezoelectric_crystal_amethyst"
]
},
"sends_telemetry_event": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_amethyst_blocks": {
"conditions": {
"items": [
{
"tag": "forge:amethyst_blocks"
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_copper_ingot": {
"conditions": {
"items": [
{
"items": [
"minecraft:copper_ingot"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "anvilcraft:piezoelectric_crystal_amethyst_forge"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_copper_ingot",
"has_amethyst_blocks",
"has_the_recipe"
]
],
"rewards": {
"recipes": [
"anvilcraft:piezoelectric_crystal_amethyst_forge"
]
},
"sends_telemetry_event": false
}
Loading

0 comments on commit 7323765

Please sign in to comment.