diff options
| author | Foghrye4 <foghrye4@gmail.com> | 2017-03-21 17:34:07 +0300 |
|---|---|---|
| committer | Foghrye4 <foghrye4@gmail.com> | 2017-03-21 17:34:07 +0300 |
| commit | 7305ba719930ea3fbf8aa987aeec48b33cdbd82e (patch) | |
| tree | 2307517925d965cd9228c8649013b07639987846 /ihl/enviroment/LightBulbBlock.java | |
| parent | 5cb4c6e24033cf337812390d99a6817d24d21eab (diff) | |
Oregen
Diffstat (limited to 'ihl/enviroment/LightBulbBlock.java')
| -rw-r--r-- | ihl/enviroment/LightBulbBlock.java | 185 |
1 files changed, 85 insertions, 100 deletions
diff --git a/ihl/enviroment/LightBulbBlock.java b/ihl/enviroment/LightBulbBlock.java index d78b667..77ee8f8 100644 --- a/ihl/enviroment/LightBulbBlock.java +++ b/ihl/enviroment/LightBulbBlock.java @@ -13,30 +13,26 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
-public class LightBulbBlock extends Block implements ITileEntityProvider
-{
+public class LightBulbBlock extends Block implements ITileEntityProvider {
public static GlowningAirBlock glowningAir;
-
- public LightBulbBlock(String unlocalizedName1)
- {
- super(Material.glass);
- this.setStepSound(soundTypeGlass);
+
+ public LightBulbBlock(String unlocalizedName1) {
+ super(Material.glass);
+ this.setStepSound(soundTypeGlass);
this.setBlockName(unlocalizedName1);
- GameRegistry.registerBlock(this,IHLItemBlock.class, unlocalizedName1);
- this.setHardness(0.3F);
- this.setResistance(0.5F);
- this.setCreativeTab(IHLCreativeTab.tab);
- this.setBlockTextureName("glass");
- }
-
+ GameRegistry.registerBlock(this, IHLItemBlock.class, unlocalizedName1);
+ this.setHardness(0.3F);
+ this.setResistance(0.5F);
+ this.setCreativeTab(IHLCreativeTab.tab);
+ this.setBlockTextureName("glass");
+ }
+
@Override
- public boolean hasTileEntity(int metadata)
- {
- return true;
+ public boolean hasTileEntity(int metadata) {
+ return true;
}
-
- public static void init()
- {
+
+ public static void init() {
glowningAir = new GlowningAirBlock();
new LightBulbBlock("lightBulb");
new SpotlightBlock("spotlight");
@@ -46,88 +42,77 @@ public class LightBulbBlock extends Block implements ITileEntityProvider SpotlightTileEntity.createLightSphereVectors();
}
- /**
- * Returns the quantity of items to drop on block destruction.
- */
- @Override
- public int quantityDropped(Random random)
- {
- return 0;
- }
-
- @Override
- public boolean renderAsNormalBlock()
- {
- return false;
- }
-
- /**
- * The type of render function that is called for this block
- */
- @Override
- public int getRenderType()
- {
- return -2;
- }
-
- @Override
- public void setBlockBoundsBasedOnState(IBlockAccess iBlockAccess, int x, int y, int z)
- {
- TileEntity te = iBlockAccess.getTileEntity(x, y, z);
- if(te!=null && te instanceof LightBulbTileEntity)
- {
- LightBulbTileEntity ate = (LightBulbTileEntity) te;
- setBlockBoundsBasedOnFacing(ate.getFacing());
- }
- }
-
- private void setBlockBoundsBasedOnFacing(int facing)
- {
- int var2 = facing & 7;
- float var6 = 0.1875F;
- float var7 = 0.5F;
-
- if (var2 == 0)
- {
- this.setBlockBounds(0.5F - var6, 1.0F - var7, 0.5F - var6, 0.5F + var6, 1.0F, 0.5F + var6);
- }
- else if (var2 == 1)
- {
- this.setBlockBounds(0.5F - var6, 0.0F, 0.5F - var6, 0.5F + var6, var7, 0.5F + var6);
- }
- else if (var2 == 2)
- {
- this.setBlockBounds(0.5F - var6, 0.5F - var6, 1.0F - var7, 0.5F + var6, 0.5F + var6, 1.0F);
- }
- else if (var2 == 3)
- {
- this.setBlockBounds(0.5F - var6, 0.5F - var6, 0.0F, 0.5F + var6, 0.5F + var6, var7);
- }
- else if (var2 == 4)
- {
- this.setBlockBounds(1.0F - var7, 0.5F - var6, 0.5F - var6, 1.0F, 0.5F + var6, 0.5F + var6);
- }
- else if (var2 == 5)
- {
- this.setBlockBounds(0.0F, 0.5F - var6, 0.5F - var6, var7, 0.5F + var6, 0.5F + var6);
- }
- }
-
- @Override
- public boolean isOpaqueCube()
- {
- return false;
- }
-
- @Override
- public boolean isNormalCube()
- {
- return false;
- }
+ /**
+ * Returns the quantity of items to drop on block destruction.
+ */
+ @Override
+ public int quantityDropped(Random random) {
+ return 0;
+ }
+
+ @Override
+ public boolean renderAsNormalBlock() {
+ return false;
+ }
+
+ /**
+ * The type of render function that is called for this block
+ */
+ @Override
+ public int getRenderType() {
+ return -2;
+ }
+
+ @Override
+ public void setBlockBoundsBasedOnState(IBlockAccess iBlockAccess, int x, int y, int z) {
+ TileEntity te = iBlockAccess.getTileEntity(x, y, z);
+ if (te != null && te instanceof LightBulbTileEntity) {
+ LightBulbTileEntity ate = (LightBulbTileEntity) te;
+ setBlockBoundsBasedOnFacing(ate.getFacing());
+ }
+ }
+
+ private void setBlockBoundsBasedOnFacing(int facing) {
+ int var2 = facing & 7;
+ float var6 = 0.1875F;
+ float var7 = 0.5F;
+
+ if (var2 == 0) {
+ this.setBlockBounds(0.5F - var6, 1.0F - var7, 0.5F - var6, 0.5F + var6, 1.0F, 0.5F + var6);
+ } else if (var2 == 1) {
+ this.setBlockBounds(0.5F - var6, 0.0F, 0.5F - var6, 0.5F + var6, var7, 0.5F + var6);
+ } else if (var2 == 2) {
+ this.setBlockBounds(0.5F - var6, 0.5F - var6, 1.0F - var7, 0.5F + var6, 0.5F + var6, 1.0F);
+ } else if (var2 == 3) {
+ this.setBlockBounds(0.5F - var6, 0.5F - var6, 0.0F, 0.5F + var6, 0.5F + var6, var7);
+ } else if (var2 == 4) {
+ this.setBlockBounds(1.0F - var7, 0.5F - var6, 0.5F - var6, 1.0F, 0.5F + var6, 0.5F + var6);
+ } else if (var2 == 5) {
+ this.setBlockBounds(0.0F, 0.5F - var6, 0.5F - var6, var7, 0.5F + var6, 0.5F + var6);
+ }
+ }
@Override
- public TileEntity createNewTileEntity(World arg0, int arg1)
- {
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ @Override
+ public boolean isNormalCube() {
+ return false;
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World arg0, int arg1) {
return new LightBulbTileEntity();
}
+
+ public int getLightValue(IBlockAccess world, int x, int y, int z) {
+ TileEntity te = world.getTileEntity(x, y, z);
+ if (te != null && te instanceof LightBulbTileEntity) {
+ LightBulbTileEntity ate = (LightBulbTileEntity) te;
+ return ate.getActive() ? 15 : 0;
+ }
+ return 0;
+ }
}
|
