2016-09-14 21:42:03 +02:00
|
|
|
/*
|
|
|
|
* This file ("BlockBioReactor.java") is part of the Actually Additions mod for Minecraft.
|
|
|
|
* It is created and owned by Ellpeck and distributed
|
|
|
|
* under the Actually Additions License to be found at
|
|
|
|
* http://ellpeck.de/actaddlicense
|
|
|
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
|
|
*
|
2017-01-01 16:23:26 +01:00
|
|
|
* © 2015-2017 Ellpeck
|
2016-09-14 21:42:03 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
|
|
|
|
|
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
|
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|
|
|
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
|
|
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBioReactor;
|
2021-02-27 21:24:26 +01:00
|
|
|
import net.minecraft.block.BlockState;
|
2016-09-14 21:42:03 +02:00
|
|
|
import net.minecraft.block.SoundType;
|
|
|
|
import net.minecraft.block.material.Material;
|
2021-02-26 22:15:48 +01:00
|
|
|
import net.minecraft.entity.player.PlayerEntity;
|
2021-02-27 21:24:26 +01:00
|
|
|
import net.minecraft.entity.player.ServerPlayerEntity;
|
2016-09-14 21:42:03 +02:00
|
|
|
import net.minecraft.tileentity.TileEntity;
|
2021-02-27 21:24:26 +01:00
|
|
|
import net.minecraft.util.ActionResultType;
|
2021-02-26 22:15:48 +01:00
|
|
|
import net.minecraft.util.Hand;
|
2016-09-14 21:42:03 +02:00
|
|
|
import net.minecraft.util.math.BlockPos;
|
2021-02-27 21:24:26 +01:00
|
|
|
import net.minecraft.util.math.BlockRayTraceResult;
|
|
|
|
import net.minecraft.world.IBlockReader;
|
2016-09-14 21:42:03 +02:00
|
|
|
import net.minecraft.world.World;
|
2021-02-27 21:24:26 +01:00
|
|
|
import net.minecraftforge.common.ToolType;
|
|
|
|
import net.minecraftforge.fml.network.NetworkHooks;
|
2016-09-14 21:42:03 +02:00
|
|
|
|
2019-05-02 09:10:29 +02:00
|
|
|
public class BlockBioReactor extends BlockContainerBase {
|
2016-09-14 21:42:03 +02:00
|
|
|
|
2021-02-27 13:24:45 +01:00
|
|
|
public BlockBioReactor() {
|
2021-02-27 21:24:26 +01:00
|
|
|
super(Properties.create(Material.ROCK).harvestTool(ToolType.PICKAXE).hardnessAndResistance(2.0F, 10.0F).sound(SoundType.STONE));
|
2016-09-14 21:42:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2021-02-27 21:24:26 +01:00
|
|
|
public TileEntity createNewTileEntity(IBlockReader worldIn) {
|
2016-09-14 21:42:03 +02:00
|
|
|
return new TileEntityBioReactor();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2021-02-27 21:24:26 +01: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) {
|
2021-02-27 21:24:26 +01:00
|
|
|
TileEntity tileEntity = world.getTileEntity(pos);
|
|
|
|
if (tileEntity instanceof TileEntityBioReactor) {
|
|
|
|
NetworkHooks.openGui((ServerPlayerEntity) player, tileEntity, pos);
|
2018-05-10 11:38:58 +02:00
|
|
|
player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.BIO_REACTOR.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
2016-09-14 21:42:03 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|