ActuallyAdditions/src/main/java/de/ellpeck/actuallyadditions/common/blocks/BlockCanolaPress.java

55 lines
1.8 KiB
Java
Raw Normal View History

2020-09-09 16:49:01 +02:00
package de.ellpeck.actuallyadditions.common.blocks;
2015-04-26 20:07:57 +02:00
2020-09-09 16:49:01 +02:00
import de.ellpeck.actuallyadditions.common.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.common.tile.TileEntityCanolaPress;
2020-09-09 18:16:41 +02:00
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
2015-04-26 20:07:57 +02:00
import net.minecraft.tileentity.TileEntity;
2020-09-09 18:16:41 +02:00
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
2016-03-18 23:47:22 +01:00
import net.minecraft.util.math.BlockPos;
2020-09-09 18:16:41 +02:00
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.world.IBlockReader;
2015-04-26 20:07:57 +02:00
import net.minecraft.world.World;
2020-09-09 18:16:41 +02:00
import javax.annotation.Nullable;
2015-04-26 20:07:57 +02:00
2019-05-02 09:10:29 +02:00
public class BlockCanolaPress extends BlockContainerBase {
2015-04-26 20:07:57 +02:00
public BlockCanolaPress() {
2020-09-09 17:47:51 +02:00
super(STONE_PROPS);
2015-04-26 20:07:57 +02:00
}
2020-09-09 18:16:41 +02:00
// @Override
// public boolean isFullCube(IBlockState state) {
// return false;
// }
//
// @Override
// public boolean isOpaqueCube(IBlockState state) {
// return false;
// }
2016-08-17 15:28:53 +02:00
2020-09-09 18:16:41 +02:00
@Nullable
2015-04-26 20:07:57 +02:00
@Override
2020-09-09 18:16:41 +02:00
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
2015-05-20 22:39:43 +02:00
return new TileEntityCanolaPress();
2015-04-26 20:07:57 +02:00
}
@Override
2020-09-09 18:16:41 +02:00
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
2019-05-02 09:10:29 +02:00
if (!world.isRemote) {
TileEntityCanolaPress press = (TileEntityCanolaPress) world.getTileEntity(pos);
if (press != null) {
if (!this.tryUseItemOnTank(player, hand, press.tank)) {
2020-09-09 18:16:41 +02:00
// todo: add back
// player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.CANOLA_PRESS.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
}
2015-10-02 16:48:01 +02:00
}
2020-09-09 18:16:41 +02:00
return ActionResultType.SUCCESS;
2015-05-20 22:39:43 +02:00
}
2020-09-09 18:16:41 +02:00
return super.onBlockActivated(state, world, pos, player, hand, hit);
2015-04-26 20:07:57 +02:00
}
}