- 1,185
- 3
Почему у меня прозрачный блок? Это из-за того, что я использую setBlockBounds? Как это исправить?
И ещё, знаю что было, но заодно и спрошу, как убрать все затемнения от блока? (Когда ставишь блок, блоки рядом неправильно затемняются)
И ещё, знаю что было, но заодно и спрошу, как убрать все затемнения от блока? (Когда ставишь блок, блоки рядом неправильно затемняются)
Код:
package com.svk.addItems.blocks;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.EnumSkyBlock;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import com.svk.addItems.ModInfo;
import com.svk.addItems.BaseClassMod;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockSlab extends Block
{
public BlockSlab(String name)
{
super(Material.rock);
this.setBlockName(name + "SlabBlock");
this.setBlockTextureName(ModInfo.MODID+ ":" + name);
this.func_150154_b(0);
}
/**
* Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been
* cleared to be reused)
*/
public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_)
{
int l = p_149668_1_.getBlockMetadata(p_149668_2_, p_149668_3_, p_149668_4_) & 7;
float s = 0;
if(l == 1)
{
s = 0.5F;
}
else if(l == 2)
{
s = 1.0F;
}
else if(l == 3)
{
s = 0.1F;
}
return AxisAlignedBB.getBoundingBox((double)p_149668_2_ + this.minX, (double)p_149668_3_ + this.minY, (double)p_149668_4_ + this.minZ, (double)p_149668_2_ + this.maxX, (double)((float)p_149668_3_ + s), (double)p_149668_4_ + this.maxZ);
}
/**
* Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two
* adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.
*/
public boolean isOpaqueCube()
{
return false;
}
/**
* If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
*/
public boolean renderAsNormalBlock()
{
return false;
}
/**
* Sets the block's bounds for rendering it as an item
*/
public void setBlockBoundsForItemRender()
{
this.func_150154_b(0);
}
/**
* Updates the blocks bounds based on its current state. Args: world, x, y, z
*/
public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_)
{
this.func_150154_b(p_149719_1_.getBlockMetadata(p_149719_2_, p_149719_3_, p_149719_4_));
}
protected void func_150154_b(int meta)
{
int j = meta & 7;
if(meta == 1)
{
this.setBlockBounds(0.0F, 0, 0.0F, 1.0F, 0.5F, 1.0F);
}
else if(meta == 2)
{
this.setBlockBounds(0.0F, 0.5F, 0.0F, 1.0F, 1, 1.0F);
}
else if(meta == 3)
{
this.setBlockBounds(0.0F, 0, 0.0F, 1.0F, 0.1F, 1.0F);
}
}
/**
* Returns the quantity of items to drop on block destruction.
*/
public int quantityDropped(Random p_149745_1_)
{
return 1;
}
}