• Recently Browsing

    No registered users viewing this page.

  • Posts

    • Stuff like this is really hard to debug by just staring at the code, looking at it I don't see anything obvious. Please post a working Git repository of your mod so I can test this locally.
    • That appears to be latest.log from your server, that is not what I asked for and doesn’t appear to contain any messages about a client attempting to connect.
    • Oops, I totally forgot about that  😓. Here is the item class: package com.lorenzopapi.portalgun.common.item; import com.lorenzopapi.portalgun.common.PortalGun; import com.lorenzopapi.portalgun.common.block.BlockAFP; import com.lorenzopapi.portalgun.common.init.ModBlocks; import com.lorenzopapi.portalgun.common.util.Reference; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; public class ItemAFP extends ItemBlock { public ItemAFP(Block block) { super(block); this.setMaxStackSize(1); this.setMaxDamage(0); this.setRegistryName(Reference.MOD_ID, "item_aerial_faith_plate"); this.setCreativeTab(PortalGun.CREATIVE_TAB); } @Override public CreativeTabs getCreativeTab() { return PortalGun.CREATIVE_TAB; } @Override public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if (worldIn.isRemote) { return EnumActionResult.SUCCESS; } else if (facing != EnumFacing.UP) { return EnumActionResult.FAIL; } else { IBlockState iblockstate = worldIn.getBlockState(pos); Block block = iblockstate.getBlock(); boolean flag = block.isReplaceable(worldIn, pos); if (!flag) { pos = pos.up(); } int i = MathHelper.floor((double)(player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; EnumFacing enumfacing = EnumFacing.getHorizontal(i); BlockPos blockpos = pos.offset(enumfacing); ItemStack itemstack = player.getHeldItem(hand); if (player.canPlayerEdit(pos, facing, itemstack) && player.canPlayerEdit(blockpos, facing, itemstack)) { IBlockState iblockstate1 = worldIn.getBlockState(blockpos); boolean flag1 = iblockstate1.getBlock().isReplaceable(worldIn, blockpos); boolean flag2 = flag || worldIn.isAirBlock(pos); boolean flag3 = flag1 || worldIn.isAirBlock(blockpos); if (flag2 && flag3 && worldIn.getBlockState(pos.down()).isTopSolid() && worldIn.getBlockState(blockpos.down()).isTopSolid()) { IBlockState iblockstate2 = ModBlocks.blockAfp.getDefaultState().withProperty(BlockAFP.FACING, enumfacing).withProperty(BlockAFP.PART, BlockAFP.EnumPartType.TOP); worldIn.setBlockState(pos, iblockstate2, 10); worldIn.setBlockState(blockpos, iblockstate2.withProperty(BlockAFP.PART, BlockAFP.EnumPartType.DOWN), 10); //SoundType soundtype = iblockstate2.getBlock().getSoundType(iblockstate2, worldIn, pos, player); //worldIn.playSound((EntityPlayer)null, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F); TileEntity tileentity = worldIn.getTileEntity(blockpos); worldIn.notifyNeighborsRespectDebug(pos, block, false); worldIn.notifyNeighborsRespectDebug(blockpos, iblockstate1.getBlock(), false); itemstack.shrink(1); return EnumActionResult.SUCCESS; } else { return EnumActionResult.FAIL; } } else { return EnumActionResult.FAIL; } } } }  
  • Topics

  • Who's Online (See full list)