Posted February 8, 20178 yr i dont get it, my other blocks drop if they are destroyed even tho i didn´t write anything specially for it but my "eisenerz" wont. Spoiler package com.ramtin.mod.blocks; import java.util.Random; import com.ramtin.mod.Reference; import com.ramtin.mod.init.ModBlocks; import com.ramtin.mod.init.ModItems; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class BlockEisenerz extends Block { public BlockEisenerz() { super(Material.ROCK); setUnlocalizedName(Reference.MainclassBlocks.EISENERZ.getUnlocalizedName()); setRegistryName(Reference.MainclassBlocks.EISENERZ.getRegistryName()); setHardness(1.0F); setResistance(1.0F); } } Spoiler package com.ramtin.mod.world; import java.util.Random; import com.ramtin.mod.init.ModBlocks; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkGenerator; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.feature.WorldGenMinable; import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraftforge.fml.common.IWorldGenerator; public class OreGen implements IWorldGenerator { //0=Oberfläche 1=End -1=Nether @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) { Generate(WorldGenStrings.eisen, world, random, chunkX, chunkZ, 20, 0, 256, Blocks.STONE ); } public OreGen (){ WorldGenStrings.eisen = new WorldGenMinable(ModBlocks.eisenerz.getDefaultState(), 8); } private void Generate(WorldGenerator generator, World world, Random rand, int chunkX, int chunkZ, int chancesToSpawn, int minHeight, int maxHeight, Block generateIn){ if(minHeight < 0 || maxHeight> 256 || minHeight > maxHeight) throw new IllegalArgumentException("Fehlerhafte Höhenangabe für den World Generator"); int heightDiff = maxHeight - minHeight +1; for(int i = 0; i < chancesToSpawn; i++ ){ int x = chunkX * 16 + rand.nextInt(16); int y = minHeight + rand.nextInt(heightDiff); int z = chunkZ * 16 + rand.nextInt(16); generator.generate(world, rand, new BlockPos(x, y, z)); } } } Spoiler package com.ramtin.mod.init; import com.ramtin.mod.blocks.BlockEisenerz; import com.ramtin.mod.blocks.BlockSchwarzpulver; import com.ramtin.mod.blocks.BlockThermit; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraftforge.fml.common.registry.GameRegistry; public class ModBlocks { public static Block schwarzpulver; public static Block thermit; public static Block eisenerz; public static void init(){ schwarzpulver = new BlockSchwarzpulver(); thermit = new BlockThermit(); eisenerz = new BlockEisenerz(); } public static void register(){ registerBlock(schwarzpulver); registerBlock(thermit); registerBlock(eisenerz); } private static void registerBlock(Block block){ GameRegistry.register(block); ItemBlock item = new ItemBlock(block); item.setRegistryName(block.getRegistryName()); GameRegistry.register(item); } public static void registerRenders(){ registerRender(schwarzpulver); registerRender(thermit); registerRender(eisenerz); } private static void registerRender(Block block){ Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), "inventory")); }
February 8, 20178 yr Author 14 minutes ago, diesieben07 said: You set the material to be ROCK, which means that your block will require a tool. You did not set the tool class for your block however, so no tool will mine it. Set the tool class and harvest level by calling the setHarvestLevel method in your Block constructor. Thanks, that was it.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.