[Edité]
Voilà, alors Aymeric, c’est la deuxième fois que tu m’aides à résoudre un souci et sincèrement, merci ! Cela faisait plusieurs semaines que je bloquais sur l’affaire … 😛
Si l’on retire le “addCollisionBoxesToList”, il y a des bugs où l’on peut passer au travers, en le laissant, tout fonctionne comme je le souhaite 😉
Pour ceux que ça intéresse:
package com.mod.trillium.blocks;
import java.util.List;
import com.mod.trillium.proxy.ClientProxy;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockRenduIS extends Block {
public BlockRenduIS(Material p_i45394_1_) {
super(p_i45394_1_);
}
@SideOnly(Side.CLIENT)
public float getAmbientOcclusionLightValue() {
return 1.0F;
}
public boolean renderAsNormalBlock() {
return false;
}
public boolean isOpaqueCube() {
return false;
}
@SideOnly(Side.CLIENT)
public int getRenderType() {
return ClientProxy.renderIsbrh;
}
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess state, int x, int y, int z, int side) {
return true;
}
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB axisAlignedBB, List list, Entity entity)
{
if(world.getBlockMetadata(x, y, z) == 0)
{
this.setBlockBounds(0.25F, 0.0F, 0.50F, 0.75F, 1.0F, 1.0F);
super.addCollisionBoxesToList(world, x, y, z, axisAlignedBB, list, entity);
}
if(world.getBlockMetadata(x, y, z) == 1)
{
this.setBlockBounds(0.0F, 0.0F, 0.25F, 0.50F, 1.0F, 0.75F);
super.addCollisionBoxesToList(world, x, y, z, axisAlignedBB, list, entity);
}
if(world.getBlockMetadata(x, y, z) == 2)
{
this.setBlockBounds(0.25F, 0.0F, 0.0F, 0.75F, 1.0F, 0.50F);
super.addCollisionBoxesToList(world, x, y, z, axisAlignedBB, list, entity);
}
if(world.getBlockMetadata(x, y, z) == 3)
{
this.setBlockBounds(0.50F, 0.0F, 0.25F, 1.0F, 1.0F, 0.75F);
super.addCollisionBoxesToList(world, x, y, z, axisAlignedBB, list, entity);
}
}
@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z)
{
if(world.getBlockMetadata(x, y, z) == 0)
{
this.setBlockBounds(0.25F, 0.0F, 0.50F, 0.75F, 1.0F, 1.0F);
}
if(world.getBlockMetadata(x, y, z) == 1)
{
this.setBlockBounds(0.0F, 0.0F, 0.25F, 0.50F, 1.0F, 0.75F);
}
if(world.getBlockMetadata(x, y, z) == 2)
{
this.setBlockBounds(0.25F, 0.0F, 0.0F, 0.75F, 1.0F, 0.50F);
}
if(world.getBlockMetadata(x, y, z) == 3)
{
this.setBlockBounds(0.50F, 0.0F, 0.25F, 1.0F, 1.0F, 0.75F);
}
}
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase living, ItemStack stack)
{
int direction = MathHelper.floor_double((double)(living.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3;
world.setBlockMetadataWithNotify(x, y, z, direction, 2);
}
}
```
Merci encore !