-
Notifications
You must be signed in to change notification settings - Fork 755
/
CastingChannelBlock.java
93 lines (79 loc) · 2.48 KB
/
CastingChannelBlock.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
88
89
90
91
92
93
package tconstruct.blocks;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import tconstruct.blocks.logic.CastingChannelLogic;
import tconstruct.client.block.BlockRenderCastingChannel;
import tconstruct.library.TConstructRegistry;
/**
* @author BluSunrize
*/
public class CastingChannelBlock extends BlockContainer
{
public CastingChannelBlock()
{
super(Material.rock);
this.setHardness(1F);
this.setResistance(10);
this.stepSound = soundTypeStone;
setCreativeTab(TConstructRegistry.blockTab);
}
@Override
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
{
ItemStack stack = player.getCurrentEquippedItem();
CastingChannelLogic tile = (CastingChannelLogic) world.getTileEntity(x, y, z);
if (stack == null)
tile.changeOutputs(player, side, hitX, hitY, hitZ);
return true;
}
@Override
public void setBlockBoundsBasedOnState (IBlockAccess world, int x, int y, int z)
{
CastingChannelLogic tile = (CastingChannelLogic) world.getTileEntity(x, y, z);
float minX = 0.3125F;
float maxX = 0.6875F;
float minZ = 0.3125F;
float maxZ = 0.6875F;
minZ = 0F;
maxZ = 1F;
minX = 0F;
maxX = 1F;
this.setBlockBounds(minX, 0.375F, minZ, maxX, 0.625F, maxZ);
}
@Override
public boolean renderAsNormalBlock ()
{
return false;
}
@Override
public boolean isOpaqueCube ()
{
return false;
}
public boolean shouldSideBeRendered (IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{
return true;
}
@Override
public int getRenderType ()
{
return BlockRenderCastingChannel.renderID;
}
@Override
public void registerBlockIcons (IIconRegister iconRegister)
{
this.blockIcon = iconRegister.registerIcon("tinker:searedstone");
}
@Override
public TileEntity createNewTileEntity (World var1, int var2)
{
return new CastingChannelLogic();
}
}