Aeternium anvil

This commit is contained in:
paulevsGitch 2021-02-12 12:26:05 +03:00
parent 2403907b0d
commit dec0c7df51
17 changed files with 146 additions and 8 deletions

View file

@ -0,0 +1,77 @@
package ru.betterend.blocks;
import java.io.Reader;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import com.google.common.collect.Maps;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.AnvilBlock;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.loot.context.LootContext;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.IntProperty;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import ru.betterend.item.material.EndToolMaterial;
import ru.betterend.patterns.BlockPatterned;
import ru.betterend.patterns.Patterns;
import ru.betterend.registry.EndBlocks;
public class AeterniumAnvil extends AnvilBlock implements BlockPatterned {
public static final IntProperty DESTRUCTION = BlockProperties.DESTRUCTION_LONG;
private final int level;
public AeterniumAnvil() {
super(FabricBlockSettings.copyOf(Blocks.ANVIL).materialColor(EndBlocks.AETERNIUM_BLOCK.getDefaultMaterialColor()));
this.level = EndToolMaterial.AETERNIUM.getMiningLevel();
}
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
super.appendProperties(builder);
builder.add(DESTRUCTION);
}
public int getCraftingLevel() {
return level;
}
@Override
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) {
return Collections.singletonList(new ItemStack(this));
}
@Override
public String getStatesPattern(Reader data) {
Identifier blockId = Registry.BLOCK.getId(this);
return Patterns.createJson(data, blockId.getPath(), blockId.getPath());
}
@Override
public String getModelPattern(String block) {
Identifier blockId = Registry.BLOCK.getId(this);
Map<String, String> map = Maps.newHashMap();
map.put("%anvil%", blockId.getPath());
map.put("%top%", getTop(blockId, block));
return Patterns.createJson(Patterns.BLOCK_ANVIL, map);
}
private String getTop(Identifier blockId, String block) {
if (block.contains("item")) {
return blockId.getPath() + "_top_0";
}
char last = block.charAt(block.length() - 1);
return blockId.getPath() + "_top_" + last;
}
@Override
public Identifier statePatternId() {
return Patterns.STATE_ANVIL_LONG;
}
}

View file

@ -16,6 +16,7 @@ public class BlockProperties {
public static final BooleanProperty NATURAL = BooleanProperty.of("natural");
public static final BooleanProperty ACTIVE = BooleanProperty.of("active");
public static final IntProperty DESTRUCTION_LONG = IntProperty.of("destruction", 0, 8);
public static final IntProperty DESTRUCTION = IntProperty.of("destruction", 0, 2);
public static final IntProperty ROTATION = IntProperty.of("rotation", 0, 3);
public static final IntProperty FULLNESS = IntProperty.of("fullness", 0, 3);

View file

@ -41,6 +41,7 @@ public class Patterns {
public final static Identifier STATE_COMPOSTER = BetterEnd.makeID("patterns/blockstate/composter.json");
public final static Identifier STATE_BARS = BetterEnd.makeID("patterns/blockstate/bars.json");
public final static Identifier STATE_ANVIL = BetterEnd.makeID("patterns/blockstate/anvil.json");
public final static Identifier STATE_ANVIL_LONG = BetterEnd.makeID("patterns/blockstate/anvil_long.json");
public final static Identifier STATE_CHAIN = BetterEnd.makeID("patterns/blockstate/chain.json");
public final static Identifier STATE_CHANDELIER = BetterEnd.makeID("patterns/blockstate/chandelier.json");
public final static Identifier STATE_FURNACE = BetterEnd.makeID("patterns/blockstate/furnace.json");

View file

@ -1,6 +1,7 @@
package ru.betterend.recipe;
import net.minecraft.item.Items;
import ru.betterend.item.material.EndToolMaterial;
import ru.betterend.recipe.builders.AnvilRecipe;
import ru.betterend.registry.EndItems;
@ -22,42 +23,42 @@ public class AnvilRecipes {
AnvilRecipe.Builder.create("aeternium_axe_head")
.setInput(EndItems.AETERNIUM_INGOT)
.setOutput(EndItems.AETERNIUM_AXE_HEAD)
.setAnvilLevel(3)
.setAnvilLevel(EndToolMaterial.AETERNIUM.getDurability())
.setToolLevel(4)
.setDamage(6)
.build();
AnvilRecipe.Builder.create("aeternium_pickaxe_head")
.setInput(EndItems.AETERNIUM_INGOT)
.setOutput(EndItems.AETERNIUM_PICKAXE_HEAD)
.setAnvilLevel(3)
.setAnvilLevel(EndToolMaterial.AETERNIUM.getDurability())
.setToolLevel(4)
.setDamage(6)
.build();
AnvilRecipe.Builder.create("aeternium_shovel_head")
.setInput(EndItems.AETERNIUM_INGOT)
.setOutput(EndItems.AETERNIUM_SHOVEL_HEAD)
.setAnvilLevel(3)
.setAnvilLevel(EndToolMaterial.AETERNIUM.getDurability())
.setToolLevel(4)
.setDamage(6)
.build();
AnvilRecipe.Builder.create("aeternium_hoe_head")
.setInput(EndItems.AETERNIUM_INGOT)
.setOutput(EndItems.AETERNIUM_HOE_HEAD)
.setAnvilLevel(3)
.setAnvilLevel(EndToolMaterial.AETERNIUM.getDurability())
.setToolLevel(4)
.setDamage(6)
.build();
AnvilRecipe.Builder.create("aeternium_hammer_head")
.setInput(EndItems.AETERNIUM_INGOT)
.setOutput(EndItems.AETERNIUM_HAMMER_HEAD)
.setAnvilLevel(3)
.setAnvilLevel(EndToolMaterial.AETERNIUM.getDurability())
.setToolLevel(4)
.setDamage(6)
.build();
AnvilRecipe.Builder.create("aeternium_sword_blade")
.setInput(EndItems.AETERNIUM_INGOT)
.setOutput(EndItems.AETERNIUM_SWORD_BLADE)
.setAnvilLevel(3)
.setAnvilLevel(EndToolMaterial.AETERNIUM.getDurability())
.setToolLevel(4)
.setDamage(6)
.build();

View file

@ -77,5 +77,11 @@ public class SmithingRecipes {
.setBase(EndBlocks.THALLASIUM.anvil)
.setAddition(EndBlocks.TERMINITE.block)
.build();
SmithingTableRecipe.create("terminite_anvil_updrade")
.setResult(EndBlocks.AETERNIUM_ANVIL)
.setBase(EndBlocks.TERMINITE.anvil)
.setAddition(EndBlocks.AETERNIUM_BLOCK)
.build();
}
}

View file

@ -7,6 +7,7 @@ import net.minecraft.item.BlockItem;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import ru.betterend.BetterEnd;
import ru.betterend.blocks.AeterniumAnvil;
import ru.betterend.blocks.AeterniumBlock;
import ru.betterend.blocks.AmberBlock;
import ru.betterend.blocks.AncientEmeraldIceBlock;
@ -322,6 +323,7 @@ public class EndBlocks {
public static final Block END_STONE_SMELTER = registerBlock("end_stone_smelter", new EndStoneSmelter());
public static final Block ETERNAL_PEDESTAL = registerBlock("eternal_pedestal", new EternalPedestal());
public static final Block INFUSION_PEDESTAL = registerBlock("infusion_pedestal", new InfusionPedestal());
public static final Block AETERNIUM_ANVIL = registerBlock("aeternium_anvil", new AeterniumAnvil());
// Technical
public static final Block END_PORTAL_BLOCK = registerBlockNI("end_portal_block", new EndPortalBlock());

View file

@ -675,5 +675,6 @@
"item.betterend.thallasium_pickaxe_head": "Thallasium Pickaxe Head",
"item.betterend.thallasium_shovel_head": "Thallasium Shovel Head",
"item.betterend.thallasium_sword_blade": "Thallasium Sword Blade",
"item.betterend.thallasium_sword_handle": "Thallasium Sword Handle"
"item.betterend.thallasium_sword_handle": "Thallasium Sword Handle",
"block.betterend.aeternium_anvil": "Aeternium Anvil"
}

View file

@ -695,5 +695,6 @@
"item.betterend.thallasium_pickaxe_head": "Навершие талласиевой кирки",
"item.betterend.thallasium_shovel_head": "Навершие талласиевой лопаты",
"item.betterend.thallasium_sword_blade": "Лезвие талласиевого меча",
"item.betterend.thallasium_sword_handle": "Рукоятка талласиевого меча"
"item.betterend.thallasium_sword_handle": "Рукоятка талласиевого меча",
"block.betterend.aeternium_anvil": "Этериевая наковальня"
}

View file

@ -0,0 +1,48 @@
{
"variants": {
"destruction=0,facing=east": { "model": "betterend:pattern/%block%/%block%_0", "y": 270 },
"destruction=0,facing=north": { "model": "betterend:pattern/%block%/%block%_0", "y": 180 },
"destruction=0,facing=south": { "model": "betterend:pattern/%block%/%block%_0" },
"destruction=0,facing=west": { "model": "betterend:pattern/%block%/%block%_0", "y": 90 },
"destruction=1,facing=east": { "model": "betterend:pattern/%block%/%block%_0", "y": 270 },
"destruction=1,facing=north": { "model": "betterend:pattern/%block%/%block%_0", "y": 180 },
"destruction=1,facing=south": { "model": "betterend:pattern/%block%/%block%_0" },
"destruction=1,facing=west": { "model": "betterend:pattern/%block%/%block%_0", "y": 90 },
"destruction=2,facing=east": { "model": "betterend:pattern/%block%/%block%_0", "y": 270 },
"destruction=2,facing=north": { "model": "betterend:pattern/%block%/%block%_0", "y": 180 },
"destruction=2,facing=south": { "model": "betterend:pattern/%block%/%block%_0" },
"destruction=2,facing=west": { "model": "betterend:pattern/%block%/%block%_0", "y": 90 },
"destruction=3,facing=east": { "model": "betterend:pattern/%block%/%block%_1", "y": 270 },
"destruction=3,facing=north": { "model": "betterend:pattern/%block%/%block%_1", "y": 180 },
"destruction=3,facing=south": { "model": "betterend:pattern/%block%/%block%_1" },
"destruction=3,facing=west": { "model": "betterend:pattern/%block%/%block%_1", "y": 90 },
"destruction=4,facing=east": { "model": "betterend:pattern/%block%/%block%_1", "y": 270 },
"destruction=4,facing=north": { "model": "betterend:pattern/%block%/%block%_1", "y": 180 },
"destruction=4,facing=south": { "model": "betterend:pattern/%block%/%block%_1" },
"destruction=4,facing=west": { "model": "betterend:pattern/%block%/%block%_1", "y": 90 },
"destruction=5,facing=east": { "model": "betterend:pattern/%block%/%block%_1", "y": 270 },
"destruction=5,facing=north": { "model": "betterend:pattern/%block%/%block%_1", "y": 180 },
"destruction=5,facing=south": { "model": "betterend:pattern/%block%/%block%_1" },
"destruction=5,facing=west": { "model": "betterend:pattern/%block%/%block%_1", "y": 90 },
"destruction=6,facing=east": { "model": "betterend:pattern/%block%/%block%_2", "y": 270 },
"destruction=6,facing=north": { "model": "betterend:pattern/%block%/%block%_2", "y": 180 },
"destruction=6,facing=south": { "model": "betterend:pattern/%block%/%block%_2" },
"destruction=6,facing=west": { "model": "betterend:pattern/%block%/%block%_2", "y": 90 },
"destruction=7,facing=east": { "model": "betterend:pattern/%block%/%block%_2", "y": 270 },
"destruction=7,facing=north": { "model": "betterend:pattern/%block%/%block%_2", "y": 180 },
"destruction=7,facing=south": { "model": "betterend:pattern/%block%/%block%_2" },
"destruction=7,facing=west": { "model": "betterend:pattern/%block%/%block%_2", "y": 90 },
"destruction=8,facing=east": { "model": "betterend:pattern/%block%/%block%_2", "y": 270 },
"destruction=8,facing=north": { "model": "betterend:pattern/%block%/%block%_2", "y": 180 },
"destruction=8,facing=south": { "model": "betterend:pattern/%block%/%block%_2" },
"destruction=8,facing=west": { "model": "betterend:pattern/%block%/%block%_2", "y": 90 }
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 421 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 464 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 420 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 485 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 537 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 299 B

After

Width:  |  Height:  |  Size: 277 B

Before After
Before After