aboutsummaryrefslogtreecommitdiff
path: root/src/Java/miscutil
diff options
context:
space:
mode:
authorDraknyte1 <Draknyte1@hotmail.com>2016-07-17 02:47:57 +1000
committerDraknyte1 <Draknyte1@hotmail.com>2016-07-17 02:47:57 +1000
commitc801794c1131302760c13dd7afd958d4319136e6 (patch)
tree86fb06565a485518305550dfbe6623ffeb1218fe /src/Java/miscutil
parent31720205fb218ee90e3a4b42d78fa002e2ccd636 (diff)
downloadGT5-Unofficial-c801794c1131302760c13dd7afd958d4319136e6.tar.gz
GT5-Unofficial-c801794c1131302760c13dd7afd958d4319136e6.tar.bz2
GT5-Unofficial-c801794c1131302760c13dd7afd958d4319136e6.zip
+ Added Effect Blocks for the Matter Fabricator.
Diffstat (limited to 'src/Java/miscutil')
-rw-r--r--src/Java/miscutil/core/block/ModBlocks.java9
-rw-r--r--src/Java/miscutil/core/block/general/LightGlass.java152
2 files changed, 161 insertions, 0 deletions
diff --git a/src/Java/miscutil/core/block/ModBlocks.java b/src/Java/miscutil/core/block/ModBlocks.java
index 10918c9d06..975a7317ad 100644
--- a/src/Java/miscutil/core/block/ModBlocks.java
+++ b/src/Java/miscutil/core/block/ModBlocks.java
@@ -1,7 +1,9 @@
package miscutil.core.block;
import miscutil.core.block.base.BasicBlock;
+import miscutil.core.block.general.LightGlass;
import miscutil.core.block.general.fluids.FluidRegistryHandler;
+import miscutil.core.lib.CORE;
import miscutil.core.util.Utils;
import miscutil.core.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks;
import net.minecraft.block.Block;
@@ -20,6 +22,8 @@ public final class ModBlocks {
public static Block blockHeliumGenerator;
public static Block blockNHG;
public static Block blockCharger;
+
+ public static Block MatterFabricatorEffectBlock;
public static Fluid fluidJackDaniels = new Fluid("fluidJackDaniels");
public static Block blockFluidJackDaniels;
@@ -42,6 +46,11 @@ public final class ModBlocks {
//Staballoy Block
GameRegistry.registerBlock(blockStaballoy = new BasicBlock("blockStaballoy", Material.iron), "blockStaballoy");
+
+ //GameRegistry.registerBlock(MatterFabricatorEffectBlock = new MatterFabricatorEffectBlock(), "blockMF_Effect");
+
+ GameRegistry.registerBlock(MatterFabricatorEffectBlock = new LightGlass(Material.glass, false).setHardness(0.1F).setBlockTextureName(CORE.MODID + ":" + "blockMFEffect").setStepSound(Block.soundTypeGlass), "blockMFEffect");
+
//Casing Blocks
blockCasingsMisc = new GregtechMetaCasingBlocks();
diff --git a/src/Java/miscutil/core/block/general/LightGlass.java b/src/Java/miscutil/core/block/general/LightGlass.java
new file mode 100644
index 0000000000..5183ec2398
--- /dev/null
+++ b/src/Java/miscutil/core/block/general/LightGlass.java
@@ -0,0 +1,152 @@
+package miscutil.core.block.general;
+
+import java.util.Random;
+
+import miscutil.core.creative.AddToCreativeTab;
+import miscutil.core.lib.CORE;
+import net.minecraft.block.BlockBreakable;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+public class LightGlass extends BlockBreakable
+{
+ private int state = 0;
+ private int a = 255;
+ private int r = 255;
+ private int g = 0;
+ private int b = 0;
+ private int hex;
+
+ public LightGlass(Material mat, boolean bool)
+ {
+ super("blockMFEffect", mat, bool);
+ this.setCreativeTab(AddToCreativeTab.tabBlock);
+ this.setBlockName("blockMFEffect");
+ this.setLightLevel(12F);
+ this.setLightOpacity(0);
+ this.setTickRandomly(true);
+ this.setResistance(1);
+ }
+
+ /**
+ * Returns the quantity of items to drop on block destruction.
+ */
+ @Override
+ public int quantityDropped(Random rand)
+ {
+ return 0;
+ }
+
+ /**
+ * Returns which pass should this block be rendered on. 0 for solids and 1 for alpha
+ */
+ @Override
+ @SideOnly(Side.CLIENT)
+ public int getRenderBlockPass()
+ {
+ return 0;
+ }
+
+ /**
+ * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
+ */
+ @Override
+ public boolean renderAsNormalBlock()
+ {
+ return true;
+ }
+
+ /**
+ * Return true if a player with Silk Touch can harvest this block directly, and not its normal drops.
+ */
+ @Override
+ protected boolean canSilkHarvest()
+ {
+ return false;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(IIconRegister iIcon)
+ {
+ this.blockIcon = iIcon.registerIcon(CORE.MODID + ":" + "blockMFEffect");
+ }
+
+ @Override
+ //http://stackoverflow.com/questions/31784658/how-can-i-loop-through-all-rgb-combinations-in-rainbow-order-in-java
+ public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
+ {
+ if(state == 0){
+ g++;
+ if(g == 255)
+ state = 1;
+ }
+ if(state == 1){
+ r--;
+ if(r == 0)
+ state = 2;
+ }
+ if(state == 2){
+ b++;
+ if(b == 255)
+ state = 3;
+ }
+ if(state == 3){
+ g--;
+ if(g == 0)
+ state = 4;
+ }
+ if(state == 4){
+ r++;
+ if(r == 255)
+ state = 5;
+ }
+ if(state == 5){
+ b--;
+ if(b == 0)
+ state = 0;
+ }
+ hex = (a << 24) + (r << 16) + (g << 8) + (b);
+ return hex;
+ }
+
+ /**
+ * A randomly called display update to be able to add particles or other items for display
+ */
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void randomDisplayTick(World world, int posX, int posY, int posZ, Random random)
+ {
+ int l = world.getBlockMetadata(posX, posY, posZ);
+ double d0 = (double)((float)posX + 0.5F);
+ double d1 = (double)((float)posY + 0.7F);
+ double d2 = (double)((float)posZ + 0.5F);
+ double d3 = 0.2199999988079071D;
+ double d4 = 0.27000001072883606D;
+
+ if (l == 1)
+ {
+ world.spawnParticle("smoke", d0 - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
+ }
+ else if (l == 2)
+ {
+ world.spawnParticle("cloud", d0 + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
+ }
+ else if (l == 3)
+ {
+ world.spawnParticle("smoke", d0, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D);
+ }
+ else if (l == 4)
+ {
+ world.spawnParticle("cloud", d0, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D);
+ }
+ else
+ {
+ world.spawnParticle("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D);
+ }
+ }
+} \ No newline at end of file