2017-05-25 17:49:06 +02:00
|
|
|
/*
|
|
|
|
* This file is part of Industrial Wires.
|
|
|
|
* Copyright (C) 2016-2017 malte0811
|
|
|
|
*
|
|
|
|
* Industrial Wires is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Industrial Wires is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with Industrial Wires. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
package malte0811.industrialWires.blocks;
|
|
|
|
|
2017-08-13 18:46:46 +02:00
|
|
|
import malte0811.industrialWires.util.MiscUtils;
|
2017-05-25 17:49:06 +02:00
|
|
|
import net.minecraft.block.material.Material;
|
|
|
|
import net.minecraft.block.state.IBlockState;
|
2017-08-13 18:46:46 +02:00
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.item.ItemStack;
|
2017-05-25 17:49:06 +02:00
|
|
|
import net.minecraft.tileentity.TileEntity;
|
2017-08-13 18:46:46 +02:00
|
|
|
import net.minecraft.util.NonNullList;
|
2017-05-25 17:49:06 +02:00
|
|
|
import net.minecraft.util.math.BlockPos;
|
2017-08-13 18:46:46 +02:00
|
|
|
import net.minecraft.util.math.RayTraceResult;
|
|
|
|
import net.minecraft.world.IBlockAccess;
|
2017-05-25 17:49:06 +02:00
|
|
|
import net.minecraft.world.World;
|
|
|
|
|
|
|
|
import javax.annotation.Nonnull;
|
|
|
|
|
|
|
|
public abstract class BlockIWMultiblock extends BlockIWBase {
|
|
|
|
public BlockIWMultiblock(Material mat, String name) {
|
|
|
|
super(mat, name);
|
|
|
|
}
|
|
|
|
@Override
|
|
|
|
public void breakBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state) {
|
|
|
|
TileEntity te = world.getTileEntity(pos);
|
2017-08-13 18:46:46 +02:00
|
|
|
if(te instanceof TileEntityIWMultiblock) {
|
2017-05-25 17:49:06 +02:00
|
|
|
((TileEntityIWMultiblock)te).disassemble();
|
2017-08-13 18:46:46 +02:00
|
|
|
}
|
2017-05-25 17:49:06 +02:00
|
|
|
super.breakBlock(world, pos, state);
|
|
|
|
}
|
|
|
|
|
2017-08-13 18:46:46 +02:00
|
|
|
@Override
|
|
|
|
public void getDrops(@Nonnull NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, @Nonnull IBlockState state, int fortune) {
|
|
|
|
//NOP
|
|
|
|
}
|
2017-08-07 22:03:07 +02:00
|
|
|
|
2017-05-25 17:49:06 +02:00
|
|
|
@Override
|
2017-08-07 22:03:07 +02:00
|
|
|
public boolean isTopSolid(IBlockState state) {
|
2017-05-25 17:49:06 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isOpaqueCube(IBlockState state) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isFullBlock(IBlockState state) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isFullCube(IBlockState state) {
|
|
|
|
return false;
|
|
|
|
}
|
2017-08-13 18:46:46 +02:00
|
|
|
|
|
|
|
@Nonnull
|
|
|
|
@Override
|
|
|
|
public ItemStack getPickBlock(@Nonnull IBlockState state, RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos, EntityPlayer player) {
|
|
|
|
TileEntity te = world.getTileEntity(pos);
|
|
|
|
if (te instanceof TileEntityIWMultiblock) {
|
|
|
|
return MiscUtils.getItemStack(((TileEntityIWMultiblock) te).getOriginalBlock(), world, pos);
|
|
|
|
}
|
|
|
|
return ItemStack.EMPTY;
|
|
|
|
}
|
2017-05-25 17:49:06 +02:00
|
|
|
}
|