fixed fracture breaking bedrock, closes #35

This commit is contained in:
2016-10-18 20:27:53 +02:00
parent 4e8222a884
commit ae4aef454e
2 changed files with 13 additions and 9 deletions

View File

@@ -48,8 +48,6 @@ public class TAIGA {
public void preInit(FMLPreInitializationEvent e) {
proxy.initConfig();
System.out.println(String.format("init from TAIGA Version %s", VERSION));
Items.register(); // Registers items and its oreDict
Blocks.register(); // Registers blocks and its items form a long with its oreDict
Fluids.register(); // Registers all fluids and its buckets

View File

@@ -3,6 +3,7 @@ package com.sosnitzka.taiga.traits;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
@@ -28,33 +29,38 @@ public class TraitFracture extends AbstractTrait {
switch (mop.sideHit) {
case UP:
BlockPos next1 = new BlockPos(pos.getX(), pos.getY() - i, pos.getZ());
if (tool.canHarvestBlock(world.getBlockState(next1))) world.destroyBlock(next1, true);
if (tool.canHarvestBlock(world.getBlockState(next1)) && !world.getBlockState(next1).equals(Blocks.BEDROCK.getDefaultState()))
world.destroyBlock(next1, true);
break;
case DOWN:
BlockPos next2 = new BlockPos(pos.getX(), pos.getY() + i, pos.getZ());
if (tool.canHarvestBlock(world.getBlockState(next2))) world.destroyBlock(next2, true);
if (tool.canHarvestBlock(world.getBlockState(next2)) && !world.getBlockState(next2).equals(Blocks.BEDROCK.getDefaultState()))
world.destroyBlock(next2, true);
break;
case WEST:
BlockPos next3 = new BlockPos(pos.getX() + i, pos.getY(), pos.getZ());
if (tool.canHarvestBlock(world.getBlockState(next3))) world.destroyBlock(next3, true);
if (tool.canHarvestBlock(world.getBlockState(next3)) && !world.getBlockState(next3).equals(Blocks.BEDROCK.getDefaultState()))
world.destroyBlock(next3, true);
break;
case EAST:
BlockPos next4 = new BlockPos(pos.getX() - i, pos.getY(), pos.getZ());
if (tool.canHarvestBlock(world.getBlockState(next4))) world.destroyBlock(next4, true);
if (tool.canHarvestBlock(world.getBlockState(next4)) && !world.getBlockState(next4).equals(Blocks.BEDROCK.getDefaultState()))
world.destroyBlock(next4, true);
break;
case SOUTH:
BlockPos next5 = new BlockPos(pos.getX(), pos.getY(), pos.getZ() - i);
if (tool.canHarvestBlock(world.getBlockState(next5))) world.destroyBlock(next5, true);
if (tool.canHarvestBlock(world.getBlockState(next5)) && !world.getBlockState(next5).equals(Blocks.BEDROCK.getDefaultState()))
world.destroyBlock(next5, true);
break;
case NORTH:
BlockPos next6 = new BlockPos(pos.getX(), pos.getY() - i, pos.getZ() + i);
if (tool.canHarvestBlock(world.getBlockState(next6))) world.destroyBlock(next6, true);
if (tool.canHarvestBlock(world.getBlockState(next6)) && !world.getBlockState(next6).equals(Blocks.BEDROCK.getDefaultState()))
world.destroyBlock(next6, true);
break;
}
}
if (random.nextBoolean()) ToolHelper.damageTool(tool, random.nextInt(5), player);
}
}
private float calcBonus(ItemStack tool) {