Steel Table BB fixed. Floor Grating: Items pass through). Lang ru_ru updated by Shellyoung (PR #45).

This commit is contained in:
stfwi 2019-08-11 22:18:54 +02:00
parent 5c056abba6
commit f481d69c35
9 changed files with 56 additions and 20 deletions

View file

@ -12,13 +12,17 @@ import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;
public class BlockDecorFloorGrating extends BlockDecor
{
@ -39,6 +43,32 @@ public class BlockDecorFloorGrating extends BlockDecor
@Override
public BlockFaceShape getBlockFaceShape(IBlockAccess world, IBlockState state, BlockPos pos, EnumFacing face)
{ return BlockFaceShape.SOLID; }
{ return BlockFaceShape.UNDEFINED; }
@Override
public void addCollisionBoxToList(IBlockState state, World world, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entity, boolean isActualState)
{ if(!(entity instanceof EntityItem)) super.addCollisionBoxToList(state, world, pos, entityBox, collidingBoxes, entity, isActualState); }
@Override
public void onFallenUpon(World world, BlockPos pos, Entity entity, float fallDistance)
{
if(!(entity instanceof EntityItem)) {
entity.fall(fallDistance, 1.0F);
} else {
entity.setVelocity(0,-0.2,0);
}
}
@Override
public void onEntityCollision(World world, BlockPos pos, IBlockState state, Entity entity)
{
if(!(entity instanceof EntityItem)) return;
if((entity.posY-pos.getY()) > 0.7) {
if(entity.motionY > -0.2) entity.motionY = -0.2;
entity.setVelocity(0,-0.1,0);
entity.setPositionAndUpdate(entity.posX, entity.posY-0.3, entity.posZ);
} else {
entity.setVelocity(0,entity.motionY,0);
}
}
}

View file

@ -251,7 +251,7 @@ public class ModBlocks
"steel_table",
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT,
Material.IRON, 1.0f, 15f, SoundType.METAL,
ModAuxiliaries.getPixeledAABB(0,0,0, 16,15.9,16)
ModAuxiliaries.getPixeledAABB(0,0,0, 16,16,16)
);
public static final BlockDecorFloorGrating STEEL_FLOOR_GRATING = new BlockDecorFloorGrating(