Jump to content

[Solved][1.7.10] Strange phenomena, video


EmperorZelos

Recommended Posts

I have encountered a strange phenomena, I have included a video of it. I have an explosive block I can use that detonates when destroyed, no issue there. But I have also created coal dust that explodes upon ignition but it seems that afterward sometimes it is having a block there but it isn't visible and it is fighting with itself as I lag and when I place ANY block there it turns into a stone/ore block, what could cause it?

 

 

package aerosteam.gases;

import java.util.Random;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import aerosteam.AeroSteam;
import aerosteam.blocks.BlocksAS;
import aerosteam.blocks.BlocksGases;
import aerosteam.gas.Pipes;
import aerosteam.items.ItemsAS;
import aerosteam.proxy.ClientProxy;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFire;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.IIcon;
import net.minecraft.util.Vec3;
import net.minecraft.world.Explosion;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.BlockFluidClassic;
import net.minecraftforge.fluids.FluidStack;

public class Gases extends Block {
protected float density=100;
protected float viscosity=1000;
protected int tickRate=10;
protected boolean toxic = false;
protected int toxLevel = 100;
protected boolean lethal = false;
protected boolean harm = false;
protected boolean flammable = false;
protected boolean burning = false;
protected boolean source = false;
protected Block sourceTo = null;
protected boolean corrosive = false;
protected boolean explosive = false;
protected float explosion = 4;
protected boolean breathable = true;
protected int corrosion = 0;
protected String texture = "Gas";
protected int harmLevel = 1;
protected int decayRate = 1;
protected int decayDistance = 700;
public float red=0;
public float green=0;
public float blue=0;
public float fogdensity=0;
private EntityPlayer[] corrodingPlayers = new EntityPlayer[15];
private EntityLivingBase[] suffocatingEntity = new EntityLivingBase[15];

public Gases() {
	super(Material.iron);
	this.setTickRandomly(true);
	this.setResistance(0F);
	BlocksGases.nrGases++;
        this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
public Gases setDensity(float density)
    {
        this.density = density;
        if (this.density<0) this.density = 0;
        if (this.density>200) this.density = 200;
        return this;
    }
public float getDensity()
    {
        return this.density;
    }
public Gases setViscosity(float viscosity)
    {
        this.viscosity = viscosity;
        if (this.viscosity<100) this.viscosity = 100;
        if (this.viscosity>10000) this.viscosity = 10000;
        return this;
    }
public Gases setTexture(String text)
    {
        this.texture = text;
        return this;
    }
public float getViscosity()
    {
        return this.viscosity;
    }
public Gases setToxicityLevel(int level)
    {
        this.toxLevel = level;
        if (this.toxLevel<1) this.toxLevel = 1;
        if (this.toxLevel>20) this.toxLevel = 20;
        return this;
    }
public int getToxicLevel()
    {
        return this.toxLevel;
    }
public Gases setHarmLevel(int level)
    {
        this.harmLevel = level;
        if (this.harmLevel<1) this.harmLevel = 1;
        if (this.harmLevel>20) this.harmLevel = 20;
        return this;
    }
public int getHarmLevel()
    {
        return this.harmLevel;
    }
public Gases setToxic(boolean bool)
    {
        this.toxic = bool;
        return this;
    }
public boolean getToxicity()
    {
        return this.toxic;
    }
public Gases setExplosive(boolean bool)
    {
        this.explosive = bool;
        return this;
    }
public boolean getExplosive()
    {
        return this.explosive;
    }public Gases setExplosion(float power)
    {
        this.explosion = power;
        return this;
    }
public float getExplosion()
    {
        return this.explosion;
    }
public Gases setBreathable(boolean bool)
    {
        this.breathable = bool;
        return this;
    }
public boolean getBreathable()
    {
        return this.breathable;
    }
public Gases setDecay(int distance)
    {
        this.decayDistance = distance;
        double calcProb = 1000*(1-Math.exp(Math.log(0.5D)/distance));
        if (calcProb <1) calcProb = 1;
        this.decayRate = (int) Math.round(calcProb);
	System.out.println("Decay:" + this.decayRate);
        return this;
    }
public int getDecay()
    {
        return this.decayDistance;
    }
public Gases setFlammable(boolean bool)
    {
        this.flammable = bool;
        return this;
    }
public boolean getFlammable()
    {
        return this.flammable;
    }
public Gases setSource(boolean bool)
    {
	this.setCreativeTab(AeroSteam.gasTab);
        this.source = bool;
        if(bool) BlocksGases.nrGases--;
        return this;
    }
public boolean getSource()
    {
        return this.source;
    }
public Gases setSourceBlock(Block gas)
    {
	Gases gasen = (Gases) gas;
	this.setViscosity(gasen.getViscosity());
	this.setLethal(gasen.getLethality());
	this.setHarm(gasen.getHarmfull());
	this.setHarmLevel(gasen.getHarmLevel());
	this.setToxic(gasen.getToxicity());
	this.setToxicityLevel(gasen.getToxicLevel());
	this.setCorrosive(gasen.getCorrosive());
	this.setCorrosion(gasen.getCorrosion());
	this.setBreathable(gasen.getBreathable());
	this.setFlammable(gasen.getFlammable());
	this.setExplosive(gasen.getExplosive());
	this.setExplosion(gasen.getExplosion());
        this.sourceTo = gas;
        return this;
    }
public Block getSourceBlock()
    {
        return this.sourceTo;
    }
public Gases setCorrosive(boolean bool)
    {
        this.corrosive = bool;
        return this;
    }
public boolean getCorrosive()
    {
        return this.corrosive;
    }
public Gases setCorrosion(int corrosion)
    {
        this.corrosion = corrosion;
        if (this.corrosion<0) this.corrosion = 0;
        if (this.corrosion>100) this.corrosion = 100;
        return this;
    }
public int getCorrosion()
    {
        return this.corrosion;
    }
public Gases setLethal(boolean bool)
    {
        this.lethal = bool;
        return this;
    }
public boolean getLethality()
    {
        return this.lethal;
    }
public Gases setHarm(boolean bool)
    {
        this.harm = bool;
        return this;
    }
public boolean getHarmfull()
    {
        return this.harm;
    }
public Gases setBurn(boolean bool)
    {
        this.burning = bool;
        return this;
    }
//Fix
public Gases setFogColour(float red, float green, float blue)
    {
	this.red=red;
	this.green=green;
	this.blue=blue;
        return this;
    }
public Gases setFogDensity(float density)
    {
        //this.burning = bool;
	this.fogdensity=density;
        return this;
    }
public boolean getBurn()
    {
        return this.burning;
    }
@Override
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face)
    {
        return true;
    }
@Override
    public void onBlockAdded(World world, int x, int y, int z)
    {
	//world.setBlockMetadataWithNotify(x, y, z, RndInt(0,15), 2);
        world.scheduleBlockUpdate(x, y, z, this, (int) (this.viscosity/10));
    }
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityplayer,ItemStack itemstack){
	//world.setBlockMetadataWithNotify(x, y, z, 15, 2);
        world.scheduleBlockUpdate(x, y, z, this, (int) (this.viscosity/10));    	
    }

public int RndInt(int min, int max){
	Random generator = new Random(); 
	int rnd = generator.nextInt(max-min+1) + min;
	return rnd;
}
public float RndFloat(float min, float max){
	Random generator = new Random(); 
	float rnd = generator.nextFloat()*(max-min+1.0F) + min;
	return rnd;
}
private boolean itemCanIgnite(Item item){
	if (item ==  Item.getItemFromBlock(BlocksAS.deviceTorch)) return true;
	return false;
}
//will react hwen player is in the block
    public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
	//System.out.println("collide");
    	if(this.harm){
    		entity.attackEntityFrom(DamageSource.generic, this.harmLevel);
       	}
    	if(this.burning){
    		entity.setFire(10);
    		//player.addPotionEffect(new PotionEffect(Potion.wither.getId(),this.getToxicLevel()));
    	}
    	if (entity instanceof EntityPlayer){
		EntityPlayer player = (EntityPlayer) entity;
		ItemStack held = player.getCurrentEquippedItem();
		if (held != null){
			if (itemCanIgnite(held.getItem())){
		    	if (this.flammable){
					world.setBlock(x, y, z, BlocksGases.burningGas);
		    	}
		    	if (this.explosive){
    					explodeBlock(world,x,y,z);
		    	}
			}
		}
    	if (this.toxic){
    		if (this.lethal){
        			player.addPotionEffect(new PotionEffect(Potion.wither.getId(),this.getToxicLevel()));
    			}else{
        			player.addPotionEffect(new PotionEffect(Potion.poison.getId(),this.getToxicLevel()));    				
    			}
    	}
    	if(this.corrosive){
    		boolean found=false;
    			int insert=0;
    			for (int i=0; i<corrodingPlayers.length;i++){
    				if (corrodingPlayers[i]==player){
    					found=true;
    					break;
    				}
    				if (corrodingPlayers[i] == null){
    					insert=i;
    					break;
    				}
    			}
    			if (!found){
    				corrodingPlayers[insert] = player;
    			}
    	}
	}else if (this.toxic){
    		entity.attackEntityFrom(DamageSource.wither, 1);
	}
    
    	if(!this.breathable){
    		if (entity instanceof EntityLivingBase){
    			EntityLivingBase living = (EntityLivingBase) entity;
    			boolean found=false;
    			int insert=0;
    			for (int i=0; i<suffocatingEntity.length;i++){
    				if (suffocatingEntity[i]==living){
    					found=true;
    					break;
    				}
    				if (suffocatingEntity[i] == null){
    					insert=i;
    					break;
    				}
    			}
    			if (!found){
    				//System.out.println("added");
    				suffocatingEntity[insert] = living;
    			}
    			//player.inventory.mainInventory
    		}
    	}
    }
//Makes block pass through
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k)
    {
        return null;
    }
//makes block impossible to hit
public boolean canCollideCheck(int meta, boolean fullHit)
    {
        return fullHit && meta == 0;
    }
@Override
    public void onNeighborBlockChange(World world, int x, int y, int z, Block block)
    {
	//System.out.println("neighbour changed" + block.tickRate(world));
        world.scheduleBlockUpdate(x, y, z, this, (int) (this.viscosity/10));
        //this.stuck=world.getBlock(x, y+1, z) != Blocks.air;
        //block.updateTick(world, x, y, z, world.rand);
    }

public void igniteGas(World world, int x, int y, int z){
	for (gasDirection check: gasDirection.VALID_DIRECTIONS){
		int deltaXpos=x+check.offsetX;
		int deltaYpos=y+check.offsetY;
		int deltaZpos=z+check.offsetZ;
		Block block = world.getBlock(deltaXpos, deltaYpos, deltaZpos);
		if (canIgnite(block)){
			if(this.flammable){
				world.setBlock(x, y, z, BlocksGases.burningGas);
			}else if(this.explosive){
				explodeBlock(world,x,y,z);
			}
		}
	}
}
public void explodeBlock(World world, int x, int y, int z){
	float power = RndFloat(1,this.explosion);
	EntityItem splosion = new EntityItem(world,(double)x,(double)y,(double)z, new ItemStack(Blocks.dirt,1,0));
	world.setBlockToAir(x, y, z);
	world.spawnEntityInWorld(splosion);
	world.createExplosion(splosion, (double)x, (double)y, (double)z, power, true);
	world.removeEntity(splosion);
}
public boolean canIgnite(Block block){
	if (block==BlocksAS.deviceTorch) return true;
	if (block==BlocksAS.firePlace) return true;
	if (block==BlocksGases.burningGas) return true;
	if (block==Blocks.fire) return true;
	if (block==Blocks.lava) return true;
	return false;
}
@Override
    public void onBlockDestroyedByExplosion(World world, int x, int y, int z, Explosion boom) {
	if(this.explosive){
		explodeBlock(world,x,y,z);
	}
}

public void corrodeItem(){
	if(corrodingPlayers[0]!= null){
		for (int i=0;i<corrodingPlayers.length;i++){
			if (corrodingPlayers[i] == null) break;
			int start = RndInt(0,35);
    			ItemStack itemstack = null;
    			for (int j=0;j<36;j++){
    				itemstack=corrodingPlayers[i].inventory.mainInventory[(j+start)%36];
    				if (itemstack != null) break;
    			}
    			if (itemstack!=null){
    				int pow=3;
    				int propPow=(int) Math.pow(this.corrosion, pow);
    				int tenPow=(int) Math.pow(10, pow);
    				if (RndInt(0,tenPow)<propPow){
    					corrodingPlayers[i].inventory.consumeInventoryItem(itemstack.getItem());    
    				}		
    			}
    			corrodingPlayers[i]=null;
		}
	}
}
public void suffocate(){
	//System.out.println("start suffocation");
	if(suffocatingEntity[0]!= null){
		//System.out.println("isn't empty");
		for (int i=0;i<suffocatingEntity.length;i++){
			if (suffocatingEntity[i] == null) break;
			EntityLivingBase entity = suffocatingEntity[i];
			entity.setAir(entity.getAir()-5);
			//System.out.println("less air");
			suffocatingEntity[i]=null;
		}
	}
}
private int metaAdd(int meta1, int meta2){
	return 1+meta1+meta2;
}
private int metaSub(int meta1, int meta2){
	return (meta1+meta2-1)%16;
}
@Override
public void updateTick(World world, int x, int y, int z, Random random)
    {
	//world.setBlock(x, y, z, Blocks.air);	
	//System.out.println("update tick");
	if (this.flammable||this.explosive)igniteGas(world,x,y,z);
	if (this.corrosive)corrodeItem();
	if (this.corrosive && !this.source && this.decayDistance >= 12) System.out.println("It is unwise to have corrosive gases with such low decay rate! SHORTEN THE DISTANCE!");
	if (!this.breathable)suffocate();
	if (!this.source){
		if (RndInt(1,1000)>this.decayRate){
			if (canMove(world,x,y,z)){
				ForgeDirection dir = rndMove();
				if (dirFree(world,x,y,z,dir)){
					//this.stuck=true;
					if(y < 250){
						Block source = world.getBlock(x, y, z);
						world.setBlock(x+dir.offsetX, y+dir.offsetY, z+dir.offsetZ, source);
						world.setBlock(x, y, z, Blocks.air);
					}else{
						world.setBlock(x, y, z, Blocks.air);
					}
				}else if (dirDoor(world,x,y,z,dir)){
					Block source = world.getBlock(x, y, z);
					world.setBlock(x+2*dir.offsetX, y+2*dir.offsetY, z+2*dir.offsetZ, source);
					world.setBlock(x, y, z, Blocks.air);						
				}
				world.scheduleBlockUpdate(x, y, z, this, (int) (this.viscosity/10));
			}else world.scheduleBlockUpdate(x, y, z, this, (int) (this.viscosity));
		}else{
			world.setBlock(x, y, z, Blocks.air);	
		}
	}else{
		//System.out.println("Is Source");
		for (ForgeDirection dir: ForgeDirection.VALID_DIRECTIONS){
			if (dirFree(world,x,y,z,dir)){
				world.setBlock(x+dir.offsetX, y+dir.offsetY, z+dir.offsetZ, this.sourceTo);	
			}
		}
		world.scheduleBlockUpdate(x, y, z, this, (int) (this.viscosity/10));
	}
	if (this.burning) startFire(world,x,y,z);
    }
private void startFire(World world,int x,int y,int z){
	for (ForgeDirection dir: ForgeDirection.VALID_DIRECTIONS){
		Block check = world.getBlock(x+dir.offsetX, y+dir.offsetY, z+dir.offsetZ);
		if (check != BlocksGases.burningGas){
			if (check.isFlammable(world, x+dir.offsetX, y+dir.offsetY, z+dir.offsetZ, dir.getOpposite())){
				world.setBlock(x+dir.offsetX, y+dir.offsetY, z+dir.offsetZ, Blocks.fire);
			}				
		}
	}
}
//Can the block move in any direction?
private boolean canMove(World world, int x, int y, int z){
	if (this.corrosive){
		return true;
	}
	for (ForgeDirection dir: ForgeDirection.VALID_DIRECTIONS){
		Block check = world.getBlock(x+dir.offsetX, y+dir.offsetY, z+dir.offsetZ);
		if (check == Blocks.air||check==Blocks.fire){
			return true;
		}
	}
	return false;
}
//Is the direction free to move into somehow?
private boolean dirFree(World world, int x, int y, int z, ForgeDirection dir){
	Block block = world.getBlock(x+dir.offsetX, y+dir.offsetY, z+dir.offsetZ);
	if (block==Blocks.air){
		return true;
	}else if (RndInt(0,100)<this.corrosion && block != Blocks.bedrock){
		if (block instanceof Gases){
			Gases gas = (Gases) block;
			if(!gas.getSource()){
				return true;
			}
		}else return true;
	}
	return false;
}

private boolean dirDoor(World world, int x, int y, int z, ForgeDirection dir){
	Block block = world.getBlock(x+dir.offsetX, y+dir.offsetY, z+dir.offsetZ);
	if(block==Blocks.wooden_door || block==Blocks.iron_door||block==Blocks.trapdoor){
		Block second = world.getBlock(x+2*dir.offsetX, y+2*dir.offsetY, z+2*dir.offsetZ);
		if (second==Blocks.air){
			return true;				
		}else{
			return false;
		}
	}else{
		return false;
	} 
}
private int boolToInt(boolean bool){
	return bool?1:0;
}
//generate random direction based on density
private ForgeDirection rndMove(){
	int rnd = RndInt(0,100);
	int relDens = (int) (this.density-100);
	int rndUp = 84+relDens*16/100;
	int rndDown = 16+relDens*83/100;
	if (rnd>rndUp){
		return ForgeDirection.UP;
	}else if (rnd < rndDown){
		return ForgeDirection.DOWN;
	}else{
		return ForgeDirection.getOrientation(RndInt(2,5));
	}
}
//Rendering stuff
@Override
    public boolean renderAsNormalBlock()
    {
        return false;
    }
@Override
    public boolean isOpaqueCube()
{	
    return false;
}
@Override
    public int getRenderType()
{
    return ClientProxy.gasRenderType;
}
@Override
    public boolean canRenderInPass(int pass)
{
    //Set the static var in the client proxy
	//ClientProxy.renderPass = pass;
    //the block can render in both passes, so return true always
    return pass==1;
}
@Override
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side)
{
	Block block = world.getBlock(x, y, z);
	return blockRenderAgainst(block);
}
public static boolean blockRenderAgainst(Block block){
	if (block==Blocks.air||
			block==BlocksAS.deviceTorch||
			block==BlocksAS.firePlace||
			block==Blocks.tallgrass||
			block==Blocks.fire||
			block==Blocks.redstone_wire||
			block==Blocks.redstone_torch||
			block==Blocks.snow_layer||
			block==Blocks.water||
			block==Blocks.lava||
			block==Blocks.wooden_door||
			block==Blocks.iron_door||
			block==BlocksAS.deviceGasLamp||
			block instanceof Pipes){
			return true;
		}
		return false;
}
@Override
    public int getRenderBlockPass()
{
            return 1;
}
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
	return  this.blockIcon;
}

@SideOnly(Side.CLIENT)
    public void registerBlockIcons(IIconRegister icon)
    {
        this.blockIcon = icon.registerIcon(AeroSteam.MODID + ":" + this.texture);
    }

@Override
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
    {
        return null;
    }
/*
@Override
    public void velocityToAddToEntity(World world, int x, int y, int z, Entity entity, Vec3 vec)
    {
        if (densityDir > 0) return;
        Vec3 vec_flow = this.getFlowVector(world, x, y, z);
        vec.xCoord += vec_flow.xCoord * (quantaPerBlock * 4);
        vec.yCoord += vec_flow.yCoord * (quantaPerBlock * 4);
        vec.zCoord += vec_flow.zCoord * (quantaPerBlock * 4);
    }*/

//update tick with meta value is for concentration
/*public void updateTick(World world, int x, int y, int z, Random random)
    {
	//world.setBlock(x, y, z, Blocks.air);	
	//System.out.println("update tick");
	if (this.flammable||this.explosive)igniteGas(world,x,y,z);
	if (this.corrosive)corrodeItem();
	if (!this.breathable)suffocate();
	if (!this.source){
		if (canMove(world,x,y,z)){
			ForgeDirection dir = rndMove();
			if (dirFree(world,x,y,z,dir)){
				int meta = world.getBlockMetadata(x, y, z);
				//this.stuck=true;
				if(y < 250){
					Block target = world.getBlock(x+dir.offsetX, y+dir.offsetY, z+dir.offsetZ);
					if (target == this){
						int tmeta = world.getBlockMetadata(x+dir.offsetX, y+dir.offsetY, z+dir.offsetZ);
						int smeta = world.getBlockMetadata(x, y, z);
						int maxMeta = smeta; 
						if (smeta>(15-tmeta)) maxMeta=15-tmeta;
						int addmeta=RndInt(0,maxMeta);
						int newTmeta = metaAdd(tmeta,addmeta);
						int newSmeta = metaSub(smeta,addmeta);
						System.out.println("tmeta: " + tmeta);
						System.out.println("smeta: " + smeta);
						System.out.println("MaxMeta: " + maxMeta);
						System.out.println("new-tmeta: " + newTmeta);
						System.out.println("new-smeta: " + newSmeta);
						if (addmeta!=smeta){
							world.setBlockMetadataWithNotify(x+dir.offsetX, y+dir.offsetY, z+dir.offsetZ, newTmeta, 2);
							world.setBlockMetadataWithNotify(x, y, z, newSmeta, 2);
							world.scheduleBlockUpdate(x, y, z, this, (int) (this.viscosity/10));
							world.scheduleBlockUpdate(x+dir.offsetX, y+dir.offsetY, z+dir.offsetZ, this, (int) (this.viscosity/10));							
						}else{
							world.setBlockMetadataWithNotify(x+dir.offsetX, y+dir.offsetY, z+dir.offsetZ, metaAdd(tmeta,smeta), 2);
							world.setBlock(x, y, z, Blocks.air);	
							world.scheduleBlockUpdate(x+dir.offsetX, y+dir.offsetY, z+dir.offsetZ, this, (int) (this.viscosity/10));								
						}

						world.setBlock(x, y, z, Blocks.air);	
					}else{
						//world.setBlock(x, y, z, Blocks.air);	
						Block source = world.getBlock(x, y, z);
						if (meta>1){
							int realMeta = meta+1;
							int deltaMeta=RndInt(0,meta);

							int newTmeta = deltaMeta;
							int newSmeta = metaSub(,deltaMeta);
							System.out.println("meta: " + meta);
							System.out.println("deltaMeta: " + deltaMeta);
							System.out.println("new-tmeta: " + newTmeta);
							System.out.println("new-smeta: " + newSmeta);
							world.setBlock(x+dir.offsetX, y+dir.offsetY, z+dir.offsetZ, source, newTmeta, 2);		
							world.setBlockMetadataWithNotify(x, y, z, newSmeta, 2);
							world.scheduleBlockUpdate(x, y, z, this, (int) (this.viscosity/10));
						}else{
							if (meta==1){
								world.setBlock(x+dir.offsetX, y+dir.offsetY, z+dir.offsetZ, source, 0, 2);
								world.setBlock(x, y, z, Blocks.air);
							}else{
								if (RndInt(1,10)<=this.decayRate){
									world.setBlock(x, y, z, Blocks.air);									
								}else{
									world.setBlock(x+dir.offsetX, y+dir.offsetY, z+dir.offsetZ, source, 0, 2);
									world.setBlock(x, y, z, Blocks.air);
								}
							}
						}
					}
					world.scheduleBlockUpdate(x, y, z, this, (int) (this.viscosity/10));
				}else{
					world.setBlock(x, y, z, Blocks.air);
				}
			}else if(!this.flammable){
				world.scheduleBlockUpdate(x, y, z, this, (int) (this.viscosity/10));
			}else if (this.burning){
				System.out.println("Meta Decrease 1");
				int meta=world.getBlockMetadata(x, y, z);
				if (meta>0){
					world.setBlockMetadataWithNotify(x, y, z, meta-1, 2);
					world.scheduleBlockUpdate(x, y, z, this, (int) (this.viscosity/10));				
				}else{
					world.setBlock(x, y, z, Blocks.air);
				}
			}
		}else if (this.burning){
			System.out.println("Meta Decrease 2");
			int meta=world.getBlockMetadata(x, y, z);
			if (meta>0){
				world.setBlockMetadataWithNotify(x, y, z, meta-1, 2);
				world.scheduleBlockUpdate(x, y, z, this, (int) (this.viscosity/10));				
			}else{
				world.setBlock(x, y, z, Blocks.air);
			}
		}
	}else{
		//System.out.println("Is Source");
		for (ForgeDirection dir: ForgeDirection.VALID_DIRECTIONS){
			if (dirFree(world,x,y,z,dir)){
				world.setBlock(x+dir.offsetX, y+dir.offsetY, z+dir.offsetZ, this.sourceTo, 15, 2);	
			}
		}
		world.scheduleBlockUpdate(x, y, z, this, (int) (this.viscosity/10));
	}
	if (this.burning) startFire(world,x,y,z);
	world.scheduleBlockUpdate(x, y, z, this, (int) (this.viscosity/10));
    }*/
}

gas block code

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.