New blocks and items
This commit is contained in:
parent
1966d89dc7
commit
98b714827a
20 changed files with 191 additions and 3 deletions
|
@ -5,6 +5,7 @@ import net.minecraft.block.Blocks;
|
|||
import net.minecraft.item.Items;
|
||||
import net.minecraft.tag.ItemTags;
|
||||
import ru.betterend.config.MainConfig;
|
||||
import ru.betterend.recipe.CraftingRecipes;
|
||||
import ru.betterend.recipe.RecipeBuilder;
|
||||
import ru.betterend.registry.BiomeRegistry;
|
||||
import ru.betterend.registry.BlockRegistry;
|
||||
|
@ -25,6 +26,7 @@ public class BetterEnd implements ModInitializer {
|
|||
FeatureRegistry.register();
|
||||
BiomeRegistry.register();
|
||||
BetterEndBiomeSource.register();
|
||||
CraftingRecipes.register();
|
||||
|
||||
// TEST //
|
||||
new RecipeBuilder("test_block", Blocks.ANVIL)
|
||||
|
|
28
src/main/java/ru/betterend/blocks/AeterniumBlock.java
Normal file
28
src/main/java/ru/betterend/blocks/AeterniumBlock.java
Normal file
|
@ -0,0 +1,28 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.block.MaterialColor;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.BlockView;
|
||||
|
||||
public class AeterniumBlock extends BlockBase {
|
||||
|
||||
public AeterniumBlock() {
|
||||
super(FabricBlockSettings.of(Material.METAL, MaterialColor.GRAY)
|
||||
.hardness(65F)
|
||||
.resistance(1200F)
|
||||
.requiresTool()
|
||||
.sounds(BlockSoundGroup.NETHERITE));
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public int getColor(BlockState state, BlockView world, BlockPos pos) {
|
||||
return 0xFF657A7A;
|
||||
}
|
||||
}
|
27
src/main/java/ru/betterend/blocks/EnderBlock.java
Normal file
27
src/main/java/ru/betterend/blocks/EnderBlock.java
Normal file
|
@ -0,0 +1,27 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.block.MaterialColor;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.BlockView;
|
||||
|
||||
public class EnderBlock extends BlockBase {
|
||||
|
||||
public EnderBlock() {
|
||||
super(FabricBlockSettings.of(Material.STONE, MaterialColor.field_25708)
|
||||
.hardness(5F)
|
||||
.resistance(6F)
|
||||
.requiresTool()
|
||||
.sounds(BlockSoundGroup.STONE));
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public int getColor(BlockState state, BlockView world, BlockPos pos) {
|
||||
return 0xFF005548;
|
||||
}
|
||||
}
|
18
src/main/java/ru/betterend/blocks/TerminiteBlock.java
Normal file
18
src/main/java/ru/betterend/blocks/TerminiteBlock.java
Normal file
|
@ -0,0 +1,18 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.block.MaterialColor;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
|
||||
public class TerminiteBlock extends BlockBase {
|
||||
|
||||
public TerminiteBlock() {
|
||||
super(FabricBlockSettings.of(Material.METAL, MaterialColor.field_25708)
|
||||
.hardness(7F)
|
||||
.resistance(9F)
|
||||
.requiresTool()
|
||||
.sounds(BlockSoundGroup.METAL));
|
||||
}
|
||||
}
|
34
src/main/java/ru/betterend/recipe/CraftingRecipes.java
Normal file
34
src/main/java/ru/betterend/recipe/CraftingRecipes.java
Normal file
|
@ -0,0 +1,34 @@
|
|||
package ru.betterend.recipe;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
import ru.betterend.registry.BlockRegistry;
|
||||
|
||||
public class CraftingRecipes {
|
||||
public static void register() {
|
||||
if (blockExists(BlockRegistry.ENDER_BLOCK)) {
|
||||
new RecipeBuilder("be_ender_pearl_to_block", BlockRegistry.ENDER_BLOCK)
|
||||
.setShape(new String[] { "OO", "OO" })
|
||||
.addMaterial('O', Items.ENDER_PEARL)
|
||||
.build();
|
||||
new RecipeBuilder("be_ender_block_to_pearl", Items.ENDER_PEARL)
|
||||
.addMaterial('#', BlockRegistry.ENDER_BLOCK)
|
||||
.setOutputCount(4)
|
||||
.setList("#")
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean itemExists(Item item)
|
||||
{
|
||||
return Registry.ITEM.getId(item) != Registry.ITEM.getDefaultId();
|
||||
}
|
||||
|
||||
private static boolean blockExists(Block block)
|
||||
{
|
||||
return Registry.BLOCK.getId(block) != Registry.BLOCK.getDefaultId();
|
||||
}
|
||||
}
|
|
@ -5,16 +5,23 @@ import net.minecraft.item.BlockItem;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.blocks.AeterniumBlock;
|
||||
import ru.betterend.blocks.BlockEndstoneDust;
|
||||
import ru.betterend.blocks.BlockOre;
|
||||
import ru.betterend.blocks.BlockWetMycelium;
|
||||
import ru.betterend.blocks.EnderBlock;
|
||||
import ru.betterend.blocks.TerminiteBlock;
|
||||
import ru.betterend.tab.CreativeTab;
|
||||
|
||||
public class BlockRegistry {
|
||||
public static final Block ENDSTONE_DUST = registerBlock("endstone_dust", new BlockEndstoneDust());
|
||||
public static final Block WET_MYCELIUM = registerBlock("wet_mycelium", new BlockWetMycelium());
|
||||
public static final Block ENDER_ORE = registerBlock("ender_ore", new BlockOre(ItemRegistry.ENDER_DUST, 1, 3));
|
||||
public static final Block TERMINITE_BLOCK = registerBlock("terminite_block", new TerminiteBlock());
|
||||
public static final Block AETERNIUM_BLOCK = registerBlock("aeternium_block", new AeterniumBlock());
|
||||
public static final Block ENDER_BLOCK = registerBlock("ender_block", new EnderBlock());
|
||||
|
||||
public static void register() {}
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@ public class ItemRegistry {
|
|||
private static final List<Item> MOD_ITEMS = Lists.newArrayList();
|
||||
|
||||
public final static Item ENDER_DUST = registerItem("ender_dust", new Item((new Item.Settings()).group(ItemGroup.MATERIALS)));
|
||||
public final static Item TERMINITE_INGOT = registerItem("terminite_ingot", new Item((new Item.Settings()).group(ItemGroup.MATERIALS)));
|
||||
public final static Item AETERNIUM_INGOT = registerItem("aeternium_ingot", new Item((new Item.Settings()).group(ItemGroup.MATERIALS)));
|
||||
|
||||
protected static Item registerItem(String name, Item item) {
|
||||
if (item != Items.AIR) {
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"variants": {
|
||||
"": {
|
||||
"model": "betterend:block/aeternium_block"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"variants": {
|
||||
"": {
|
||||
"model": "betterend:block/ender_block"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"variants": {
|
||||
"": {
|
||||
"model": "betterend:block/terminite_block"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,6 +4,11 @@
|
|||
"block.betterend.wet_mycelium": "Wet Mycelium",
|
||||
"block.betterend.endstone_dust": "End Stone Dust",
|
||||
"block.betterend.ender_ore": "Ender Ore",
|
||||
"block.betterend.terminite_block": "Terminite Block",
|
||||
"block.betterend.aeternium_block": "Aeternium Block",
|
||||
"block.betterend.ender_block": "Ender Block",
|
||||
|
||||
"item.betterend.ender_dust": "Ender Dust"
|
||||
"item.betterend.ender_dust": "Ender Dust",
|
||||
"item.betterend.terminite_ingot": "Terminite Ingot",
|
||||
"item.betterend.aeternium_ingot": "Aeternium Ingot"
|
||||
}
|
|
@ -3,7 +3,12 @@
|
|||
|
||||
"block.betterend.wet_mycelium": "Влажный мицелий",
|
||||
"block.betterend.endstone_dust": "Эндерняковая пыль",
|
||||
"block.betterend.ender_ore": "Руда Эндера",
|
||||
"block.betterend.ender_ore": "Руда Края",
|
||||
"block.betterend.terminite_block": "Блок Терминита",
|
||||
"block.betterend.aeternium_block": "Блок Этерия",
|
||||
"block.betterend.ender_block": "Блок Края",
|
||||
|
||||
"item.betterend.ender_dust": "Пыль Эндера"
|
||||
"item.betterend.ender_dust": "Пыль Края",
|
||||
"item.betterend.terminite_ingot": "Терминитовый слиток",
|
||||
"item.betterend.aeternium_ingot": "Этериевый слиток"
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "block/cube_all",
|
||||
"textures": {
|
||||
"all": "betterend:block/aeternium_block"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "block/cube_all",
|
||||
"textures": {
|
||||
"all": "betterend:block/ender_block"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "block/cube_all",
|
||||
"textures": {
|
||||
"all": "betterend:block/terminite_block"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"parent": "betterend:block/aeternium_block"
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "betterend:item/aeternium_ingot"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"parent": "betterend:block/ender_block"
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"parent": "betterend:block/terminite_block"
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "betterend:item/terminite_ingot"
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue