• Posts

    • Not modifying the biome but adding the name into the item for all biomes. exp. Plans Spice  Swamp Spice ect.
    • Hi I can't seem to open certain chests and doors. Me and my husband play on a private server.  I'll can access doors and chests in the base. But not in a dungeon just a bit away that my husband placed. And a door leading to a barn and a gate in the barn. If you need more info please contact me at bigfig11@q.com
    • Basically, I've created a 2x1 block, using pieces of code from the BlockBed class. The problem is that when I use the item to place the block, the blocks are both without texture and, if I select them and press F3, I can see that the block is "minecraft:air". A strange fact is that, if I place the block with /setblock command, it gives texture and model. So, what may be the issue? When I use the item: When I do /setblock The model of my block: block_afp.jsonblock_afp_top.json The class of my block: package com.lorenzopapi.portalgun.common.block; import java.util.Random; import com.lorenzopapi.portalgun.common.init.ModItems; import com.lorenzopapi.portalgun.common.tileentity.TileEntityAFP; import com.lorenzopapi.portalgun.common.util.AABB; import net.minecraft.block.Block; import net.minecraft.block.BlockHorizontal; import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.material.EnumPushReaction; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockFaceShape; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.IStringSerializable; import net.minecraft.util.Rotation; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class BlockAFP extends BlockHorizontal implements ITileEntityProvider { public static final PropertyEnum<BlockAFP.EnumPartType> PART = PropertyEnum.<BlockAFP.EnumPartType>create("part", BlockAFP.EnumPartType.class); protected static final AABB AFP_X_AABB = new AABB(0, 0, 2, 16, 1, 14); protected static final AABB AFP_Z_AABB = new AABB(2, 0, 0, 14, 1, 16); public BlockAFP() { super(Material.CIRCUITS); this.setDefaultState(this.getBlockState().getBaseState().withProperty(PART, BlockAFP.EnumPartType.TOP).withProperty(FACING, EnumFacing.NORTH)); this.hasTileEntity = true; } @Override public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state) { BlockPos blockpos = pos; if (state.getValue(PART) == BlockAFP.EnumPartType.TOP) { blockpos = pos.offset((EnumFacing)state.getValue(FACING)); } TileEntity tileentity = worldIn.getTileEntity(blockpos); return new ItemStack(Items.BED, 1); } @Override public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) { if (player.capabilities.isCreativeMode && state.getValue(PART) == BlockAFP.EnumPartType.TOP) { BlockPos blockpos = pos.offset((EnumFacing)state.getValue(FACING)); if (worldIn.getBlockState(blockpos).getBlock() == this) { worldIn.setBlockToAir(blockpos); } } } @Override public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) { EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); if (state.getValue(PART) == BlockAFP.EnumPartType.TOP) { if (worldIn.getBlockState(pos.offset(enumfacing)).getBlock() != this) { worldIn.setBlockToAir(pos); } } else if (worldIn.getBlockState(pos.offset(enumfacing.getOpposite())).getBlock() != this) { if (!worldIn.isRemote) { this.dropBlockAsItem(worldIn, pos, state, 0); } worldIn.setBlockToAir(pos); } } @Override public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack stack) { if (state.getValue(PART) == BlockAFP.EnumPartType.DOWN && te instanceof TileEntityAFP) { TileEntityAFP tileentityafp = (TileEntityAFP)te; ItemStack itemstack = tileentityafp.getItemStack(); spawnAsEntity(worldIn, pos, itemstack); } else { super.harvestBlock(worldIn, player, pos, state, (TileEntity)null, stack); } } @Override public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { EnumFacing enumfacing = state.getValue(FACING); return enumfacing.getAxis() == EnumFacing.Axis.X ? AFP_X_AABB.toAABB() : AFP_Z_AABB.toAABB(); } @Override public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) { EnumFacing enumfacing = placer.getHorizontalFacing(); return super.getStateForPlacement(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer, hand).withProperty(FACING, enumfacing); } @Override public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { return new ItemStack(ModItems.itemAFP, 1); } @Override public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) { if (world.getBlockState(pos.down()).getBlock() != Blocks.AIR) { return world.getBlockState(pos.down()).getBlock().getLightValue(state, world, pos.down()); } return 0; } @Override public IBlockState getStateFromMeta(int meta) { EnumFacing enumfacing = EnumFacing.getHorizontal(meta); return (meta & 4) > 0 ? this.getDefaultState().withProperty(PART, BlockAFP.EnumPartType.DOWN).withProperty(FACING, enumfacing) : this.getDefaultState().withProperty(PART, BlockAFP.EnumPartType.TOP).withProperty(FACING, enumfacing); } @Override public int getMetaFromState(IBlockState state) { int i = 0; i = i | (state.getValue(FACING)).getHorizontalIndex(); if (state.getValue(PART) == BlockAFP.EnumPartType.DOWN) { i |= 4; } return i; } @Override public void breakBlock(World worldIn, BlockPos pos, IBlockState state) { super.breakBlock(worldIn, pos, state); worldIn.removeTileEntity(pos); } @Override protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, new IProperty[] { FACING, PART }); } @Override public IBlockState withRotation(IBlockState state, Rotation rot) { return state.withProperty(FACING, rot.rotate(state.getValue(FACING))); } @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { return state.getValue(PART) == BlockAFP.EnumPartType.TOP ? Items.AIR : ModItems.itemAFP; } public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) { return BlockFaceShape.UNDEFINED; } @Override public boolean hasTileEntity(IBlockState state) { return true; } @Override public boolean isOpaqueCube(IBlockState state) { return false; } @Override public boolean isFullCube(IBlockState state) { return false; } @Override public EnumPushReaction getMobilityFlag(IBlockState state) { return EnumPushReaction.DESTROY; } @Override public TileEntity createNewTileEntity(World worldIn, int meta) { return new TileEntityAFP(); } /*@Override public IBlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(FACING, EnumFacing.getHorizontal(meta & 3)); } @Override public int getMetaFromState(IBlockState state) { int i = 0; i = i | state.getValue(FACING).getHorizontalIndex(); return i; }*/ public static enum EnumPartType implements IStringSerializable { DOWN("down"), TOP("top"); private final String name; private EnumPartType(String name) { this.name = name; } public String toString() { return this.name; } public String getName() { return this.name; } } } And also, do you know why, even if my textures are transparent, there isn't transparency?
    • It has nothing to do with dimension. InventoryPlayer#isUsableByPlayer requires the using player to be within 8 blocks of the target player. You need to create your own inventory wrapper which does not have this limitation.
  • Topics

  • Who's Online (See full list)