Migrated getDrops
This commit is contained in:
parent
bdb8834a3e
commit
bd00135137
14 changed files with 29 additions and 46 deletions
|
@ -25,12 +25,12 @@
|
|||
package techreborn.blocks;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.common.registration.RebornRegister;
|
||||
import reborncore.common.registration.impl.ConfigRegistry;
|
||||
import reborncore.common.util.OreDrop;
|
||||
|
@ -71,7 +71,7 @@ public class BlockOre extends Block {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
public void getDrops(IBlockState state, NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
|
||||
Block ore = state.getBlock();
|
||||
Random random = new Random();
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ import net.minecraft.init.Blocks;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -204,14 +205,12 @@ public class BlockRubberLog extends Block {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
List<ItemStack> drops = new ArrayList<>();
|
||||
public void getDrops(IBlockState state, NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
|
||||
drops.add(new ItemStack(this));
|
||||
if (state.getValue(HAS_SAP)) {
|
||||
if (new Random().nextInt(4) == 0) {
|
||||
drops.add(TRContent.Parts.SAP.getStack());
|
||||
}
|
||||
}
|
||||
return drops;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ public class BlockCable extends BlockContainer {
|
|||
|
||||
// Block
|
||||
@Override
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
public boolean onBlockActivated(IBlockState state, World worldIn, BlockPos pos, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
ItemStack stack = playerIn.getHeldItem(EnumHand.MAIN_HAND);
|
||||
TileEntity tileEntity = worldIn.getTileEntity(pos);
|
||||
|
||||
|
@ -145,7 +145,7 @@ public class BlockCable extends BlockContainer {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
return super.onBlockActivated(worldIn, pos, state, playerIn, hand, side, hitX, hitY, hitZ);
|
||||
return super.onBlockActivated(state, worldIn, pos, playerIn, hand, side, hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -186,16 +186,6 @@ public class BlockCable extends BlockContainer {
|
|||
return getStateFromMeta(meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return getDefaultState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
return false;
|
||||
|
|
|
@ -29,7 +29,6 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.common.RebornCoreConfig;
|
||||
|
@ -49,11 +48,11 @@ public class BlockAdjustableSU extends BlockEnergyStorage {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
public void getDrops(IBlockState state, NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
|
||||
if (RebornCoreConfig.wrenchRequired) {
|
||||
drops.add(new ItemStack(TRContent.MachineBlocks.INDUSTRIAL.getFrame()));
|
||||
} else {
|
||||
super.getDrops(drops, world, pos, state, fortune);
|
||||
super.getDrops(state, drops, world, pos, fortune);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,11 +51,11 @@ public class BlockHighVoltageSU extends BlockEnergyStorage {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockReader world, BlockPos pos, IBlockState state, int fortune) {
|
||||
public void getDrops(IBlockState state, NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
|
||||
if (RebornCoreConfig.wrenchRequired) {
|
||||
drops.add(new ItemStack(TRContent.MachineBlocks.ADVANCED.getFrame()));
|
||||
} else {
|
||||
super.getDrops(drops, world, pos, state, fortune);
|
||||
super.getDrops(state, drops, world, pos, fortune);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,11 +70,11 @@ public class BlockInterdimensionalSU extends BlockEnergyStorage {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
public void getDrops(IBlockState state, NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
|
||||
if (RebornCoreConfig.wrenchRequired) {
|
||||
drops.add(new ItemStack(TRContent.MachineBlocks.ADVANCED.getFrame()));
|
||||
} else {
|
||||
super.getDrops(drops, world, pos, state, fortune);
|
||||
super.getDrops(state, drops, world, pos, fortune);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,11 +108,11 @@ public class BlockLSUStorage extends BaseTileBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
public void getDrops(IBlockState state, NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
|
||||
if (RebornCoreConfig.wrenchRequired) {
|
||||
drops.add(new ItemStack(TRContent.MachineBlocks.BASIC.getFrame()));
|
||||
} else {
|
||||
super.getDrops(drops, world, pos, state, fortune);
|
||||
super.getDrops(state, drops, world, pos, fortune);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.common.RebornCoreConfig;
|
||||
|
@ -49,11 +48,11 @@ public class BlockLapotronicSU extends BlockEnergyStorage {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
public void getDrops(IBlockState state, NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
|
||||
if (RebornCoreConfig.wrenchRequired) {
|
||||
drops.add(new ItemStack(TRContent.MachineBlocks.ADVANCED.getFrame()));
|
||||
} else {
|
||||
super.getDrops(drops, world, pos, state, fortune);
|
||||
super.getDrops(state, drops, world, pos, fortune);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,11 +52,11 @@ public class BlockMediumVoltageSU extends BlockEnergyStorage {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
public void getDrops(IBlockState state, NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
|
||||
if (RebornCoreConfig.wrenchRequired) {
|
||||
drops.add(new ItemStack(TRContent.MachineBlocks.BASIC.getFrame()));
|
||||
} else {
|
||||
super.getDrops(drops, world, pos, state, fortune);
|
||||
super.getDrops(state, drops, world, pos, fortune);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ package techreborn.blocks.tier0;
|
|||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -37,8 +38,6 @@ import reborncore.common.blocks.BlockMachineBase;
|
|||
import techreborn.TechReborn;
|
||||
import techreborn.client.EGui;
|
||||
import techreborn.tiles.machine.iron.TileIronAlloyFurnace;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockIronAlloyFurnace extends BlockMachineBase {
|
||||
|
||||
|
@ -58,9 +57,7 @@ public class BlockIronAlloyFurnace extends BlockMachineBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(final IBlockAccess world, final BlockPos pos, final IBlockState state, final int fortune) {
|
||||
final List<ItemStack> items = new ArrayList<>();
|
||||
items.add(new ItemStack(this));
|
||||
return items;
|
||||
public void getDrops(IBlockState state, NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
|
||||
drops.add(new ItemStack(this));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
|
@ -100,9 +101,7 @@ public class BlockIronFurnace extends BlockMachineBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(final IBlockAccess world, final BlockPos pos, final IBlockState state, final int fortune) {
|
||||
final List<ItemStack> items = new ArrayList<>();
|
||||
items.add(new ItemStack(this));
|
||||
return items;
|
||||
public void getDrops(IBlockState state, NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
|
||||
drops.add(new ItemStack(this));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.common.RebornCoreConfig;
|
||||
|
@ -51,7 +50,7 @@ public class BlockHVTransformer extends BlockTransformer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, final IBlockAccess world, final BlockPos pos, final IBlockState state, final int fortune) {
|
||||
public void getDrops(IBlockState state, NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
|
||||
if (RebornCoreConfig.wrenchRequired){
|
||||
drops.add(new ItemStack(TRContent.MachineBlocks.ADVANCED.getFrame()));
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.common.RebornCoreConfig;
|
||||
|
@ -51,7 +50,7 @@ public class BlockMVTransformer extends BlockTransformer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, final IBlockAccess world, final BlockPos pos, final IBlockState state, final int fortune) {
|
||||
public void getDrops(IBlockState state, NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
|
||||
if (RebornCoreConfig.wrenchRequired){
|
||||
drops.add(new ItemStack(TRContent.MachineBlocks.BASIC.getFrame()));
|
||||
}
|
||||
|
|
|
@ -27,6 +27,8 @@ package techreborn.events;
|
|||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.tags.Tag;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -98,7 +100,7 @@ public class BlockBreakHandler {
|
|||
for (int i = 1; i < 10; i++) {
|
||||
BlockPos nextPos = pos.up(i);
|
||||
IBlockState nextState = worldIn.getBlockState(nextPos);
|
||||
if(nextState.getBlock().isWood(worldIn, nextPos)){
|
||||
if(nextState.getBlock().isIn(BlockTags.LOGS)){
|
||||
blocks ++;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue