Tidy up code & add ruby ore

master
TechnoVisionDev 4 years ago
parent 286a12f142
commit 25ed35627a

@ -1,7 +1,6 @@
package com.technovision.tutorial.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.*;
import net.minecraft.block.material.Material;
import net.minecraftforge.common.ToolType;

@ -0,0 +1,26 @@
package com.technovision.tutorial.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.OreBlock;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IWorldReader;
import net.minecraftforge.common.ToolType;
public class RubyOre extends OreBlock {
public RubyOre() {
super(Block.Properties.create(Material.IRON)
.hardnessAndResistance(3.0f, 4.0f)
.sound(SoundType.STONE)
.harvestLevel(2)
.harvestTool(ToolType.PICKAXE));
}
@Override
public int getExpDrop(BlockState state, IWorldReader reader, BlockPos pos, int fortune, int silktouch) {
return 1;
}
}

@ -3,6 +3,7 @@ package com.technovision.tutorial.util;
import com.technovision.tutorial.Tutorial;
import com.technovision.tutorial.armor.ModArmorMaterial;
import com.technovision.tutorial.blocks.RubyBlock;
import com.technovision.tutorial.blocks.RubyOre;
import com.technovision.tutorial.items.PoisonApple;
import com.technovision.tutorial.tools.ModItemTier;
import net.minecraft.block.Block;
@ -51,8 +52,9 @@ public class RegistryHandler {
// Blocks
public static final RegistryObject<Block> RUBY_BLOCK = BLOCKS.register("ruby_block", RubyBlock::new);
public static final RegistryObject<Block> RUBY_ORE = BLOCKS.register("ruby_ore", RubyOre::new);
// Block Items
public static final RegistryObject<Item> RUBY_BLOCK_ITEM = ITEMS.register("ruby_block", () -> new BlockItem(RUBY_BLOCK.get(), new Item.Properties().group(Tutorial.TAB)));
public static final RegistryObject<Item> RUBY_ORE_ITEM = ITEMS.register("ruby_ore", () -> new BlockItem(RUBY_ORE.get(), new Item.Properties().group(Tutorial.TAB)));
}

@ -1,4 +1,4 @@
package com.technovision.tutorial.world;
package com.technovision.tutorial.world.gen;
import com.technovision.tutorial.Tutorial;
import com.technovision.tutorial.util.RegistryHandler;
@ -28,15 +28,15 @@ public class ModOreGen {
//World Generation
if (biome.getCategory() == Biome.Category.NETHER) {
genOre(biome, 15, 20, 5, 50, OreFeatureConfig.FillerBlockType.NETHERRACK, RegistryHandler.RUBY_BLOCK.get().getDefaultState(), 6);
genOre(biome, 15, 20, 5, 50, OreFeatureConfig.FillerBlockType.NETHERRACK, RegistryHandler.RUBY_ORE.get().getDefaultState(), 6);
//End Generation
//End Generation
} else if (biome.getCategory() == Biome.Category.THEEND) {
genOre(biome, 15, 5, 5, 80, END_STONE, RegistryHandler.RUBY_BLOCK.get().getDefaultState(), 8);
genOre(biome, 15, 5, 5, 80, END_STONE, RegistryHandler.RUBY_ORE.get().getDefaultState(), 8);
//Nether Generation
//Nether Generation
} else {
genOre(biome, 15, 5, 5, 80, OreFeatureConfig.FillerBlockType.NATURAL_STONE, RegistryHandler.RUBY_BLOCK.get().getDefaultState(), 12);
genOre(biome, 15, 5, 5, 80, OreFeatureConfig.FillerBlockType.NATURAL_STONE, RegistryHandler.RUBY_ORE.get().getDefaultState(), 12);
}
}
}

@ -0,0 +1,5 @@
{
"variants": {
"": { "model": "tutorial:block/ruby_ore" }
}
}

@ -2,6 +2,7 @@
"item.tutorial.ruby": "Ruby",
"item.tutorial.poison_apple": "Poison Apple",
"block.tutorial.ruby_block": "Block of Ruby",
"block.tutorial.ruby_ore": "Ruby Ore",
"itemGroup.tutorialTab": "Tutorial",
"item.tutorial.ruby_sword": "Ruby Sword",
"item.tutorial.ruby_pickaxe": "Ruby Pickaxe",

@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "tutorial:blocks/ruby_ore"
}
}

@ -0,0 +1,3 @@
{
"parent": "tutorial:block/ruby_ore"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 591 B

@ -0,0 +1,56 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:alternatives",
"children": [
{
"type": "minecraft:item",
"conditions": [
{
"condition": "minecraft:match_tool",
"predicate": {
"enchantments": [
{
"enchantment": "minecraft:silk_touch",
"levels": {
"min": 1
}
}
]
}
}
],
"name": "tutorial:ruby_ore"
},
{
"type": "minecraft:item",
"functions": [
{
"function": "minecraft:set_count",
"count": {
"min": 1,
"max": 2,
"type": "minecraft:uniform"
}
},
{
"function": "minecraft:apply_bonus",
"enchantment": "minecraft:fortune",
"formula": "minecraft:uniform_bonus_count",
"parameters": {
"bonusMultiplier": 1
}
}
],
"name": "tutorial:ruby"
}
]
}
]
}
]
}
Loading…
Cancel
Save