Last active
March 5, 2016 09:08
-
-
Save sirsavary/4e02e81713d8c611a596 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import com.mordrum.metallurgy.Metal; | |
| import com.mordrum.metallurgy.mMetals; | |
| import net.malisis.core.block.BoundingBoxType; | |
| import net.malisis.core.block.MalisisBlock; | |
| import net.malisis.core.block.component.DirectionalComponent; | |
| import net.malisis.core.util.AABBUtils; | |
| import net.minecraft.block.Block; | |
| import net.minecraft.block.material.Material; | |
| import net.minecraft.block.state.IBlockState; | |
| import net.minecraft.entity.Entity; | |
| import net.minecraft.item.Item; | |
| import net.minecraft.util.AxisAlignedBB; | |
| import net.minecraft.util.BlockPos; | |
| import net.minecraft.world.World; | |
| import java.util.List; | |
| import java.util.Random; | |
| public class OreBlock extends MalisisBlock { | |
| private final Metal metal; | |
| private final String name; | |
| public OreBlock(Metal metal) { | |
| super(Material.rock); | |
| this.metal = metal; | |
| this.name = (metal.name + "_ore").toLowerCase(); | |
| this.setStepSound(Block.soundTypeStone); | |
| this.setCreativeTab(mMetals.oresTab); | |
| this.setHarvestLevel("pickaxe", metal.blockLvl); | |
| this.setUnlocalizedName(this.name); | |
| this.setHardness(4.0f); // Time to mine | |
| this.setResistance(2.0f); // Explosion resistance | |
| } | |
| @Override | |
| public void addCollisionBoxesToList(World world, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) { | |
| AxisAlignedBB[] aabbs = getBoundingBoxes(world, pos, BoundingBoxType.COLLISION); | |
| aabbs = AABBUtils.rotate(aabbs, DirectionalComponent.getDirection(state)); | |
| for (AxisAlignedBB aabb : AABBUtils.offset(pos, aabbs)) { | |
| if (aabb != null && mask.intersectsWith(aabb)) | |
| list.add(aabb); | |
| } | |
| } | |
| public String getName() { | |
| return name; | |
| } | |
| public Metal getMetal() { | |
| return metal; | |
| } | |
| @Override | |
| public Item getItemDropped(IBlockState metadata, Random random, int fortune) { | |
| return Item.getItemFromBlock(Block.getBlockById(1)); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment