use of net.minecraft.block.BlockFenceGate in project Bewitchment by Um-Mitternacht.
the class BlockScornedBrickFence method canConnectTo.
public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos, EnumFacing p_176524_3_) {
IBlockState iblockstate = worldIn.getBlockState(pos);
BlockFaceShape blockfaceshape = iblockstate.getBlockFaceShape(worldIn, pos, p_176524_3_);
Block block = iblockstate.getBlock();
boolean flag = blockfaceshape == BlockFaceShape.MIDDLE_POLE && (iblockstate.getMaterial() == this.blockMaterial || block instanceof BlockFenceGate);
return !isExcepBlockForAttachWithPiston(block) && blockfaceshape == BlockFaceShape.SOLID || flag;
}
use of net.minecraft.block.BlockFenceGate in project Tropicraft by Tropicraft.
the class BlockTropicraftFence method canConnectTo.
@Override
public boolean canConnectTo(IBlockAccess world, BlockPos pos, EnumFacing facing) {
IBlockState state = TCGenUtils.getBlockState(world, pos);
Block block = state.getBlock();
if (block != this && block != BlockRegistry.bambooFenceGate && block != BlockRegistry.palmFenceGate) {
return block == Blocks.BARRIER ? false : ((!(block instanceof BlockFence) || state.getMaterial() != this.blockMaterial) && !(block instanceof BlockFenceGate) ? (state.getMaterial().isOpaque() && state.isFullCube() ? state.getMaterial() != Material.GOURD : false) : true);
} else {
return true;
}
}
use of net.minecraft.block.BlockFenceGate in project EnderIO by SleepyTrousers.
the class CapturedMob method spawn.
public boolean spawn(@Nullable World world, @Nullable BlockPos pos, @Nullable EnumFacing side, boolean clone) {
if (world == null || pos == null) {
return false;
}
@Nonnull EnumFacing theSide = side != null ? side : EnumFacing.UP;
Entity entity = getEntity(world, pos, null, clone);
if (entity == null) {
return false;
}
Block blk = world.getBlockState(pos).getBlock();
double spawnX = pos.getX() + theSide.getFrontOffsetX() + 0.5;
double spawnY = pos.getY() + theSide.getFrontOffsetY();
double spawnZ = pos.getZ() + theSide.getFrontOffsetZ() + 0.5;
if (theSide == EnumFacing.UP && (blk instanceof BlockFence || blk instanceof BlockWall || blk instanceof BlockFenceGate)) {
spawnY += 0.5;
}
entity.setLocationAndAngles(spawnX, spawnY, spawnZ, world.rand.nextFloat() * 360.0F, 0);
if (!world.checkNoEntityCollision(entity.getEntityBoundingBox()) || !world.getCollisionBoxes(entity, entity.getEntityBoundingBox()).isEmpty()) {
return false;
}
if (customName != null && entity instanceof EntityLiving) {
((EntityLiving) entity).setCustomNameTag(customName);
}
if (!world.spawnEntity(entity)) {
entity.setUniqueId(MathHelper.getRandomUUID(world.rand));
if (!world.spawnEntity(entity)) {
return false;
}
}
if (entity instanceof EntityLiving) {
((EntityLiving) entity).playLivingSound();
}
return true;
}
use of net.minecraft.block.BlockFenceGate in project minecolonies by Minecolonies.
the class EntityAIGateInteract method getBlockFence.
/**
* Returns a fenceBlock if available.
*
* @param pos the position to be searched.
* @return fenceBlock or null.
*/
private BlockFenceGate getBlockFence(@NotNull final BlockPos pos) {
final IBlockState blockState = CompatibilityUtils.getWorld(this.theEntity).getBlockState(pos);
Block block = blockState.getBlock();
if (!(block instanceof BlockFenceGate && blockState.getMaterial() == Material.WOOD)) {
block = CompatibilityUtils.getWorld(this.theEntity).getBlockState(this.theEntity.getPosition()).getBlock();
gatePosition = this.theEntity.getPosition();
}
return block instanceof BlockFenceGate && blockState.getMaterial() == Material.WOOD ? (BlockFenceGate) block : null;
}
use of net.minecraft.block.BlockFenceGate in project Minestuck by mraof.
the class ClientEditHandler method onRightClickEvent.
@SubscribeEvent(priority = EventPriority.NORMAL)
public void onRightClickEvent(PlayerInteractEvent.RightClickBlock event) {
if (event.getWorld().isRemote && event.getEntityPlayer() == ClientProxy.getClientPlayer() && isActive()) {
Block block = event.getWorld().getBlockState(event.getPos()).getBlock();
ItemStack stack = event.getEntityPlayer().getHeldItemMainhand();
event.setUseBlock((block instanceof BlockDoor || block instanceof BlockTrapDoor || block instanceof BlockFenceGate) ? Result.ALLOW : Result.DENY);
if (event.getUseBlock() == Result.ALLOW)
return;
if (event.getHand().equals(EnumHand.OFF_HAND) || !ServerEditHandler.isBlockItem(stack.getItem())) {
event.setCanceled(true);
return;
}
GristSet cost;
if (DeployList.containsItemStack(stack))
if (givenItems[DeployList.getOrdinal(stack)])
cost = DeployList.getSecondaryCost(stack);
else
cost = DeployList.getPrimaryCost(stack);
else
cost = GristRegistry.getGristConversion(stack);
if (!GristHelper.canAfford(MinestuckPlayerData.getClientGrist(), cost)) {
StringBuilder str = new StringBuilder();
if (cost != null) {
for (GristAmount grist : cost.getArray()) {
if (cost.getArray().indexOf(grist) != 0)
str.append(", ");
str.append(grist.getAmount() + " " + grist.getType().getDisplayName());
}
event.getEntityPlayer().sendMessage(new TextComponentTranslation("grist.missing", str.toString()));
}
event.setCanceled(true);
}
if (event.getUseItem() == Result.DEFAULT)
event.setUseItem(Result.ALLOW);
}
}
Aggregations