This repository has been archived by the owner on Jun 14, 2022. It is now read-only.
/
BlockCorporeaInterceptor.java
87 lines (73 loc) · 2.67 KB
/
BlockCorporeaInterceptor.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Apr 19, 2015, 6:18:03 PM (GMT)]
*/
package vazkii.botania.common.block.corporea;
import java.util.Random;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.common.block.tile.corporea.TileCorporeaBase;
import vazkii.botania.common.block.tile.corporea.TileCorporeaInterceptor;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
public class BlockCorporeaInterceptor extends BlockCorporeaBase implements ILexiconable {
public BlockCorporeaInterceptor() {
super(Material.iron, LibBlockNames.CORPOREA_INTERCEPTOR);
setHardness(5.5F);
setStepSound(soundTypeMetal);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.POWERED, false));
}
@Override
public BlockState createBlockState() {
return new BlockState(this, BotaniaStateProps.POWERED);
}
@Override
public int getMetaFromState(IBlockState state) {
return ((Boolean) state.getValue(BotaniaStateProps.POWERED)) ? 1 : 0;
}
@Override
public IBlockState getStateFromMeta(int meta) {
return getDefaultState().withProperty(BotaniaStateProps.POWERED, meta == 1);
}
@Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
world.setBlockState(pos, state.withProperty(BotaniaStateProps.POWERED, false), 1 | 2);
}
@Override
public boolean canProvidePower() {
return true;
}
@Override
public int getWeakPower(IBlockAccess world, BlockPos pos, IBlockState state, EnumFacing side) {
return ((Boolean) state.getValue(BotaniaStateProps.POWERED)) ? 15 : 0;
}
@Override
public int tickRate(World p_149738_1_) {
return 2;
}
@Override
public TileCorporeaBase createNewTileEntity(World world, int meta) {
return new TileCorporeaInterceptor();
}
@Override
public LexiconEntry getEntry(World world, BlockPos pos, EntityPlayer player, ItemStack lexicon) {
return LexiconData.corporeaInterceptor;
}
}