Updated onBlockActivated

This commit is contained in:
drcrazy 2019-02-21 13:35:54 +03:00
parent 8489259672
commit bdb8834a3e
13 changed files with 31 additions and 127 deletions

View file

@ -24,11 +24,8 @@
package techreborn.blocks.tier1;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -40,25 +37,10 @@ import techreborn.tiles.machine.tier1.TileAutoCraftingTable;
public class BlockAutoCraftingTable extends BlockMachineBase {
public BlockAutoCraftingTable() {
super(true);
super();
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this, "machines/tier1_machines"));
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this);
}
@Override
public int getMetaFromState(IBlockState state) {
return 0;
}
@Override
public IBlockState getStateFromMeta(int meta) {
return getDefaultState();
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
return new TileAutoCraftingTable();

View file

@ -94,13 +94,12 @@ public class BlockPlayerDetector extends BlockMachineBase {
}
@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);
if (tileEntity == null) {
return super.onBlockActivated(worldIn, pos, state, playerIn, hand, side, hitX, hitY, hitZ);
return super.onBlockActivated(state, worldIn, pos, playerIn, hand, side, hitX, hitY, hitZ);
}
String type = state.getValue(TYPE);
@ -152,19 +151,6 @@ public class BlockPlayerDetector extends BlockMachineBase {
return new BlockStateContainer(this, TYPE);
}
@Override
public IBlockState getStateFromMeta(int meta) {
if (meta > types.length) {
meta = 0;
}
return getBlockState().getBaseState().with(TYPE, typeNamesList.get(meta));
}
@Override
public int getMetaFromState(IBlockState state) {
return typeNamesList.indexOf(state.getValue(TYPE));
}
@Override
public IMachineGuiHandler getGui() {
return null;