Jump to content

And... What the heck just happened?


CJCutrone9

Recommended Posts

Hey all, CJ here, I was recently creating a block (pretty standard) and when testing it in world I noticed something. It can be replaced with another block. When you try to place a block on top of it, or on the side of it, or anything, if you click on the block to do so, it replaces the block. Now, I went and did another block, and it doesn't do this at all. Looked, and I have the same stuff in it that affects bounding boxes and all that. Nothing. Yep, that is right, I originally messed with the BB and then took it out because it didn't fix it, but now it is gone. So their should be nothing that makes it do this, right? Well, that is what I thought. Here is the code I used for the block.

 

 

package net.CJCutrone.TheGrid.block;

 

import java.util.Random;

 

import net.CJCutrone.TheGrid.common.TheGrid;

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

import net.minecraft.client.renderer.texture.IconRegister;

import net.minecraft.entity.Entity;

import net.minecraft.item.Item;

import net.minecraft.util.AxisAlignedBB;

import net.minecraft.util.DamageSource;

import net.minecraft.world.Explosion;

import net.minecraft.world.World;

 

public class MaelstromSource extends Block{

 

public MaelstromSource(int par1, Material par2Material) {

super(par1, par2Material);

this.setHardness(1F);

this.setLightValue(-1F);

}

 

 

public void onEntityWalking(World par1World, int par2, int par3, int par4, Entity par5Entity) {

        par5Entity.attackEntityFrom(DamageSource.wither, 2.0F);

        par5Entity.setInWeb();

    }

 

 

public int idDropped(int par1, Random par2Random, int par3)

    {

        return 0;

    }

 

    public void registerIcons(IconRegister ir){

 

blockIcon = ir.registerIcon("TheGrid:MS");

 

}

   

    public void onBlockDestroyedByExplosion(World par1World, int par2, int par3, int par4, Explosion par5Explosion) {

   

   

    if(par1World.isAirBlock(par2, par3, par4)){

    par1World.setBlock(par2, par3, par4, TheGrid.MaelstromSource.blockID);

   

    }if(par1World.isAirBlock(par2 + 1, par3, par4)){

    par1World.setBlock(par2 + 1, par3, par4, TheGrid.MaelstromSource.blockID);

   

    }if(par1World.isAirBlock(par2, par3, par4 + 1)){

    par1World.setBlock(par2, par3, par4 + 1, TheGrid.MaelstromSource.blockID);

   

    }if(par1World.isAirBlock(par2 - 1, par3, par4)){

    par1World.setBlock(par2 - 1, par3, par4, TheGrid.MaelstromSource.blockID);

   

    }if(par1World.isAirBlock(par2, par3, par4 - 1)){

    par1World.setBlock(par2, par3, par4 - 1, TheGrid.MaelstromSource.blockID);

    }if(!par1World.isAirBlock(par2, par3 + 1, par4)){

    par1World.setBlock(par2, par3 + 1, par4, TheGrid.MaelstromSource.blockID);

    }

    }

   

    public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5) {

   

    par1World.setBlock(par2, par3, par4, TheGrid.MaelstromSource.blockID);

   

    }

}

 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now


×
×
  • Create New...

Important Information

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