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

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.