# Conflicts:
#	src/main/java/techreborn/blocks/generator/BlockCreativeSolarPanel.java
#	src/main/java/techreborn/blocks/generator/BlockWaterMill.java
#	src/main/java/techreborn/blocks/storage/BlockEnergyStorage.java
#	src/main/java/techreborn/blocks/storage/BlockLSUStorage.java
#	src/main/java/techreborn/blocks/transformers/BlockTransformer.java
This commit is contained in:
ProfessorProspector 2018-06-14 10:53:32 -07:00
commit cfda5fd2a4
9 changed files with 478 additions and 535 deletions

View file

@ -34,18 +34,14 @@ import net.minecraft.world.World;
import prospector.shootingstar.ShootingStar;
import prospector.shootingstar.model.ModelCompound;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.common.RebornCoreConfig;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.util.WorldUtils;
import techreborn.client.EGui;
import techreborn.utils.TechRebornCreativeTab;
import techreborn.lib.ModInfo;
import techreborn.tiles.TileQuantumChest;
import techreborn.tiles.TileTechStorageBase;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class BlockQuantumChest extends BlockMachineBase {
public BlockQuantumChest() {
@ -55,51 +51,6 @@ public class BlockQuantumChest extends BlockMachineBase {
ShootingStar.registerModel(new ModelCompound(ModInfo.MOD_ID, this, "machines/tier3_machines"));
}
@Override
public boolean isAdvanced() {
return true;
}
protected void dropChest(final World world, final BlockPos pos) {
final TileEntity tileEntity = world.getTileEntity(pos);
if (!(tileEntity instanceof TileTechStorageBase)) {
return;
}
final TileTechStorageBase inventory = (TileTechStorageBase) tileEntity;
final List<ItemStack> items = new ArrayList<>();
items.add(inventory.getDropWithNBT());
WorldUtils.dropItems(items, world, pos);
}
@Override
protected void dropInventory(World world, BlockPos pos) {
}
@Override
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
final TileEntity tileEntity = world.getTileEntity(pos);
if (!(tileEntity instanceof TileTechStorageBase)) {
super.getDrops(drops, world, pos, state, fortune);
} else {
final TileTechStorageBase tileEntity1 = (TileTechStorageBase) tileEntity;
drops.add(tileEntity1.getDropWithNBT());
}
}
@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
if(worldIn.getTileEntity(pos) != null){
dropChest(worldIn, pos);
}
worldIn.removeTileEntity(pos);
}
@Override
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
return Collections.emptyList();
}
@Override
public TileEntity createNewTileEntity(final World world, final int meta) {
return new TileQuantumChest();
@ -109,4 +60,25 @@ public class BlockQuantumChest extends BlockMachineBase {
public IMachineGuiHandler getGui() {
return EGui.QUANTUM_CHEST;
}
@Override
public boolean isAdvanced() {
return true;
}
@Override
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
/* if (RebornCoreConfig.wrenchRequired){
drops.add(isAdvanced() ? advancedFrameStack.copy() : basicFrameStack.copy());
}
else {
super.getDrops(drops, world, pos, state, fortune);
}*/
TileEntity storageTile = world.getTileEntity(pos);
if (storageTile != null && storageTile instanceof TileTechStorageBase) {
drops.addAll(((TileTechStorageBase) storageTile).getContentDrops());
}
super.getDrops(drops, world, pos, state, fortune);
}
}