Fix block break
This commit is contained in:
parent
25f06384f4
commit
20a385f6ca
1 changed files with 9 additions and 76 deletions
|
@ -27,12 +27,10 @@ package techreborn.blocks;
|
|||
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.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import reborncore.common.blocks.PropertyString;
|
||||
import reborncore.common.registration.RebornRegister;
|
||||
import reborncore.common.registration.impl.ConfigRegistry;
|
||||
import reborncore.common.util.OreDrop;
|
||||
|
@ -45,7 +43,6 @@ import java.util.Random;
|
|||
@RebornRegister(modID = TechReborn.MOD_ID)
|
||||
public class BlockOre extends Block {
|
||||
|
||||
public static final PropertyString VARIANTS = getVarients();
|
||||
@ConfigRegistry(config = "misc", category = "blocks", key = "rubyMinQuatity", comment = "Minimum quantity of Ruby gems per Ruby ore")
|
||||
public static int rubyMinQuatity = 1;
|
||||
@ConfigRegistry(config = "misc", category = "blocks", key = "rubyMaxQuantity", comment = "Maximum quantity of Ruby gems per Ruby ore")
|
||||
|
@ -78,98 +75,34 @@ public class BlockOre extends Block {
|
|||
setHarvestLevel("pickaxe", 2);
|
||||
}
|
||||
|
||||
// public static ItemStack getOreByName(String name, int count) {
|
||||
// name = OreBlockStateManager.invert(name);
|
||||
// for (int i = 0; i < ores.length; i++) {
|
||||
// if (ores[i].equalsIgnoreCase(name)) {
|
||||
// return new ItemStack(ModBlocks.ORE, count, i);
|
||||
// }
|
||||
// }
|
||||
// return BlockOre2.getOreByName(name, count);
|
||||
// }
|
||||
|
||||
// public static ItemStack getOreByName(String name) {
|
||||
// return getOreByName(name, 1);
|
||||
// }
|
||||
|
||||
// public IBlockState getBlockStateFromName(String name) {
|
||||
// name = OreBlockStateManager.invert(name);
|
||||
// int index = -1;
|
||||
// for (int i = 0; i < ores.length; i++) {
|
||||
// if (ores[i].equalsIgnoreCase(name)) {
|
||||
// index = i;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if (index == -1) {
|
||||
// return ModBlocks.ORE2.getBlockStateFromName(name);
|
||||
// }
|
||||
// return getStateFromMeta(index);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
String variant = state.getValue(VARIANTS);
|
||||
int meta = getMetaFromState(state);
|
||||
Block ore = state.getBlock();
|
||||
Random random = new Random();
|
||||
|
||||
// Secondary drop, like peridot from sapphire ore added via event handler.
|
||||
if (variant.equalsIgnoreCase("Ruby")) {
|
||||
// Secondary drop, like Yellow Garnet from Sphalerite ore added via event handler.
|
||||
if (ore == TRContent.Ores.RUBY.block) {
|
||||
OreDrop ruby = new OreDrop(TRContent.Gems.RUBY.getStack(rubyMinQuatity), rubyMaxQuantity);
|
||||
drops.add(ruby.getDrops(fortune, random));
|
||||
} else if (variant.equalsIgnoreCase("Sapphire")) {
|
||||
} else if (ore == TRContent.Ores.SAPPHIRE.block) {
|
||||
OreDrop sapphire = new OreDrop(TRContent.Gems.SAPPHIRE.getStack(sapphireMinQuantity), sapphireMaxQuantity);
|
||||
drops.add(sapphire.getDrops(fortune, random));
|
||||
} else if (variant.equalsIgnoreCase("Pyrite")) {
|
||||
} else if (ore == TRContent.Ores.PYRITE.block) {
|
||||
OreDrop pyriteDust = new OreDrop(TRContent.Dusts.PYRITE.getStack(pyriteMinQuatity), pyriteMaxQuantity);
|
||||
drops.add(pyriteDust.getDrops(fortune, random));
|
||||
} else if (variant.equalsIgnoreCase("Sodalite")) {
|
||||
} else if (ore == TRContent.Ores.SODALITE.block) {
|
||||
OreDrop sodalite = new OreDrop(TRContent.Dusts.SODALITE.getStack(sodaliteMinQuatity), sodaliteMaxQuantity);
|
||||
drops.add(sodalite.getDrops(fortune, random));
|
||||
} else if (variant.equalsIgnoreCase("Cinnabar")) {
|
||||
} else if (ore == TRContent.Ores.CINNABAR.block) {
|
||||
OreDrop cinnabar = new OreDrop(TRContent.Dusts.CINNABAR.getStack(cinnabarMinQuatity), cinnabarMaxQuantity);
|
||||
drops.add(cinnabar.getDrops(fortune, random));
|
||||
} else if (variant.equalsIgnoreCase("Sphalerite")) {
|
||||
} else if (ore == TRContent.Ores.SPHALERITE.block) {
|
||||
OreDrop sphalerite = new OreDrop(TRContent.Dusts.SPHALERITE.getStack(sphaleriteMinQuatity), sphaleriteMaxQuantity);
|
||||
drops.add(sphalerite.getDrops(fortune, random));
|
||||
} else {
|
||||
drops.add(new ItemStack(Item.getItemFromBlock(this), 1, meta));
|
||||
drops.add(new ItemStack(this));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canSilkHarvest() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
||||
// return new ItemStack(this, 1, getMetaFromState(state));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int damageDropped(IBlockState state) {
|
||||
// return getMetaFromState(state);
|
||||
// }
|
||||
|
||||
//
|
||||
// @Override
|
||||
// protected BlockStateContainer createBlockState() {
|
||||
// return new BlockStateContainer(this, VARIANTS);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
public static PropertyString getVarients() {
|
||||
// if (OreBlockStateManager.endOreStone) {
|
||||
// oreNamesList = BlockOre.oreNamesList.stream().map(OreBlockStateManager::convert).collect(Collectors.toList());
|
||||
// return new PropertyString("type", oreNamesList);
|
||||
// } else {
|
||||
// return new PropertyString("type", BlockOre.oreNamesList);
|
||||
// }
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue